X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fview%2Fadmin_status%2Fiptables.htm;h=957604e8af8bef10d2203eecf7dff10b1be3fb33;hb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;hp=b0153b7aaaddc5b735d55d1e486a2663e671704c;hpb=2e913fd28fd85daebd37347fd5677211a7cb0ea6;p=project%2Fluci.git diff --git a/modules/admin-full/luasrc/view/admin_status/iptables.htm b/modules/admin-full/luasrc/view/admin_status/iptables.htm index b0153b7aa..957604e8a 100644 --- a/modules/admin-full/luasrc/view/admin_status/iptables.htm +++ b/modules/admin-full/luasrc/view/admin_status/iptables.htm @@ -1,7 +1,7 @@ <%# LuCI - Lua Configuration Interface Copyright 2008-2009 Steven Barth -Copyright 2008-2009 Jo-Philipp Wich +Copyright 2008-2011 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,8 +17,17 @@ $Id$ require "luci.sys.iptparser" require "luci.tools.webadmin" + require "luci.fs" - local ipt = luci.sys.iptparser.IptParser() + local has_ip6tables = luci.fs.access("/usr/sbin/ip6tables") + local mode = 4 + + if has_ip6tables then + mode = luci.dispatcher.context.requestpath + mode = tonumber(mode[#mode] ~= "iptables" and mode[#mode]) or 4 + end + + local ipt = luci.sys.iptparser.IptParser(mode) local wba = luci.tools.webadmin local rowcnt = 1 @@ -45,24 +54,42 @@ $Id$ return i end + local tables = { "Filter", "NAT", "Mangle", "Raw" } + if mode == 6 then + tables = { "Filter", "Mangle", "Raw" } + end -%> <%+header%> -

<%:a_s_ipt_status Firewall Status%>

+ + +

<%:Firewall Status%>

+ +<% if has_ip6tables then %> + +<% end %>
-

<%:a_s_ipt_actions Actions%>

+

<%:Actions%>



- <% for _, tbl in ipairs({"Filter", "NAT", "Mangle"}) do chaincnt = 0 %> -

<%:a_s_ipt_table Table%>: <%=tbl%>

+ <% for _, tbl in ipairs(tables) do chaincnt = 0 %> +

<%:Table%>: <%=tbl%>

<% for _, chain in ipairs(ipt:chains(tbl)) do rowcnt = 0 @@ -71,27 +98,27 @@ $Id$ %> - - - - - - - - - - - + + + + + + + + + + + <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %> @@ -99,27 +126,27 @@ $Id$ - + - + <% end %> <% if rowcnt == 1 then %> - + <% end %> <% end %> <% if chaincnt == 0 then %> - + <% end %>
-
- <%:a_s_ipt_chain Chain%> <%=chain%> +
+ <%:Chain%> <%=chain%> (<%- if chaininfo.policy then -%> - <%:a_s_ipt_policy Policy%>: <%=chaininfo.policy%>, <%:a_s_ipt_packets Packets%>: <%=chaininfo.packets%>, <%:a_s_ipt_bytes Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%> + <%:Policy%>: <%=chaininfo.policy%>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%> <%- else -%> - <%:a_s_ipt_references References%>: <%=chaininfo.references-%> - <%- end -%>) + <%:References%>: <%=chaininfo.references-%> + <%- end -%>)
<%:a_s_ipt_rulenum Rule #%><%:a_s_ipt_packets Pkts.%><%:a_s_ipt_bytes Traffic%><%:a_s_ipt_target Target%><%:a_s_ipt_proto Prot.%><%:a_s_ipt_flags Flags%><%:a_s_ipt_inputif In%><%:a_s_ipt_outputif Out%><%:a_s_ipt_source Source%><%:a_s_ipt_destination Destination%><%:a_s_ipt_options Options%><%:Rule #%><%:Pkts.%><%:Traffic%><%:Target%><%:Prot.%><%:Flags%><%:In%><%:Out%><%:Source%><%:Destination%><%:Options%>
<%=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)%> <%=link_iface(rule.outputif)%> <%=rule.source%> <%=rule.destination%><%=#rule.options > 0 and table.concat(rule.options, " ") or "-"%><%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%>
<%:a_s_ipt_norules No rules in this chain%><%:No rules in this chain%>
<%:a_s_ipt_nochains No chains in this table%><%:No chains in this table%>