client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 31 ++++++++++++
1 file changed, 31 insertions(+)
New commits:
commit fcaa4e5e75301f1faa2cf98fdbde1397924370bb
Author: Flavio Leitner <fleitner(a)redhat.com>
Date: Wed Dec 2 17:55:18 2009 +0100
543577 - report permanent hw addr for all slaves in network bonding
Depending on bonding mode, slave devices can have their hwaddr changed,
so it's necessary to read it from /proc/net/bonding/<master> instead of
usual ethtool interface.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
index b8aee9b..c898775 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
@@ -687,6 +687,27 @@ def findHostByRoute():
hostname = "unknown"
s.close()
return hostname, intf
+
+def get_slave_hwaddr(master, slave):
+ hwaddr = ""
+ try:
+ bonding = open('/proc/net/bonding/%s' % master, "r")
+ except:
+ return hwaddr
+
+ slave_found = False
+ for line in bonding.readlines():
+ if slave_found and string.find(line, "Permanent HW addr: ") != -1:
+ hwaddr = string.split(line)[3]
+ break
+
+ if string.find(line, "Slave Interface: ") != -1:
+ ifname = string.split(line)[2]
+ if ifname == slave:
+ slave_found = True
+
+ bonding.close()
+ return hwaddr
def read_network():
netdict = {}
@@ -721,6 +742,16 @@ def read_network_interfaces():
except:
hwaddr = ""
+ # slave devices can have their hwaddr changed
+ try:
+ master = os.readlink('/sys/class/net/%s/master' % interface)
+ except:
+ master = None
+
+ if master:
+ master_interface = os.path.basename(master)
+ hwaddr = get_slave_hwaddr(master_interface, interface)
+
try:
module = ethtool.get_module(interface)
except:
Show replies by date