summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-01-29 22:50:13 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-01-29 22:50:13 +0000
commit80c2b4cf4602b04fe2e22d7fa3d36e426af13abc (patch)
tree100b9966df2670a2c07e9ca2cad1667621088b0f /modules/admin-full/luasrc/view
parentc3c22f792b4e2576713c9609f804c42975e09dbc (diff)
modules/admin-full: add ip6tables status output (#193)
Diffstat (limited to 'modules/admin-full/luasrc/view')
-rw-r--r--modules/admin-full/luasrc/view/admin_status/iptables.htm39
1 files changed, 33 insertions, 6 deletions
diff --git a/modules/admin-full/luasrc/view/admin_status/iptables.htm b/modules/admin-full/luasrc/view/admin_status/iptables.htm
index a81797dee8..957604e8af 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 <steven@midlink.org>
-Copyright 2008-2009 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
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,23 +54,41 @@ $Id$
return i
end
+ local tables = { "Filter", "NAT", "Mangle", "Raw" }
+ if mode == 6 then
+ tables = { "Filter", "Mangle", "Raw" }
+ end
-%>
<%+header%>
+<style type="text/css">
+ span:target {
+ color: blue;
+ text-decoration: underline;
+ }
+</style>
+
<h2><a id="content" name="content"><%:Firewall Status%></a></h2>
+<% if has_ip6tables then %>
+<ul class="cbi-tabmenu">
+ <li class="cbi-tab<%= mode ~= 4 and "-disabled" %>"><a href="<%=luci.dispatcher.build_url("admin/status/iptables/4")%>"><%:IPv4 Firewall%></a></li>
+ <li class="cbi-tab<%= mode ~= 6 and "-disabled" %>"><a href="<%=luci.dispatcher.build_url("admin/status/iptables/6")%>"><%:IPv6 Firewall%></a></li>
+</ul>
+<% end %>
+
<form method="post" action="<%=REQUEST_URI%>">
<div class="cbi-map">
<fieldset class="cbi-section">
<h3><%:Actions%></h3>
<ul>
- <li><a href="<%=REQUEST_URI%>?zero=1"><%:Reset Counters%></a></li>
+ <li><a href="<%=REQUEST_URI%>?zero=<%=mode%>"><%:Reset Counters%></a></li>
<li><a href="<%=REQUEST_URI%>?restart=1"><%:Restart Firewall%></a></li>
</ul>
<br /><br />
- <% for _, tbl in ipairs({"Filter", "NAT", "Mangle"}) do chaincnt = 0 %>
+ <% for _, tbl in ipairs(tables) do chaincnt = 0 %>
<h3><%:Table%>: <%=tbl%></h3>
<table class="cbi-section-table" style="font-size:90%">
<% for _, chain in ipairs(ipt:chains(tbl)) do
@@ -71,13 +98,13 @@ $Id$
%>
<tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>">
<th class="cbi-section-table-cell" style="text-align:left" colspan="11">
- <br /><a name="rule_<%=tbl:lower()%>_<%=chain%>"></a>
+ <br /><span id="rule_<%=tbl:lower()%>_<%=chain%>">
<%:Chain%> <em><%=chain%></em>
(<%- if chaininfo.policy then -%>
<%:Policy%>: <em><%=chaininfo.policy%></em>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%>
<%- else -%>
<%:References%>: <%=chaininfo.references-%>
- <%- end -%>)
+ <%- end -%>)</span>
</th>
</tr>
<tr class="cbi-section-table-descr">