summaryrefslogtreecommitdiffhomepage
path: root/libs/core
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-06-17 11:18:58 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-06-17 11:18:58 +0000
commit5bcf9d07fdb29b03f191f63a98f76e44e348868f (patch)
treea649e811853f028560b5e4fa59f05886b3f1ba24 /libs/core
parent740feed2fca54d96302fa635b98fc185c3c1b13d (diff)
libs/core: fix various problems in the network model
Diffstat (limited to 'libs/core')
-rw-r--r--libs/core/luasrc/model/network.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua
index 3e59ed5c4..39145748f 100644
--- a/libs/core/luasrc/model/network.lua
+++ b/libs/core/luasrc/model/network.lua
@@ -633,6 +633,7 @@ function protocol.ifname(self)
ifname = self:_ubus("device")
end
if not ifname then
+ local num = { }
_uci_real:foreach("wireless", "wifi-iface",
function(s)
if s.device then
@@ -731,7 +732,7 @@ end
function protocol.gw6addr(self)
local _, route
- for _, route in ipairs(self:_ubus("route")) do
+ for _, route in ipairs(self:_ubus("route") or { }) do
if route.target == "::" and route.mask == 0 then
return ipc.IPv6(route.nexthop):string()
end
@@ -741,7 +742,7 @@ end
function protocol.dns6addrs(self)
local dns = { }
local _, addr
- for _, addr in ipairs(self:_ubus("dns-server")) do
+ for _, addr in ipairs(self:_ubus("dns-server") or { }) do
if addr:match(":") then
dns[#dns+1] = addr
end
@@ -1031,6 +1032,7 @@ function interface.ports(self)
for _, iface in ipairs(members) do
ifaces[#ifaces+1] = interface(iface)
end
+ return ifaces
end
end