luci-0.8: merge r3851
This commit is contained in:
parent
3ec8d04c66
commit
c1d9107be8
2 changed files with 52 additions and 50 deletions
|
@ -321,14 +321,15 @@ end
|
|||
function net.defaultroute6()
|
||||
local route = nil
|
||||
local routes6 = net.routes6()
|
||||
if not routes6 then
|
||||
return nil
|
||||
end
|
||||
if routes6 then
|
||||
for _, r in pairs(routes6) do
|
||||
if r.dest:prefix() == 0 and (not route or route.metric > r.metric) then
|
||||
if r.dest:prefix() == 0 and
|
||||
(not route or route.metric > r.metric)
|
||||
then
|
||||
route = r
|
||||
end
|
||||
end
|
||||
end
|
||||
return route
|
||||
end
|
||||
|
||||
|
@ -419,12 +420,9 @@ end
|
|||
-- { "source", "dest", "nexthop", "metric", "refcount", "usecount",
|
||||
-- "flags", "device" }
|
||||
function net.routes6()
|
||||
if luci.fs.access("/proc/net/ipv6_route", "r") then
|
||||
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,
|
||||
|
@ -459,6 +457,7 @@ function net.routes6()
|
|||
end
|
||||
|
||||
return routes
|
||||
end
|
||||
end
|
||||
|
||||
--- Tests whether the given host responds to ping probes.
|
||||
|
|
|
@ -42,7 +42,10 @@ if not arg or not arg[1] then
|
|||
return routes[section].gateway:string()
|
||||
end
|
||||
|
||||
metric = v:option(DummyValue, "Metric", translate("metric"))
|
||||
metric = v:option(DummyValue, "metric", translate("metric"))
|
||||
function metric.cfgvalue(self, section)
|
||||
return routes[section].metric
|
||||
end
|
||||
|
||||
if routes6 then
|
||||
v = m:section(Table, routes6, translate("a_n_routes_kernel6"))
|
||||
|
@ -63,7 +66,7 @@ if not arg or not arg[1] then
|
|||
return routes6[section].source:string()
|
||||
end
|
||||
|
||||
metric = v:option(DummyValue, "Metric", translate("metric"))
|
||||
metric = v:option(DummyValue, "metric", translate("metric"))
|
||||
function metric.cfgvalue(self, section)
|
||||
return string.format( "%08X", routes6[section].metric )
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue