summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2018-12-29 11:35:01 +0200
committerGitHub <noreply@github.com>2018-12-29 11:35:01 +0200
commit1d3a8739a29c15f2274a8ec7043ef5cb2274ff97 (patch)
treef46e6acfa8dcbb36928e31bee30b5950df756339
parent39aa247dd2e9d9b04fae3307f9d489d602b1deef (diff)
parent076e5672adba3a7c1dca3a9e6651d5a65092e426 (diff)
Merge pull request #2406 from rosysong/nft-qos
luci-app-nft-qos: fix monitor doesn't work when there no ipv6 support.
-rw-r--r--applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua b/applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua
index 42043505dc..f7e399352f 100644
--- a/applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua
+++ b/applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua
@@ -17,7 +17,12 @@ function index()
end
function _action_rate(rv, n)
- local c = io.popen("nft list chain inet nft-qos-monitor " .. n .. " 2>/dev/null")
+ local has_ipv6 = nixio.fs.access("/proc/net/ipv6_route")
+ if has_ipv6 then
+ local c = io.popen("nft list chain inet nft-qos-monitor " .. n .. " 2>/dev/null")
+ else
+ local c = io.popen("nft list chain ip nft-qos-monitor " .. n .. " 2>/dev/null")
+ end
if c then
for l in c:lines() do
local _, i, p, b = l:match('^%s+ip ([^%s]+) ([^%s]+) counter packets (%d+) bytes (%d+)')