2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
15 m = Map("firewall", translate("firewall_rule"), translate("firewall_rule_desc"))
17 s = m:section(NamedSection, arg[1], "rule", "")
21 back = s:option(DummyValue, "_overview", translate("overview"))
23 back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "rule")
26 name = s:option(Value, "_name", translate("name")..translate("cbi_optional"))
29 iface = s:option(ListValue, "src", translate("fw_src"))
32 oface = s:option(ListValue, "dest", translate("fw_dest"))
33 oface:value("", translate("device", "device"))
36 luci.model.uci.cursor():foreach("firewall", "zone",
38 iface:value(section.name)
39 oface:value(section.name)
42 proto = s:option(Value, "proto", translate("protocol"))
44 proto:value("all", translate("firewall_rule_proto_all", "Any"))
45 proto:value("tcpudp", "TCP+UDP")
46 proto:value("tcp", "TCP")
47 proto:value("udp", "UDP")
48 proto:value("icmp", "ICMP")
50 s:option(Value, "src_ip", translate("firewall_rule_srcip")).optional = true
51 s:option(Value, "dest_ip", translate("firewall_rule_destip")).optional = true
52 s:option(Value, "src_mac", translate("firewall_rule_srcmac")).optional = true
54 sport = s:option(Value, "src_port", translate("firewall_rule_srcport"))
55 sport:depends("proto", "tcp")
56 sport:depends("proto", "udp")
57 sport:depends("proto", "tcpudp")
59 dport = s:option(Value, "dest_port", translate("firewall_rule_destport"))
60 dport:depends("proto", "tcp")
61 dport:depends("proto", "udp")
62 dport:depends("proto", "tcpudp")
64 jump = s:option(ListValue, "target", translate("firewall_rule_target"))
66 jump.default = "ACCEPT"
67 jump:value("DROP", translate("fw_drop"))
68 jump:value("ACCEPT", translate("fw_accept"))
69 jump:value("REJECT", translate("fw_reject"))