summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-12-19 21:16:31 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-12-19 21:16:31 +0000
commit033de64a0f66e727cb97c54403614917a49cc577 (patch)
tree1e1908490a79fe2aad2dc30a0f6d3ecc7f53b781 /applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua
parent24c4cce3ae278c0511a65aded38ef83b2e49d3d4 (diff)
applications/luci-firewall: complete rework firewall ui
- split zone setup, port forwards, traffic rules and firewall.user - add quickadd forms for various common rules like port forwards - add tool class for textual formatting and descriptions of rules - simplify controller, remove old mini admin remainders
Diffstat (limited to 'applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua')
-rw-r--r--applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua88
1 files changed, 88 insertions, 0 deletions
diff --git a/applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua b/applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua
new file mode 100644
index 0000000000..e6d8548bf4
--- /dev/null
+++ b/applications/luci-firewall/luasrc/model/cbi/firewall/zones.lua
@@ -0,0 +1,88 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+
+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$
+]]--
+
+local ds = require "luci.dispatcher"
+local fw = require "luci.model.firewall"
+
+local m, s, o, p, i, v
+
+m = Map("firewall",
+ translate("Firewall - Zone Settings"),
+ translate("The firewall creates zones over your network interfaces to control network traffic flow."))
+
+fw.init(m.uci)
+
+s = m:section(TypedSection, "defaults", translate("General Settings"))
+s.anonymous = true
+s.addremove = false
+
+s:option(Flag, "syn_flood", translate("Enable SYN-flood protection"))
+
+o = s:option(Flag, "drop_invalid", translate("Drop invalid packets"))
+o.default = o.disabled
+
+p = {
+ s:option(ListValue, "input", translate("Input")),
+ s:option(ListValue, "output", translate("Output")),
+ s:option(ListValue, "forward", translate("Forward"))
+}
+
+for i, v in ipairs(p) do
+ v:value("REJECT", translate("reject"))
+ v:value("DROP", translate("drop"))
+ v:value("ACCEPT", translate("accept"))
+end
+
+
+s = m:section(TypedSection, "zone", translate("Zones"))
+s.template = "cbi/tblsection"
+s.anonymous = true
+s.addremove = true
+s.extedit = ds.build_url("admin", "network", "firewall", "zones", "%s")
+
+function s.create(self)
+ local z = fw:new_zone()
+ if z then
+ luci.http.redirect(
+ ds.build_url("admin", "network", "firewall", "zones", z.sid)
+ )
+ end
+end
+
+function s.remove(self, section)
+ return fw:del_zone(section)
+end
+
+o = s:option(DummyValue, "_info", translate("Zone ⇒ Forwardings"))
+o.template = "cbi/firewall_zoneforwards"
+o.cfgvalue = function(self, section)
+ return self.map:get(section, "name")
+end
+
+p = {
+ s:option(ListValue, "input", translate("Input")),
+ s:option(ListValue, "output", translate("Output")),
+ s:option(ListValue, "forward", translate("Forward"))
+}
+
+for i, v in ipairs(p) do
+ v:value("REJECT", translate("reject"))
+ v:value("DROP", translate("drop"))
+ v:value("ACCEPT", translate("accept"))
+end
+
+s:option(Flag, "masq", translate("Masquerading"))
+s:option(Flag, "mtu_fix", translate("MSS clamping"))
+
+return m