* More Translation
[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("luci_fw", translate("fw_fw", "Firewall"), translate("fw_fw1"))
15
16 s = m:section(TypedSection, "rule", "")
17 s.addremove = true
18 s.anonymous = true
19
20 chain = s:option(ListValue, "chain")
21 chain:value("forward", "Forward")
22 chain:value("input", "Input")
23 chain:value("output", "Output")
24 chain:value("prerouting", "Prerouting")
25 chain:value("postrouting", "Postrouting")
26
27 iface = s:option(ListValue, "iface")
28 iface.optional = true
29
30 oface = s:option(ListValue, "oface")
31 oface.optional = true
32
33 luci.model.uci.foreach("network", "interface",
34         function (section)
35                 if section[".name"] ~= "loopback" then
36                         iface:value(section[".name"])
37                         oface:value(section[".name"])
38                 end
39         end)
40
41 proto = s:option(ListValue, "proto", translate("protocol", "Protokoll"))
42 proto.optional = true
43 proto:value("")
44 proto:value("tcp", "TCP")
45 proto:value("udp", "UDP")
46
47 s:option(Value, "source").optional = true
48 s:option(Value, "destination").optional = true
49 s:option(Value, "mac").optional = true
50
51 sport = s:option(Value, "sport")
52 sport.optional = true
53 sport:depends("proto", "tcp")
54 sport:depends("proto", "udp")
55
56 dport = s:option(Value, "dport")
57 dport.optional = true
58 dport:depends("proto", "tcp")
59 dport:depends("proto", "udp")
60
61 tosrc = s:option(Value, "tosrc")
62 tosrc.optional = true
63 tosrc:depends("jump", "SNAT")
64
65 tosrc = s:option(Value, "todest")
66 tosrc.optional = true
67 tosrc:depends("jump", "DNAT")
68
69 jump = s:option(ListValue, "jump")
70 jump.rmempty = true
71 jump:value("", "")
72 jump:value("ACCEPT", translate("fw_accept"))
73 jump:value("REJECT", translate("fw_reject"))
74 jump:value("DROP", translate("fw_drop"))
75 jump:value("LOG", translate("fw_log"))
76 jump:value("DNAT", translate("fw_dnat"))
77 jump:value("MASQUERADE", translate("fw_masq"))
78 jump:value("SNAT", translate("fw_snat"))
79
80
81 add = s:option(Value, "command")
82 add.size = 50
83 add.rmempty = true
84
85 return m