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
15 local nw = require "luci.model.network"
16 local fw = require "luci.model.firewall"
18 require("luci.tools.webadmin")
19 m = Map("firewall", translate("Firewall"), translate("The firewall creates zones over your network interfaces to control network traffic flow."))
24 s = m:section(TypedSection, "defaults")
28 s:option(Flag, "syn_flood")
30 local di = s:option(Flag, "drop_invalid", translate("Drop invalid packets"))
32 function di.cfgvalue(...)
33 return AbstractValue.cfgvalue(...) or "1"
37 p[1] = s:option(ListValue, "input")
38 p[2] = s:option(ListValue, "output")
39 p[3] = s:option(ListValue, "forward")
41 for i, v in ipairs(p) do
42 v:value("REJECT", translate("reject"))
43 v:value("DROP", translate("drop"))
44 v:value("ACCEPT", translate("accept"))
48 s = m:section(TypedSection, "zone", translate("Zones"))
49 s.template = "cbi/tblsection"
53 name = s:option(Value, "name", translate("Name"))
57 p[1] = s:option(ListValue, "input")
58 p[2] = s:option(ListValue, "output")
59 p[3] = s:option(ListValue, "forward")
61 for i, v in ipairs(p) do
62 v:value("REJECT", translate("reject"))
63 v:value("DROP", translate("drop"))
64 v:value("ACCEPT", translate("accept"))
67 s:option(Flag, "masq")
69 net = s:option(MultiValue, "network")
70 net.template = "cbi/network_netlist"
71 net.widget = "checkbox"
73 luci.tools.webadmin.cbi_add_networks(net)
75 function net.cfgvalue(self, section)
76 local value = MultiValue.cfgvalue(self, section)
77 return value or name:cfgvalue(section)