X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Fsys%2Fiptparser.lua;fp=modules%2Fluci-base%2Fluasrc%2Fsys%2Fiptparser.lua;h=64353956b0d6e112b4e24fb843ae9ef9a681b15c;hp=2b81e0ee3893e7eca71022c9bc7792caecd32ffe;hb=a77ff30057c691009dac646adbac28d6230814b6;hpb=b77602f2e7ab72e7a20917b7c4ca1c2c01554aeb diff --git a/modules/luci-base/luasrc/sys/iptparser.lua b/modules/luci-base/luasrc/sys/iptparser.lua index 2b81e0ee3..64353956b 100644 --- a/modules/luci-base/luasrc/sys/iptparser.lua +++ b/modules/luci-base/luasrc/sys/iptparser.lua @@ -19,6 +19,8 @@ luci.util = require "luci.util" luci.sys = require "luci.sys" luci.ip = require "luci.ip" +local pcall = pcall +local io = require "io" local tonumber, ipairs, table = tonumber, ipairs, table module("luci.sys.iptparser") @@ -37,6 +39,15 @@ function IptParser.__init__( self, family ) else self._nulladdr = "::/0" self._tables = { "filter", "mangle", "raw" } + local ok, lines = pcall(io.lines, "/proc/net/ip6_tables_names") + if ok and lines then + local line + for line in lines do + if line == "nat" then + self._tables = { "filter", "nat", "mangle", "raw" } + end + end + end self._command = "ip6tables -t %s --line-numbers -nxvL" end