From 0f60f1be220875106213029176e2e57eb5b71389 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 7 Jun 2009 13:06:54 +0000 Subject: [PATCH] luci-0.8: merge r4776-r4777 --- libs/sys/luasrc/sys/iptparser.lua | 7 ++++++- modules/admin-full/luasrc/view/admin_status/iptables.htm | 2 +- 2 files changed, 7 insertions(+), 2 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]) diff --git a/modules/admin-full/luasrc/view/admin_status/iptables.htm b/modules/admin-full/luasrc/view/admin_status/iptables.htm index b0153b7aa..2b8f12ccc 100644 --- a/modules/admin-full/luasrc/view/admin_status/iptables.htm +++ b/modules/admin-full/luasrc/view/admin_status/iptables.htm @@ -99,7 +99,7 @@ $Id$ <%=rule.index%> <%=rule.packets%> <%=wba.byte_format(rule.bytes)%> - <%=link_target(tbl, rule.target)%> + <%=rule.target and link_target(tbl, rule.target) or "-"%> <%=rule.protocol%> <%=rule.flags%> <%=link_iface(rule.inputif)%> -- 2.25.1