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