Skip to content

Commit

Permalink
CA-161538: Checking xen-backend in link of /sys/class/net/*/device/dr…
Browse files Browse the repository at this point in the history
…iver to identify vifs. It backport the CA-137227 in ocaml/network/network_utils.ml

Signed-off-by: Sharad Yadav <sharad.yadav@citrix.com>
  • Loading branch information
sharady committed Feb 23, 2015
1 parent 21d5827 commit b887d64
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ocaml/network/network_utils.ml
Expand Up @@ -86,9 +86,10 @@ module Sysfs = struct

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))
let devpath = getpath name "device" in
let driver_link = Unix.readlink (devpath ^ "/driver") in
(* filter out symlinks under device/driver which look like /../../../devices/xen-backend/vif- *)
not(List.mem "xen-backend" (String.split '/' driver_link))
with _ -> false

let get_carrier name =
Expand Down

0 comments on commit b887d64

Please sign in to comment.