luci-mod-admin-full: use :ipaddrs() and :ip6addrs() helper for iface_status
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
e626599c26
commit
152ba9ab22
1 changed files with 2 additions and 20 deletions
|
@ -235,6 +235,8 @@ function iface_status(ifaces)
|
||||||
proto = net:proto(),
|
proto = net:proto(),
|
||||||
uptime = net:uptime(),
|
uptime = net:uptime(),
|
||||||
gwaddr = net:gwaddr(),
|
gwaddr = net:gwaddr(),
|
||||||
|
ipaddrs = net:ipaddrs(),
|
||||||
|
ip6addrs = net:ip6addrs(),
|
||||||
dnsaddrs = net:dnsaddrs(),
|
dnsaddrs = net:dnsaddrs(),
|
||||||
name = device:shortname(),
|
name = device:shortname(),
|
||||||
type = device:type(),
|
type = device:type(),
|
||||||
|
@ -246,29 +248,9 @@ function iface_status(ifaces)
|
||||||
rx_packets = device:rx_packets(),
|
rx_packets = device:rx_packets(),
|
||||||
tx_packets = device:tx_packets(),
|
tx_packets = device:tx_packets(),
|
||||||
|
|
||||||
ipaddrs = { },
|
|
||||||
ip6addrs = { },
|
|
||||||
subdevices = { }
|
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
|
for _, device in ipairs(net:get_interfaces() or {}) do
|
||||||
data.subdevices[#data.subdevices+1] = {
|
data.subdevices[#data.subdevices+1] = {
|
||||||
name = device:shortname(),
|
name = device:shortname(),
|
||||||
|
|
Loading…
Reference in a new issue