* luci/app/hd_idle: small i18n fix
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / firewall.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
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
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 m = Map("firewall", translate("fw_rules"), translate("fw_rules1"))
15
16 s = m:section(TypedSection, "rule", "")
17 s.addremove = true
18 s.anonymous = true
19
20 iface = s:option(ListValue, "src")
21 iface.rmempty = true
22
23 oface = s:option(ListValue, "dest")
24 oface:value("")
25 oface.optional = true
26
27 luci.model.uci.cursor():foreach("firewall", "zone",
28 function (section)
29 iface:value(section.name)
30 oface:value(section.name)
31 end)
32
33 proto = s:option(ListValue, "proto", translate("protocol"))
34 proto.optional = true
35 proto:value("")
36 proto:value("tcpudp", "TCP+UDP")
37 proto:value("tcp", "TCP")
38 proto:value("udp", "UDP")
39 proto:value("icmp", "ICMP")
40
41 s:option(Value, "src_ip").optional = true
42 s:option(Value, "dest_ip").optional = true
43 s:option(Value, "src_mac").optional = true
44
45 sport = s:option(Value, "src_port")
46 sport.optional = true
47 sport:depends("proto", "tcp")
48 sport:depends("proto", "udp")
49 sport:depends("proto", "tcpudp")
50
51 dport = s:option(Value, "dest_port")
52 dport.optional = true
53 dport:depends("proto", "tcp")
54 dport:depends("proto", "udp")
55 dport:depends("proto", "tcpudp")
56
57 jump = s:option(ListValue, "target")
58 jump.rmempty = true
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"))
63
64
65 return m