diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-03-19 17:26:01 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-03-19 17:26:01 +0000 |
commit | f804a21c8db0acdb8bdf85edd24e55ab344ef007 (patch) | |
tree | b3bec41a3e2d312ee0b105bf4cf56162171f92f3 /libs/core/luasrc | |
parent | ead51693dc6e20d7d948d5815822329952ae586b (diff) |
libs/core: fallback to ipv6-prefix-assignment if ipv6-address is empty
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r-- | libs/core/luasrc/model/network.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua index 09a58d7424..ecfaa84dc1 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) |