diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/sys/luasrc/sys.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index 948da5b1e..e92adc1ad 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -320,7 +320,11 @@ end -- "flags", "device" } function net.defaultroute6() local route = nil - for _, r in pairs(net.routes6()) do + local routes6 = net.routes6() + if not routes6 then + return nil + end + for _, r in pairs(routes6) do if r.dest:prefix() == 0 and (not route or route.metric > r.metric) then route = r end @@ -417,6 +421,10 @@ end function net.routes6() local routes = { } + if not luci.fs.access("/proc/net/ipv6_route", "r") then + return nil + end + for line in io.lines("/proc/net/ipv6_route") do local dst_ip, dst_prefix, src_ip, src_prefix, nexthop, |