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
14 m = Map("firewall", translate("fw_rules"), translate("fw_rules1"))
16 s = m:section(TypedSection, "rule", "")
20 iface = s:option(ListValue, "src")
23 oface = s:option(ListValue, "dest")
27 luci.model.uci.cursor():foreach("firewall", "zone",
29 iface:value(section.name)
30 oface:value(section.name)
33 proto = s:option(ListValue, "proto", translate("protocol"))
36 proto:value("tcpudp", "TCP+UDP")
37 proto:value("tcp", "TCP")
38 proto:value("udp", "UDP")
39 proto:value("icmp", "ICMP")
41 s:option(Value, "src_ip").optional = true
42 s:option(Value, "dest_ip").optional = true
43 s:option(Value, "src_mac").optional = true
45 sport = s:option(Value, "src_port")
47 sport:depends("proto", "tcp")
48 sport:depends("proto", "udp")
49 sport:depends("proto", "tcpudp")
51 dport = s:option(Value, "dest_port")
53 dport:depends("proto", "tcp")
54 dport:depends("proto", "udp")
55 dport:depends("proto", "tcpudp")
57 jump = s:option(ListValue, "target")
59 jump.default = "ACCEPT"
60 jump:value("DROP", translate("fw_drop"))
61 jump:value("ACCEPT", translate("fw_accept"))
62 jump:value("REJECT", translate("fw_reject"))