X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Fluci-mod-admin-full%2Fluasrc%2Fview%2Fadmin_status%2Fiptables.htm;h=3f4b83b80b8f4c717d2752fee9060d41cedd8d7f;hb=de4c4b806336f085d19b1b427dc82c65355ed345;hp=d6997f8378d7d3664466f52023ad0f44390d5e3e;hpb=b7f80a98d8b78e259648d820912b7c2338529e0a;p=project%2Fluci.git diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm index d6997f837..3f4b83b80 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm @@ -1,16 +1,7 @@ <%# -LuCI - Lua Configuration Interface -Copyright 2008-2009 Steven Barth -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. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - + Copyright 2008-2009 Steven Barth + Copyright 2008-2015 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. -%> <%- @@ -18,6 +9,7 @@ $Id$ require "luci.sys.iptparser" local wba = require "luci.tools.webadmin" local fs = require "nixio.fs" + local io = require "io" local has_ip6tables = fs.access("/usr/sbin/ip6tables") local mode = 4 @@ -46,7 +38,7 @@ $Id$ local net = wba.iface_get_network(i) if net and i ~= "lo" then return '%s' %{ - luci.dispatcher.build_url("admin", "network", "network", net), i + url("admin/network/network", net), i } end @@ -56,6 +48,15 @@ $Id$ local tables = { "Filter", "NAT", "Mangle", "Raw" } if mode == 6 then 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 + tables = { "Filter", "NAT", "Mangle", "Raw" } + end + end + end end -%> @@ -68,91 +69,88 @@ $Id$ } -

<%:Firewall Status%>

+

<%:Firewall Status%>

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

<%:Actions%>

- -

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

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

- - <% for _, chain in ipairs(ipt:chains(tbl)) do - rowcnt = 0 - chaincnt = chaincnt + 1 - chaininfo = ipt:chain(tbl, chain) - %> - - - - - - - - - - - - - - - +
+ + " style="position: absolute; right: 0"> + + + + + + +
+ + <% for _, tbl in ipairs(tables) do chaincnt = 0 %> +

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

+
-
- <%:Chain%> <%=chain%> - (<%- if chaininfo.policy then -%> - <%:Policy%>: <%=chaininfo.policy%>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%> - <%- else -%> - <%:References%>: <%=chaininfo.references-%> - <%- end -%>) -
<%:Rule #%><%:Pkts.%><%:Traffic%><%:Target%><%:Prot.%><%:Flags%><%:In%><%:Out%><%:Source%><%:Destination%><%:Options%>
+ <% for _, chain in ipairs(ipt:chains(tbl)) do + rowcnt = 0 + chaincnt = chaincnt + 1 + chaininfo = ipt:chain(tbl, chain) + %> + + + + + + + + + + + + + + + + <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %> + + + + + + + + + + - - <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %> - - - - - - - - - - - - - - <% end %> - - <% if rowcnt == 1 then %> - - - - <% end %> <% end %> - <% if chaincnt == 0 then %> + <% if rowcnt == 1 then %> - + <% end %> -
+
+ <%:Chain%> <%=chain%> + (<%- if chaininfo.policy then -%> + <%:Policy%>: <%=chaininfo.policy%>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%> + <%- else -%> + <%:References%>: <%=chaininfo.references-%> + <%- end -%>) +
<%:Pkts.%><%:Traffic%><%:Target%><%:Prot.%><%:In%><%:Out%><%:Source%><%:Destination%><%:Options%>
<%=rule.packets%><%=wba.byte_format(rule.bytes)%><%=rule.target and link_target(tbl, rule.target) or "-"%><%=rule.protocol%><%=link_iface(rule.inputif)%><%=link_iface(rule.outputif)%><%=rule.source%><%=rule.destination%><%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%>
<%=rule.index%><%=rule.packets%><%=wba.byte_format(rule.bytes)%><%=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 luci.util.pcdata(table.concat(rule.options, " ")) or "-"%>
<%:No rules in this chain%>
<%:No chains in this table%><%:No rules in this chain%>
-

- <% end %> -
-
- + <% end %> + + <% if chaincnt == 0 then %> + + <%:No chains in this table%> + + <% end %> + +

+ <% end %> + + <%+footer%>