aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-11-15 13:40:17 +0000
committerBryn M. Reeves <bmr@redhat.com>2013-11-15 13:40:17 +0000
commit4e7713142c37ca7858cbc86b3bbc2bf8245ff33e (patch)
tree0dc3355fa283dd6c259f19faf00ee2e25b84f454
parentefa345c8eea3d4bcfa8a05bd86fccb33616da07b (diff)
downloadsos-4e7713142c37ca7858cbc86b3bbc2bf8245ff33e.tar.gz
Make ethernet interface detection more robust
The networking module parses the link information in the output of the 'ip -o addr' command to determine a list of ethernet interfaces on which to run ethtool. An upstream change in the iproute package appears to have introduced a regression in the output of this command which causes link information to not be displayed: 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000\ link/ether 52:54:00:ce:9d:6d brd ff:ff:ff:ff:ff:ff 2: eth0 inet 192.168.122.31/24 brd 192.168.122.255 scope global eth0\ valid_lft forever preferred_lft forever 2: eth0 inet6 fe80::5054:ff:fece:9d6d/64 scope link \ valid_lft forever preferred_lft forever vs: 2: eth0 inet 192.168.122.31/24 brd 192.168.122.255 scope global eth0\ valid_lft forever preferred_lft forever 2: eth0 inet6 fe80::5054:ff:fece:9d6d/64 scope link \ valid_lft forever preferred_lft forever This breaks detection of ethernet interfaces and all ethtool data collection. This was introduced in the following iproute commit: commit af9d406f99853848054162ed7aefbe71dc03e433 Author: Mike Frysinger <vapier@gentoo.org> Date: Mon Aug 13 08:09:52 2012 -0700 Fix regression with 'ip address show' Which appears to fix a different problem (i.e. the change to link info was unintended). Make this more robust by switching the networking module to use 'ip -o link' instead which explicitly requests the required information. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/networking.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 9724a4f6..64fb9622 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -41,16 +41,16 @@ class Networking(Plugin):
out.append(br_name)
return out
- def get_interface_name(self,ip_addr_out):
- """Return a dictionary for which key are interface name according to the
- output of ifconifg-a stored in ifconfig_file.
+ def get_eth_interfaces(self,ip_link_out):
+ """Return a dictionary for which keys are ethernet interface
+ names taken from the output of "ip -o link".
"""
out={}
- for line in ip_addr_out[1].splitlines():
+ for line in ip_link_out[1].splitlines():
match=re.match('.*link/ether', line)
if match:
- int=match.string.split(':')[1].lstrip()
- out[int]=True
+ iface=match.string.split(':')[1].lstrip()
+ out[iface]=True
return out
def collect_iptable(self,tablename):
@@ -85,7 +85,6 @@ class Networking(Plugin):
self.add_forbidden_path("/proc/net/rpc/*/flush")
ip_addr_file=self.get_cmd_output_now("ip -o addr", root_symlink = "ip_addr")
- ip_addr_out=self.call_ext_prog("ip -o addr")
self.add_cmd_output("route -n", root_symlink = "route")
self.collect_iptable("filter")
self.collect_iptable("nat")
@@ -101,8 +100,9 @@ class Networking(Plugin):
self.add_cmd_output("ip mroute show")
self.add_cmd_output("ip maddr show")
self.add_cmd_output("ip neigh show")
- if ip_addr_out:
- for eth in self.get_interface_name(ip_addr_out):
+ ip_link_out=self.call_ext_prog("ip -o link")
+ if ip_link_out:
+ for eth in self.get_eth_interfaces(ip_link_out):
self.add_cmd_output("ethtool "+eth)
self.add_cmd_output("ethtool -i "+eth)
self.add_cmd_output("ethtool -k "+eth)