# HG changeset patch # User David Scott # Date 1270658636 -3600 # Node ID 27bad449e0035f08da470f6bda2ba69c987f8452 # Parent cce821ec37aece522f4d78684c464ad9563477f7 CA-38463: backend vifs now have proper "device" symlinks in /sys so to tell the difference between them and a real "physical" interface, look to see whether they link to devices/xen-backend/... This prevents PIF.scan from accidentally introducing vifX.Y as PIFs... Signed-off-by: David Scott diff -r cce821ec37ae -r 27bad449e003 ocaml/netdev/netdev.ml --- a/ocaml/netdev/netdev.ml Wed Apr 07 17:06:31 2010 +0100 +++ b/ocaml/netdev/netdev.ml Wed Apr 07 17:43:56 2010 +0100 @@ -385,7 +385,12 @@ read_id_from (getpath name "device/vendor"), read_id_from (getpath name "device/device") -let is_physical name = try Unix.access (getpath name "device") [ Unix.F_OK ]; true with _ -> false +let is_physical name = + try + let link = Unix.readlink (getpath name "device") in + (* filter out device symlinks which look like /../../../devices/xen-backend/vif- *) + not(List.mem "xen-backend" (String.split '/' link)) + with _ -> false (* Dispatch network backend operations. *)