diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-06-07 12:48:28 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-06-07 12:48:28 +0000 |
commit | 99c213eff8a779463e3dbf695c9b4616a7beca42 (patch) | |
tree | efb93341296caf008648ca2539edb02b3106cf3b /libs/sys | |
parent | f4c6554f4c9cd4998d12a8891c0a43af747993e2 (diff) |
libs/sys: properly parse iptables rules with not target set
Diffstat (limited to 'libs/sys')
-rw-r--r-- | libs/sys/luasrc/sys/iptparser.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/sys/luasrc/sys/iptparser.lua b/libs/sys/luasrc/sys/iptparser.lua index 338fb7dad..6e9eff203 100644 --- a/libs/sys/luasrc/sys/iptparser.lua +++ b/libs/sys/luasrc/sys/iptparser.lua @@ -19,7 +19,7 @@ luci.util = require "luci.util" luci.sys = require "luci.sys" luci.ip = require "luci.ip" -local tonumber, ipairs = tonumber, ipairs +local tonumber, ipairs, table = tonumber, ipairs, table --- LuCI iptables parser and query library -- @cstyle instance @@ -279,6 +279,11 @@ function IptParser._parse_rules( self ) local rule_parts = luci.util.split( rule, "%s+", nil, true ) local rule_details = { } + -- cope with rules that have no target assigned + if rule:match("^%d+%s+%d+%s+%d+%s%s") then + table.insert(rule_parts, 4, nil) + end + rule_details["table"] = tbl rule_details["chain"] = self._chain rule_details["index"] = tonumber(rule_parts[1]) |