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 require("luci.tools.webadmin")
15 m = Map("firewall", translate("fw_fw"), translate("fw_fw1"))
17 s = m:section(TypedSection, "defaults")
20 s:option(Flag, "syn_flood")
22 local di = s:option(Flag, "drop_invalid", translate("fw_dropinvalid"))
24 function di.cfgvalue(...)
25 return AbstractValue.cfgvalue(...) or "1"
29 p[1] = s:option(ListValue, "input")
30 p[2] = s:option(ListValue, "output")
31 p[3] = s:option(ListValue, "forward")
33 for i, v in ipairs(p) do
34 v:value("REJECT", translate("fw_reject"))
35 v:value("DROP", translate("fw_drop"))
36 v:value("ACCEPT", translate("fw_accept"))
40 s = m:section(TypedSection, "zone", translate("fw_zones"))
41 s.template = "cbi/tblsection"
45 name = s:option(Value, "name", translate("name"))
49 p[1] = s:option(ListValue, "input")
50 p[2] = s:option(ListValue, "output")
51 p[3] = s:option(ListValue, "forward")
53 for i, v in ipairs(p) do
54 v:value("REJECT", translate("fw_reject"))
55 v:value("DROP", translate("fw_drop"))
56 v:value("ACCEPT", translate("fw_accept"))
59 s:option(Flag, "masq")
61 net = s:option(MultiValue, "network")
64 luci.tools.webadmin.cbi_add_networks(net)
66 function net.cfgvalue(self, section)
67 local value = MultiValue.cfgvalue(self, section)
68 return value or name:cfgvalue(section)