diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-11-17 17:36:00 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-11-17 17:36:00 +0100 |
commit | 152ba9ab228ad4ea4c1748f29fe4ffa5f8f74ac6 (patch) | |
tree | 108ab678bb49dd475855d22160cf9ddee3d95615 /modules/luci-mod-admin-full | |
parent | e626599c261e1795f49bbe59b0476fd5496bf079 (diff) |
luci-mod-admin-full: use :ipaddrs() and :ip6addrs() helper for iface_status
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/controller/admin/network.lua | 22 |
1 files changed, 2 insertions, 20 deletions
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(), |