From: Rosy Song Date: Sat, 29 Dec 2018 09:31:12 +0000 (+0800) Subject: luci-app-nft-qos: fix monitor doesn't work when there no ipv6 support. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fpull%2F2406%2Fhead;p=oweals%2Fluci.git luci-app-nft-qos: fix monitor doesn't work when there no ipv6 support. Signed-off-by: Rosy Song --- 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 42043505d..f7e399352 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+)')