From bf49505ea0a07c35719a7b71f8212e547d999d62 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 2 Mar 2018 14:42:52 +0100 Subject: [PATCH] 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 --- modules/luci-base/luasrc/model/network.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 3521c6d57..c8ec5364e 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -1001,7 +1001,10 @@ function protocol.ip6addrs(self) if type(addrs) == "table" then 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" %{ addr["local-address"].address, addr["local-address"].mask -- 2.25.1