summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-11-30 19:29:59 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-11-30 19:29:59 +0000
commit008a65e5cc8462eda6ad13b26f767dc5421e5ac9 (patch)
treea13ee1e99f74ea763ee1b352273f1e21eac13dff
parent46bb17c2d22c93c09b627062866e9ef599540687 (diff)
modules/freifunk: handle v6 conditionally (as in network / routes)
-rw-r--r--modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua38
1 files changed, 20 insertions, 18 deletions
diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua b/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua
index 5971e2a2f..016a0b7f2 100644
--- a/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua
+++ b/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua
@@ -175,33 +175,35 @@ end
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
routes6[#routes6+1] = route
end
end
-v6 = r:section(Table, routes6)
+if #routes6 > 0 then
+ v6 = r:section(Table, routes6)
-net = v6:option(DummyValue, "iface", translate("network"))
-function net.cfgvalue(self, section)
- return luci.tools.webadmin.iface_get_network(routes[section].device)
- or routes6[section].device
-end
+ net = v6:option(DummyValue, "iface", translate("network"))
+ function net.cfgvalue(self, section)
+ return luci.tools.webadmin.iface_get_network(routes[section].device)
+ or routes6[section].device
+ end
-target = v6:option(DummyValue, "target", translate("target"))
-function target.cfgvalue(self, section)
- return routes6[section].dest:string()
-end
+ target = v6:option(DummyValue, "target", translate("target"))
+ function target.cfgvalue(self, section)
+ return routes6[section].dest:string()
+ end
-gateway = v6:option(DummyValue, "gateway6", translate("gateway6"))
-function gateway.cfgvalue(self, section)
- return routes6[section].source:string()
-end
+ gateway = v6:option(DummyValue, "gateway6", translate("gateway6"))
+ function gateway.cfgvalue(self, section)
+ return routes6[section].source:string()
+ end
-metric = v6:option(DummyValue, "metric", translate("metric"))
-function metric.cfgvalue(self, section)
- return string.format("%X", routes6[section].metric)
+ metric = v6:option(DummyValue, "metric", translate("metric"))
+ function metric.cfgvalue(self, section)
+ return string.format("%X", routes6[section].metric)
+ end
end
return f, m, r