38f95136d00f09d248336182f70c74f90ff8ad3f
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / general.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 require("luci.tools.webadmin")
15 m = Map("firewall", translate("fw_fw"), translate("fw_fw1"))
16
17 s = m:section(TypedSection, "defaults")
18 s.anonymous = true
19
20 s:option(Flag, "syn_flood")
21
22 p = {}
23 p[1] = s:option(ListValue, "input")
24 p[2] = s:option(ListValue, "output")
25 p[3] = s:option(ListValue, "forward")
26
27 for i, v in ipairs(p) do
28         v:value("REJECT", translate("fw_reject"))
29         v:value("DROP", translate("fw_drop"))
30         v:value("ACCEPT", translate("fw_accept"))
31 end
32
33
34 s = m:section(TypedSection, "zone", translate("fw_zones"))
35 s.template = "cbi/tblsection"
36 s.anonymous = true
37 s.addremove = true
38
39 name = s:option(Value, "name", translate("name"))
40 name.size = 8
41
42 p = {}
43 p[1] = s:option(ListValue, "input")
44 p[2] = s:option(ListValue, "output")
45 p[3] = s:option(ListValue, "forward")
46
47 for i, v in ipairs(p) do
48         v:value("REJECT", translate("fw_reject"))
49         v:value("DROP", translate("fw_drop"))
50         v:value("ACCEPT", translate("fw_accept"))
51 end
52
53 s:option(Flag, "masq")
54
55 net = s:option(MultiValue, "network")
56 net.widget = "select"
57 net.rmempty = true
58 luci.tools.webadmin.cbi_add_networks(net)
59         
60 function net.cfgvalue(self, section)
61         local value = MultiValue.cfgvalue(self, section)
62         return value or name:cfgvalue(section)
63 end
64
65 return m