applications/luci-qos: list all L7 patterns in all subdirs (#187)

This commit is contained in:
Jo-Philipp Wich 2011-01-20 23:44:41 +00:00
parent 68c596d98e
commit fe1b37a230
2 changed files with 23 additions and 10 deletions

View file

@ -23,6 +23,7 @@ m = Map("qos", translate("Quality of Service"),
s = m:section(TypedSection, "interface", translate("Interfaces")) s = m:section(TypedSection, "interface", translate("Interfaces"))
s.addremove = true s.addremove = true
s.anonymous = false s.anonymous = false
s.template = "cbi/tblsection"
e = s:option(Flag, "enabled", translate("Enable")) e = s:option(Flag, "enabled", translate("Enable"))
e.rmempty = false e.rmempty = false
@ -64,14 +65,20 @@ wa.cbi_add_knownips(dsth)
l7 = s:option(ListValue, "layer7", translate("Service")) l7 = s:option(ListValue, "layer7", translate("Service"))
l7.rmempty = true l7.rmempty = true
l7:value("", translate("all")) l7:value("", translate("all"))
local pats = fs.glob("/etc/l7-protocols/*/*.pat")
local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
if pats then if pats then
for f in pats do local l
f = f:match("([^/]+)%.pat$") while true do
if f then l = pats:read("*l")
l7:value(f) if not l then break end
l = l:match("([^/]+)%.pat$")
if l then
l7:value(l)
end end
end end
pats:close()
end end
p = s:option(Value, "proto", translate("Protocol")) p = s:option(Value, "proto", translate("Protocol"))

View file

@ -50,14 +50,20 @@ wa.cbi_add_knownips(dsth)
l7 = s:option(ListValue, "layer7", translate("Service")) l7 = s:option(ListValue, "layer7", translate("Service"))
l7.rmempty = true l7.rmempty = true
l7:value("", translate("all")) l7:value("", translate("all"))
local pats = fs.glob("/etc/l7-protocols/*/*.pat")
local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
if pats then if pats then
for f in pats do local l
f = f:match("([^/]+)%.pat$") while true do
if f then l = pats:read("*l")
l7:value(f) if not l then break end
l = l:match("([^/]+)%.pat$")
if l then
l7:value(l)
end end
end end
pats:close()
end end
p = s:option(ListValue, "proto", translate("Protocol")) p = s:option(ListValue, "proto", translate("Protocol"))