summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-10-03 16:04:09 +0000
committerSteven Barth <steven@midlink.org>2008-10-03 16:04:09 +0000
commit1e10c4ae4a6a43ca0a2ea07c2b4cf95fce66cc7d (patch)
treeb62814b4527adc5912e72403215f56085b07fad6 /applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua
parentc2a2fccca3ad2cd805ff366a99d9f656918484d7 (diff)
Redesigned firewall configuration
Diffstat (limited to 'applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua')
-rw-r--r--applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua66
1 files changed, 66 insertions, 0 deletions
diff --git a/applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua b/applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua
new file mode 100644
index 000000000..795867616
--- /dev/null
+++ b/applications/luci-fw/luasrc/model/cbi/luci_fw/rrule.lua
@@ -0,0 +1,66 @@
+--[[
+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$
+]]--
+require("luci.sys")
+arg[1] = arg[1] or ""
+
+m = Map("firewall", translate("fw_redirect"), translate("fw_redirect_desc"))
+
+
+s = m:section(NamedSection, arg[1], "redirect", "")
+s.anonymous = true
+
+name = s:option(Value, "_name", translate("name"))
+name.rmempty = true
+name.size = 10
+
+iface = s:option(ListValue, "src", translate("fw_zone"))
+iface.default = "wan"
+luci.model.uci.cursor():foreach("firewall", "zone",
+ function (section)
+ iface:value(section.name)
+ end)
+
+s:option(Value, "src_ip", translate("firewall_redirect_srcip")).optional = true
+s:option(Value, "src_mac", translate("firewall_redirect_srcmac")).optional = true
+
+sport = s:option(Value, "src_port", translate("firewall_redirect_srcport"))
+sport.optional = true
+sport:depends("proto", "tcp")
+sport:depends("proto", "udp")
+sport:depends("proto", "tcpudp")
+
+proto = s:option(ListValue, "proto", translate("protocol"))
+proto.optional = true
+proto:value("")
+proto:value("tcp", "TCP")
+proto:value("udp", "UDP")
+proto:value("tcpudp", "TCP+UDP")
+
+dport = s:option(Value, "src_dport", translate("firewall_redirect_srcdport"))
+dport.size = 5
+dport.optional = true
+dport:depends("proto", "tcp")
+dport:depends("proto", "udp")
+dport:depends("proto", "tcpudp")
+
+to = s:option(Value, "dest_ip", translate("firewall_redirect_destip"))
+for i, dataset in ipairs(luci.sys.net.arptable()) do
+ to:value(dataset["IP address"])
+end
+
+toport = s:option(Value, "dest_port", translate("firewall_redirect_destport"))
+toport.optional = true
+toport.size = 5
+
+return m