From 5e7dfe079749748e2b57ed7047fd059c07dc9dbb Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Tue, 5 Sep 2017 22:13:28 +0200 Subject: [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 --- sos/plugins/networking.py | 21 +++++++++++++++------ 1 file 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() -- cgit