Skip to content

Commit

Permalink
Merge pull request #49 from simonjbeaumont/ca-151464
Browse files Browse the repository at this point in the history
CA-151464: Don't assume interface is bonded if master sysfs key exists
  • Loading branch information
simonjbeaumont committed Jan 9, 2015
2 parents bc0140f + aab72b5 commit 4c8fd89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/network_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,11 @@ module Linux_bonding = struct

let get_bond_master_of slave =
try
let path = Unix.readlink (Sysfs.getpath slave "master") in
Some (List.hd (List.rev (String.split '/' path)))
let master_symlink = Sysfs.getpath slave "master" in
let master_path = Unix.readlink master_symlink in
let slaves_path = Filename.concat master_symlink "bonding/slaves" in
Unix.access slaves_path [ Unix.F_OK ];
Some (List.hd (List.rev (String.split '/' master_path)))
with _ -> None
end

Expand Down

0 comments on commit 4c8fd89

Please sign in to comment.