Changeset 6827
- Timestamp:
- 01/29/11 23:50:13 (2 years ago)
- Location:
- luci/trunk/modules/admin-full/luasrc
- Files:
-
- 2 modified
-
controller/admin/status.lua (modified) (3 diffs)
-
view/admin_status/iptables.htm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/modules/admin-full/luasrc/controller/admin/status.lua
r6583 r6827 3 3 4 4 Copyright 2008 Steven Barth <steven@midlink.org> 5 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org> 5 6 6 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 20 21 entry({"admin", "status"}, template("admin_status/index"), i18n("Status"), 20).index = true 21 22 entry({"admin", "status", "interfaces"}, template("admin_status/interfaces"), i18n("Interfaces"), 1) 22 entry({"admin", "status", "iptables"}, call("action_iptables"), i18n("Firewall"), 2) 23 entry({"admin", "status", "iptables"}, call("action_iptables"), i18n("Firewall"), 2).leaf = true 23 24 entry({"admin", "status", "conntrack"}, template("admin_status/conntrack"), i18n("Active Connections"), 3) 24 25 entry({"admin", "status", "routes"}, template("admin_status/routes"), i18n("Routes"), 4) … … 47 48 48 49 function action_iptables() 49 if luci.http.formvalue("zero") == "1" then 50 luci.util.exec("iptables -Z") 50 if luci.http.formvalue("zero") then 51 if luci.http.formvalue("zero") == "6" then 52 luci.util.exec("ip6tables -Z") 53 else 54 luci.util.exec("iptables -Z") 55 end 51 56 luci.http.redirect( 52 57 luci.dispatcher.build_url("admin", "status", "iptables") -
luci/trunk/modules/admin-full/luasrc/view/admin_status/iptables.htm
r5448 r6827 2 2 LuCI - Lua Configuration Interface 3 3 Copyright 2008-2009 Steven Barth <steven@midlink.org> 4 Copyright 2008-20 09 Jo-Philipp Wich <xm@leipzig.freifunk.net>4 Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org> 5 5 6 6 Licensed under the Apache License, Version 2.0 (the "License"); … … 18 18 require "luci.sys.iptparser" 19 19 require "luci.tools.webadmin" 20 require "luci.fs" 20 21 21 local ipt = luci.sys.iptparser.IptParser() 22 local has_ip6tables = luci.fs.access("/usr/sbin/ip6tables") 23 local mode = 4 24 25 if has_ip6tables then 26 mode = luci.dispatcher.context.requestpath 27 mode = tonumber(mode[#mode] ~= "iptables" and mode[#mode]) or 4 28 end 29 30 local ipt = luci.sys.iptparser.IptParser(mode) 22 31 local wba = luci.tools.webadmin 23 32 … … 46 55 end 47 56 57 local tables = { "Filter", "NAT", "Mangle", "Raw" } 58 if mode == 6 then 59 tables = { "Filter", "Mangle", "Raw" } 60 end 48 61 -%> 49 62 50 63 <%+header%> 51 64 65 <style type="text/css"> 66 span:target { 67 color: blue; 68 text-decoration: underline; 69 } 70 </style> 71 52 72 <h2><a id="content" name="content"><%:Firewall Status%></a></h2> 73 74 <% if has_ip6tables then %> 75 <ul class="cbi-tabmenu"> 76 <li class="cbi-tab<%= mode ~= 4 and "-disabled" %>"><a href="<%=luci.dispatcher.build_url("admin/status/iptables/4")%>"><%:IPv4 Firewall%></a></li> 77 <li class="cbi-tab<%= mode ~= 6 and "-disabled" %>"><a href="<%=luci.dispatcher.build_url("admin/status/iptables/6")%>"><%:IPv6 Firewall%></a></li> 78 </ul> 79 <% end %> 53 80 54 81 <form method="post" action="<%=REQUEST_URI%>"> … … 57 84 <h3><%:Actions%></h3> 58 85 <ul> 59 <li><a href="<%=REQUEST_URI%>?zero= 1"><%:Reset Counters%></a></li>86 <li><a href="<%=REQUEST_URI%>?zero=<%=mode%>"><%:Reset Counters%></a></li> 60 87 <li><a href="<%=REQUEST_URI%>?restart=1"><%:Restart Firewall%></a></li> 61 88 </ul> 62 89 <br /><br /> 63 90 64 <% for _, tbl in ipairs( {"Filter", "NAT", "Mangle"}) do chaincnt = 0 %>91 <% for _, tbl in ipairs(tables) do chaincnt = 0 %> 65 92 <h3><%:Table%>: <%=tbl%></h3> 66 93 <table class="cbi-section-table" style="font-size:90%"> … … 72 99 <tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>"> 73 100 <th class="cbi-section-table-cell" style="text-align:left" colspan="11"> 74 <br />< a name="rule_<%=tbl:lower()%>_<%=chain%>"></a>101 <br /><span id="rule_<%=tbl:lower()%>_<%=chain%>"> 75 102 <%:Chain%> <em><%=chain%></em> 76 103 (<%- if chaininfo.policy then -%> … … 78 105 <%- else -%> 79 106 <%:References%>: <%=chaininfo.references-%> 80 <%- end -%>) 107 <%- end -%>)</span> 81 108 </th> 82 109 </tr>
