From: Michael Tremer Date: Sat, 29 Sep 2012 12:40:11 +0000 (+0000) Subject: iptables: Don't rely on /proc/net/ip(6)_tables_names. X-Git-Tag: 005~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab2eb246380cef57dcf07c40febdc4becea5fba4;p=network.git iptables: Don't rely on /proc/net/ip(6)_tables_names. Those files only return which tables have been loaded into the kernel. So when compiled as modules, nothing will show up. --- diff --git a/functions.iptables b/functions.iptables index 10514051..b8db7cba 100644 --- a/functions.iptables +++ b/functions.iptables @@ -123,23 +123,20 @@ function iptables_status() { # Returns which tables exist for the given protocol. function iptables_tables() { local proto=${1} - local file + assert isset proto case "${proto}" in ipv6) - file="/proc/net/ip6_tables_names" + print "filter mangle" ;; ipv4) - file="/proc/net/ip_tables_names" + print "filter mangle nat" ;; *) return ${EXIT_ERROR} ;; esac - assert [ -r "${file}" ] - - print "$(<${file})" return ${EXIT_OK} }