modules/freifunk: handle v6 conditionally (as in network / routes)
This commit is contained in:
parent
46bb17c2d2
commit
008a65e5cc
1 changed files with 20 additions and 18 deletions
|
@ -175,33 +175,35 @@ end
|
||||||
|
|
||||||
|
|
||||||
local routes6 = {}
|
local routes6 = {}
|
||||||
for i, route in ipairs(luci.sys.net.routes6()) do
|
for i, route in ipairs(luci.sys.net.routes6() or {}) do
|
||||||
if route.dest:prefix() == 0 then
|
if route.dest:prefix() == 0 then
|
||||||
routes6[#routes6+1] = route
|
routes6[#routes6+1] = route
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
v6 = r:section(Table, routes6)
|
if #routes6 > 0 then
|
||||||
|
v6 = r:section(Table, routes6)
|
||||||
|
|
||||||
net = v6:option(DummyValue, "iface", translate("network"))
|
net = v6:option(DummyValue, "iface", translate("network"))
|
||||||
function net.cfgvalue(self, section)
|
function net.cfgvalue(self, section)
|
||||||
return luci.tools.webadmin.iface_get_network(routes[section].device)
|
return luci.tools.webadmin.iface_get_network(routes[section].device)
|
||||||
or routes6[section].device
|
or routes6[section].device
|
||||||
end
|
end
|
||||||
|
|
||||||
target = v6:option(DummyValue, "target", translate("target"))
|
target = v6:option(DummyValue, "target", translate("target"))
|
||||||
function target.cfgvalue(self, section)
|
function target.cfgvalue(self, section)
|
||||||
return routes6[section].dest:string()
|
return routes6[section].dest:string()
|
||||||
end
|
end
|
||||||
|
|
||||||
gateway = v6:option(DummyValue, "gateway6", translate("gateway6"))
|
gateway = v6:option(DummyValue, "gateway6", translate("gateway6"))
|
||||||
function gateway.cfgvalue(self, section)
|
function gateway.cfgvalue(self, section)
|
||||||
return routes6[section].source:string()
|
return routes6[section].source:string()
|
||||||
end
|
end
|
||||||
|
|
||||||
metric = v6:option(DummyValue, "metric", translate("metric"))
|
metric = v6:option(DummyValue, "metric", translate("metric"))
|
||||||
function metric.cfgvalue(self, section)
|
function metric.cfgvalue(self, section)
|
||||||
return string.format("%X", routes6[section].metric)
|
return string.format("%X", routes6[section].metric)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return f, m, r
|
return f, m, r
|
||||||
|
|
Loading…
Reference in a new issue