summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-16 15:24:07 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-16 15:24:07 +0000
commit4ad99af940a90592b51729aa44a155f8053fd85b (patch)
treea7831d514ce075b023b454ffc89f8dd2b2f293dc /applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
parentdd2abf2ea44b02bff72812de593a9e3976fe7f15 (diff)
applications: rename luci-fw to luci-firewall
Diffstat (limited to 'applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua')
-rw-r--r--applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua77
1 files changed, 77 insertions, 0 deletions
diff --git a/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua b/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
new file mode 100644
index 0000000000..0ce41e38c7
--- /dev/null
+++ b/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
@@ -0,0 +1,77 @@
+--[[
+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$
+]]--
+arg[1] = arg[1] or ""
+m = Map("firewall", translate("Advanced Rules"),
+ translate("Advanced rules let you customize the firewall to your " ..
+ "needs. Only new connections will be matched. Packets " ..
+ "belonging to already open connections are automatically " ..
+ "allowed to pass the firewall."))
+
+s = m:section(NamedSection, arg[1], "rule", "")
+s.anonymous = true
+s.addremove = false
+
+back = s:option(DummyValue, "_overview", translate("Overview"))
+back.value = ""
+back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "rule")
+
+
+name = s:option(Value, "_name", translate("Name").." "..translate("(optional)"))
+name.rmempty = true
+
+iface = s:option(ListValue, "src", translate("Source zone"))
+iface.rmempty = true
+
+oface = s:option(ListValue, "dest", translate("Destination zone"))
+oface:value("", translate("any"))
+oface.rmempty = true
+
+luci.model.uci.cursor():foreach("firewall", "zone",
+ function (section)
+ iface:value(section.name)
+ oface:value(section.name)
+ end)
+
+proto = s:option(Value, "proto", translate("Protocol"))
+proto.optional = true
+proto:value("")
+proto:value("all", translate("Any"))
+proto:value("tcpudp", "TCP+UDP")
+proto:value("tcp", "TCP")
+proto:value("udp", "UDP")
+proto:value("icmp", "ICMP")
+
+s:option(Value, "src_ip", translate("Source address")).optional = true
+s:option(Value, "dest_ip", translate("Destination address")).optional = true
+s:option(Value, "src_mac", translate("Source MAC-address")).optional = true
+
+sport = s:option(Value, "src_port", translate("Source port"))
+sport:depends("proto", "tcp")
+sport:depends("proto", "udp")
+sport:depends("proto", "tcpudp")
+
+dport = s:option(Value, "dest_port", translate("Destination port"))
+dport:depends("proto", "tcp")
+dport:depends("proto", "udp")
+dport:depends("proto", "tcpudp")
+
+jump = s:option(ListValue, "target", translate("Action"))
+jump.rmempty = true
+jump.default = "ACCEPT"
+jump:value("DROP", translate("drop"))
+jump:value("ACCEPT", translate("accept"))
+jump:value("REJECT", translate("reject"))
+
+
+return m