aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2017-09-05 22:13:28 +0200
committerBryn M. Reeves <bmr@redhat.com>2017-10-20 16:37:31 +0100
commit5e7dfe079749748e2b57ed7047fd059c07dc9dbb (patch)
tree7f9b10ad47185ba4ea48c9853080888d6af75037
parentac509328d3c949e4063aafb35a328b9b859c213a (diff)
downloadsos-5e7dfe079749748e2b57ed7047fd059c07dc9dbb.tar.gz
[networking] collect iptables for all existing tables
Collect iptables and ip6tables for any table present in /proc/net/ip*_tables_names. Relevant to: #1092 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/plugins/networking.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 36773557..bb930ad7 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -152,12 +152,21 @@ class Networking(Plugin):
self.add_cmd_output("ip -o addr", root_symlink="ip_addr")
self.add_cmd_output("route -n", root_symlink="route")
self.add_cmd_output("plotnetcfg")
- self.collect_iptable("filter")
- self.collect_iptable("nat")
- self.collect_iptable("mangle")
- self.collect_ip6table("filter")
- self.collect_ip6table("nat")
- self.collect_ip6table("mangle")
+ # collect iptables -t for any existing table, if we can't read the
+ # tables, collect 3 default ones (nat, mangle, filter)
+ try:
+ ip_tables_names = open("/proc/net/ip_tables_names").read()
+ except:
+ ip_tables_names = "nat\nmangle\nfilter\n"
+ for table in ip_tables_names.splitlines():
+ self.collect_iptable(table)
+ # collect the same for ip6tables
+ try:
+ ip_tables_names = open("/proc/net/ip6_tables_names").read()
+ except:
+ ip_tables_names = "nat\nmangle\nfilter\n"
+ for table in ip_tables_names.splitlines():
+ self.collect_ip6table(table)
self.collect_nftables()