From 6e7fb14afc0be9c0d5d9cae28a0719bbbbaee262 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Mon, 24 Jun 2013 12:00:33 +0000 Subject: [PATCH] libs/core: fallback to ipv6-prefix-assignment if ipv6-address is empty --- libs/core/luasrc/model/network.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua index 09a58d742..ecfaa84dc 100644 --- a/libs/core/luasrc/model/network.lua +++ b/libs/core/luasrc/model/network.lua @@ -813,8 +813,14 @@ end function protocol.ip6addr(self) local addrs = self:_ubus("ipv6-address") - return addrs and #addrs > 0 - and "%s/%d" %{ addrs[1].address, addrs[1].mask } + if addrs and #addrs > 0 then + 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 function protocol.gw6addr(self) -- 2.25.1