1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local nw = require "luci.model.network"
local fw = require "luci.model.firewall"
require("luci.tools.webadmin")
m = Map("firewall", translate("Firewall"), translate("The firewall creates zones over your network interfaces to control network traffic flow."))
fw.init(m.uci)
nw.init(m.uci)
s = m:section(TypedSection, "defaults")
s.anonymous = true
s.addremove = false
s:option(Flag, "syn_flood")
local di = s:option(Flag, "drop_invalid", translate("Drop invalid packets"))
di.rmempty = false
function di.cfgvalue(...)
return AbstractValue.cfgvalue(...) or "1"
end
p = {}
p[1] = s:option(ListValue, "input")
p[2] = s:option(ListValue, "output")
p[3] = s:option(ListValue, "forward")
for i, v in ipairs(p) do
v:value("REJECT", translate("reject"))
v:value("DROP", translate("drop"))
v:value("ACCEPT", translate("accept"))
end
s = m:section(TypedSection, "zone", translate("Zones"))
s.template = "cbi/tblsection"
s.anonymous = true
s.addremove = true
name = s:option(Value, "name", translate("Name"))
name.size = 8
p = {}
p[1] = s:option(ListValue, "input")
p[2] = s:option(ListValue, "output")
p[3] = s:option(ListValue, "forward")
for i, v in ipairs(p) do
v:value("REJECT", translate("reject"))
v:value("DROP", translate("drop"))
v:value("ACCEPT", translate("accept"))
end
s:option(Flag, "masq")
s:option(Flag, "mtu_fix", translate("MSS Clamping"))
net = s:option(MultiValue, "network")
net.template = "cbi/network_netlist"
net.widget = "checkbox"
net.rmempty = true
luci.tools.webadmin.cbi_add_networks(net)
function net.cfgvalue(self, section)
local value = MultiValue.cfgvalue(self, section)
return value or name:cfgvalue(section)
end
return m
|