2008-08-04 23:36:33 +00:00
|
|
|
--[[
|
|
|
|
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$
|
|
|
|
]]--
|
2008-08-14 14:51:06 +00:00
|
|
|
require("luci.tools.webadmin")
|
2008-08-04 23:36:33 +00:00
|
|
|
m = Map("firewall", translate("fw_fw"), translate("fw_fw1"))
|
|
|
|
|
|
|
|
s = m:section(TypedSection, "defaults")
|
|
|
|
s.anonymous = true
|
|
|
|
|
|
|
|
s:option(Flag, "syn_flood")
|
|
|
|
|
|
|
|
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
|
2008-09-24 16:03:23 +00:00
|
|
|
v:value("REJECT", translate("fw_reject"))
|
2008-08-04 23:36:33 +00:00
|
|
|
v:value("DROP", translate("fw_drop"))
|
|
|
|
v:value("ACCEPT", translate("fw_accept"))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
s = m:section(TypedSection, "zone", translate("fw_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
|
2008-09-24 16:03:23 +00:00
|
|
|
v:value("REJECT", translate("fw_reject"))
|
2008-08-04 23:36:33 +00:00
|
|
|
v:value("DROP", translate("fw_drop"))
|
|
|
|
v:value("ACCEPT", translate("fw_accept"))
|
|
|
|
end
|
|
|
|
|
|
|
|
s:option(Flag, "masq")
|
|
|
|
|
|
|
|
net = s:option(MultiValue, "network")
|
|
|
|
net.widget = "select"
|
|
|
|
net.rmempty = true
|
2008-08-14 14:51:06 +00:00
|
|
|
luci.tools.webadmin.cbi_add_networks(net)
|
2008-08-04 23:36:33 +00:00
|
|
|
|
|
|
|
function net.cfgvalue(self, section)
|
|
|
|
local value = MultiValue.cfgvalue(self, section)
|
|
|
|
return value or name:cfgvalue(section)
|
|
|
|
end
|
|
|
|
|
2008-09-24 16:03:23 +00:00
|
|
|
return m
|