luci-base: properly handle undefined IPv6 local-address information
If IPv6 prefix assignment is disabled, the "local-address" structure might exist, but be empty which causes the adress formatting in the network model class to bail out. Verify the completeness of the "local-address" structure before using it in order to avoid runtime errors. Fixes #1657. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
852ec6e28b
commit
bf49505ea0
1 changed files with 4 additions and 1 deletions
|
@ -1001,7 +1001,10 @@ function protocol.ip6addrs(self)
|
||||||
|
|
||||||
if type(addrs) == "table" then
|
if type(addrs) == "table" then
|
||||||
for n, addr in ipairs(addrs) do
|
for n, addr in ipairs(addrs) do
|
||||||
if type(addr["local-address"]) == "table" then
|
if type(addr["local-address"]) == "table" and
|
||||||
|
type(addr["local-address"].mask) == "number" and
|
||||||
|
type(addr["local-address"].address) == "string"
|
||||||
|
then
|
||||||
rv[#rv+1] = "%s/%d" %{
|
rv[#rv+1] = "%s/%d" %{
|
||||||
addr["local-address"].address,
|
addr["local-address"].address,
|
||||||
addr["local-address"].mask
|
addr["local-address"].mask
|
||||||
|
|
Loading…
Reference in a new issue