diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-20 23:44:41 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-20 23:44:41 +0000 |
commit | fe1b37a230b4be3aa286889c70371bd713b59ae8 (patch) | |
tree | 21251399570aaa31b4c12ae701352bcab598e759 /applications/luci-qos/luasrc | |
parent | 68c596d98e50121dc3c20a8280a399581055d11f (diff) |
applications/luci-qos: list all L7 patterns in all subdirs (#187)
Diffstat (limited to 'applications/luci-qos/luasrc')
-rw-r--r-- | applications/luci-qos/luasrc/model/cbi/qos/qos.lua | 17 | ||||
-rw-r--r-- | applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua | 16 |
2 files changed, 23 insertions, 10 deletions
diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua index dcce7f12c1..3e4b781738 100644 --- a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua +++ b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua @@ -23,6 +23,7 @@ m = Map("qos", translate("Quality of Service"), s = m:section(TypedSection, "interface", translate("Interfaces")) s.addremove = true s.anonymous = false +s.template = "cbi/tblsection" e = s:option(Flag, "enabled", translate("Enable")) e.rmempty = false @@ -64,14 +65,20 @@ wa.cbi_add_knownips(dsth) l7 = s:option(ListValue, "layer7", translate("Service")) l7.rmempty = true 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 - for f in pats do - f = f:match("([^/]+)%.pat$") - if f then - l7:value(f) + local l + while true do + l = pats:read("*l") + if not l then break end + + l = l:match("([^/]+)%.pat$") + if l then + l7:value(l) end end + pats:close() end p = s:option(Value, "proto", translate("Protocol")) diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua b/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua index b412089571..fb2298f8e7 100644 --- a/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua +++ b/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua @@ -50,14 +50,20 @@ wa.cbi_add_knownips(dsth) l7 = s:option(ListValue, "layer7", translate("Service")) l7.rmempty = true 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 - for f in pats do - f = f:match("([^/]+)%.pat$") - if f then - l7:value(f) + local l + while true do + l = pats:read("*l") + if not l then break end + + l = l:match("([^/]+)%.pat$") + if l then + l7:value(l) end end + pats:close() end p = s:option(ListValue, "proto", translate("Protocol")) |