libs/core: fallback to ipv6-prefix-assignment if ipv6-address is empty

This commit is contained in:
Jo-Philipp Wich 2013-03-19 17:26:01 +00:00
parent ead51693dc
commit f804a21c8d

View file

@ -813,8 +813,14 @@ end
function protocol.ip6addr(self) function protocol.ip6addr(self)
local addrs = self:_ubus("ipv6-address") local addrs = self:_ubus("ipv6-address")
return addrs and #addrs > 0 if addrs and #addrs > 0 then
and "%s/%d" %{ addrs[1].address, addrs[1].mask } return "%s/%d" %{ addrs[1].address, addrs[1].mask }
else
addrs = self:_ubus("ipv6-prefix-assignment")
if addrs and #addrs > 0 then
return "%s/%d" %{ addrs[1].address, addrs[1].mask }
end
end
end end
function protocol.gw6addr(self) function protocol.gw6addr(self)