return (self.map:get(sid, "target") ~= "SNAT")
end
-
-ft.opt_name(s, DummyValue, translate("Name"))
+function s.sectiontitle(self, sid)
+ return (self.map:get(sid, "name") or translate("Unnamed forward"))
+end
local function forward_proto_txt(self, s)
match = s:option(DummyValue, "match", translate("Match"))
match.rawhtml = true
-match.width = "50%"
function match.cfgvalue(self, s)
return "<small>%s<br />%s<br />%s</small>" % {
forward_proto_txt(self, s),
dest = s:option(DummyValue, "dest", translate("Forward to"))
dest.rawhtml = true
-dest.width = "40%"
function dest.cfgvalue(self, s)
local z = ft.fmt_zone(self.map:get(s, "dest"), translate("any zone"))
local a = ft.fmt_ip(self.map:get(s, "dest_ip"), translate("any host"))
end
end
-ft.opt_enabled(s, Flag, translate("Enable")).width = "1%"
+ft.opt_enabled(s, Flag, translate("Enable"))
return m
end
- o = s:option(DynamicList, "icmp_type", translate("Match ICMP type"))
+ o = s:option(DropDown, "icmp_type", translate("Match ICMP type"))
+ o.multiple = true
+ o.display = 10
+ o.dropdown = 10
+ o.custom = true
+ o.cast = "table"
+
o:value("", "any")
o:value("echo-reply")
o:value("destination-unreachable")
o:value("address-mask-request")
o:value("address-mask-reply")
+ o:depends("proto", "icmp")
+
o = s:option(Value, "src", translate("Source zone"))
o.nocreate = true
o = s:option(Value, "src_ip", translate("Source address"))
- o.datatype = "neg(ipmask)"
+ o.datatype = "list(neg(ipmask))"
o.placeholder = translate("any")
luci.sys.net.ipv4_hints(function(ip, name)
o = s:option(Value, "dest_local", translate("Output zone"))
o.nocreate = true
o.allowany = true
- o.rmempty = false
o.template = "cbi/firewall_zonelist"
o.alias = "dest"
o:depends("src", "")
o = s:option(Value, "dest_ip", translate("Destination address"))
- o.datatype = "neg(ipmask)"
+ o.datatype = "list(neg(ipmask))"
o.placeholder = translate("any")
luci.sys.net.ipv4_hints(function(ip, name)
end
end
-ft.opt_name(s, DummyValue, translate("Name"))
+function s.sectiontitle(self, sid)
+ return (self.map:get(sid, "name") or translate("Unnamed rule"))
+end
local function rule_proto_txt(self, s)
local f = self.map:get(s, "family")
match = s:option(DummyValue, "match", translate("Match"))
match.rawhtml = true
-match.width = "70%"
function match.cfgvalue(self, s)
return "<small>%s<br />%s<br />%s</small>" % {
rule_proto_txt(self, s),
target = s:option(DummyValue, "target", translate("Action"))
target.rawhtml = true
-target.width = "20%"
function target.cfgvalue(self, s)
local t = ft.fmt_target(self.map:get(s, "target"), self.map:get(s, "src"), self.map:get(s, "dest"))
local l = ft.fmt_limit(self.map:get(s, "limit"),
end
end
-ft.opt_enabled(s, Flag, translate("Enable")).width = "1%"
+ft.opt_enabled(s, Flag, translate("Enable"))
--
return (self.map:get(sid, "target") == "SNAT")
end
-ft.opt_name(s, DummyValue, translate("Name"))
+function s.sectiontitle(self, sid)
+ return (self.map:get(sid, "name") or translate("Unnamed SNAT"))
+end
match = s:option(DummyValue, "match", translate("Match"))
match.rawhtml = true
-match.width = "70%"
function match.cfgvalue(self, s)
return "<small>%s<br />%s<br />%s</small>" % {
rule_proto_txt(self, s),
snat = s:option(DummyValue, "via", translate("Action"))
snat.rawhtml = true
-snat.width = "20%"
function snat.cfgvalue(self, s)
local a = ft.fmt_ip(self.map:get(s, "src_dip"))
local p = ft.fmt_port(self.map:get(s, "src_dport"))
end
end
-ft.opt_enabled(s, Flag, translate("Enable")).width = "1%"
+ft.opt_enabled(s, Flag, translate("Enable"))
return m
s.addremove = true
s.extedit = ds.build_url("admin", "network", "firewall", "zones", "%s")
+function s.sectiontitle(self, sid)
+ local z = fw:get_zone(sid)
+ return z:name()
+end
+
function s.create(self)
local z = fw:new_zone()
if z then