luci-0.8: merge r4776-r4777
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 7 Jun 2009 13:06:54 +0000 (13:06 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 7 Jun 2009 13:06:54 +0000 (13:06 +0000)
libs/sys/luasrc/sys/iptparser.lua
modules/admin-full/luasrc/view/admin_status/iptables.htm

index 338fb7dad8aea81b081512f8f013cf56f5b9d1e0..6e9eff2034634a91d77f00b4d29025bb99ecda7a 100644 (file)
@@ -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])
index b0153b7aaaddc5b735d55d1e486a2663e671704c..2b8f12ccc2c0f2ad3fc5e554ef81056ca4a5585a 100644 (file)
@@ -99,7 +99,7 @@ $Id$
                                                                <td><%=rule.index%></td>
                                                                <td><%=rule.packets%></td>
                                                                <td><%=wba.byte_format(rule.bytes)%></td>
-                                                               <td><%=link_target(tbl, rule.target)%></td>
+                                                               <td><%=rule.target and link_target(tbl, rule.target) or "-"%></td>
                                                                <td><%=rule.protocol%></td>
                                                                <td><%=rule.flags%></td>
                                                                <td><%=link_iface(rule.inputif)%></td>