Vmm_unix: fix ip tuntap command (provide tap name earlier), also set link up

This commit is contained in:
Hannes Mehnert 2020-04-03 17:29:46 +02:00
parent 18728a7601
commit be83686a22

View file

@ -145,9 +145,9 @@ let create_tap bridge =
| Ok _ -> find_n (succ x)
in
let tap = find_n 0 in
Bos.OS.Cmd.run Bos.Cmd.(v "ip" % "tuntap" % "add" % "mode" % "tap" % tap) >>= fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "ip" % "tuntap" % "add" % tap % "mode" % "tap") >>= fun () ->
(* TODO maybe: ip link set $tap master $bridge -- no brctl *)
(* TODO also needed? ip link set dev $tap up -- or is it auto-up? *)
Bos.OS.Cmd.run Bos.Cmd.(v "ip" % "link" % "set" % "dev" % tap % "up") >>= fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "brctl" % "addif" % bridge % tap) >>= fun () ->
Ok tap