<%# LuCI - Lua Configuration Interface Copyright 2008-2009 Steven Barth Copyright 2008-2009 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$ -%> <%- require "luci.sys.iptparser" require "luci.tools.webadmin" local ipt = luci.sys.iptparser.IptParser() local wba = luci.tools.webadmin local rowcnt = 1 function rowstyle() rowcnt = rowcnt + 1 return (rowcnt % 2) + 1 end function link_target(t,c) if ipt:is_custom_target(c) then return '%s' %{ t:lower(), c, c } end return c end function link_iface(i) local net = wba.iface_get_network(i) if net and i ~= "lo" then return '%s' %{ luci.dispatcher.build_url("admin", "network", "network", net), i } end return i end -%> <%+header%>

<%:a_s_ipt_status Firewall Status%>

<%:a_s_ipt_actions Actions%>



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

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

<% 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 %> <% end %> <% if rowcnt == 1 then %> <% end %> <% end %> <% if chaincnt == 0 then %> <% end %>

<%:a_s_ipt_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)-%> <%- else -%> <%:a_s_ipt_references 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.index%> <%=rule.packets%> <%=wba.byte_format(rule.bytes)%> <%=link_target(tbl, rule.target)%> <%=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 "-"%>
<%:a_s_ipt_norules No rules in this chain%>
<%:a_s_ipt_nochains No chains in this table%>


<% end %>
<%+footer%>