let news = devstate_of_int (Int32.to_int news) in
(* previous state *)
let olds = devstate_of_int (Int32.to_int olds) in
- (* to keep it simple we look the nic by bridge name.. *)
- let bridge = get_devintf bus path in
- let nics = List.filter (fun n -> n.ns_bridge = bridge) state.vm_nics in
- (match nics with
- | [nic] ->
- let id = nic.ns_id in
- when_conn_changed xs state id news olds
- | _ ->
- ()
- )
+ let nics =
+ let intf = get_devintf bus path in
+ match intf with
+ | "brbridged" ->
+ (* it is wired connection which has changed state *)
+ List.find_all (fun n ->
+ n.ns_bridge = "brshared" ||
+ n.ns_bridge = "brbridged" ||
+ n.ns_bridge = "brinternal") state.vm_nics
+ | _ ->
+ (* it is wireless connection which has changed state *)
+ List.find_all (fun n -> n.ns_bridge = "brwireless") state.vm_nics
+ in
+ List.iter (fun nic -> when_conn_changed xs state nic.ns_id news olds) nics
| _ -> ()