From: Jo-Philipp Wich Date: Tue, 17 Nov 2015 16:36:00 +0000 (+0100) Subject: luci-mod-admin-full: use :ipaddrs() and :ip6addrs() helper for iface_status X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=152ba9ab228ad4ea4c1748f29fe4ffa5f8f74ac6 luci-mod-admin-full: use :ipaddrs() and :ip6addrs() helper for iface_status Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua index 879e54b24..aa533cb70 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua @@ -235,6 +235,8 @@ function iface_status(ifaces) proto = net:proto(), uptime = net:uptime(), gwaddr = net:gwaddr(), + ipaddrs = net:ipaddrs(), + ip6addrs = net:ip6addrs(), dnsaddrs = net:dnsaddrs(), name = device:shortname(), type = device:type(), @@ -246,29 +248,9 @@ function iface_status(ifaces) rx_packets = device:rx_packets(), tx_packets = device:tx_packets(), - ipaddrs = { }, - ip6addrs = { }, subdevices = { } } - local _, a - for _, a in ipairs(device:ipaddrs()) do - data.ipaddrs[#data.ipaddrs+1] = { - addr = a:host():string(), - netmask = a:mask():string(), - prefix = a:prefix() - } - end - for _, a in ipairs(device:ip6addrs()) do - if not a:is6linklocal() then - data.ip6addrs[#data.ip6addrs+1] = { - addr = a:host():string(), - netmask = a:mask():string(), - prefix = a:prefix() - } - end - end - for _, device in ipairs(net:get_interfaces() or {}) do data.subdevices[#data.subdevices+1] = { name = device:shortname(),