diff options
author | Steven Barth <steven@midlink.org> | 2008-11-30 18:43:10 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-11-30 18:43:10 +0000 |
commit | cd8e12d72a038bc3d6f4a62225c83f12815e28cd (patch) | |
tree | 64ff88b63f9becf075b6728887dccb104a740cac /libs | |
parent | 5734545388e6661c3e9040c53262bc3ba54fa81e (diff) |
Don't fail if we do not have v6 support
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, |