1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

No error if ndpi is not loaded

This commit is contained in:
Ycarus 2019-01-26 13:50:03 +01:00
parent 1bf6799321
commit df7a7ffd2b

View file

@ -1,4 +1,4 @@
-- Copyright 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
-- Copyright 2018-2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
-- Licensed to the public under the Apache License 2.0.
local ipc = require "luci.ip"
@ -86,16 +86,19 @@ s.template = "cbi/tblsection"
dpi = s:option(Value, "proto", translate("Protocol"))
dpi.rmempty = true
dpi.optional = false
local protos = {}
for l in io.lines("/proc/net/xt_ndpi/proto") do
local a,b,c,d = l:match('(%w+) (%w+)')
if b ~= "2" and not string.match(b,"custom") then
table.insert(protos,b)
local xt_ndpi_available = nixio.fs.access("/proc/net/xt_ndpi/proto")
if xt_ndpi_available then
local protos = {}
for l in io.lines("/proc/net/xt_ndpi/proto") do
local a,b,c,d = l:match('(%w+) (%w+)')
if b ~= "2" and not string.match(b,"custom") then
table.insert(protos,b)
end
end
table.sort(protos)
for _,b in ipairs(protos) do
dpi:value(b,"%s" % tostring(b))
end
end
table.sort(protos)
for _,b in ipairs(protos) do
dpi:value(b,"%s" % tostring(b))
end
ifp = s:option(ListValue, "interface", translate("Interface"))