summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-03-12 16:12:18 +0100
committerJo-Philipp Wich <jo@mein.io>2018-03-12 16:12:18 +0100
commit28e3b328545529c19429ce88c7d1769e64e2de0f (patch)
tree3d7d85d7d4d1202199bad98df125f2af88b73c86 /modules/luci-mod-admin-full
parentdfba318140e1a84359e221b7a9154337595dbded (diff)
treewide: unify mac address handling
Use the new luci.ip MAC address facilities to parse and verify MAC addresses in a common way, instead of relying on various ad-hoc solutions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/network.lua1
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua9
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua9
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm2
4 files changed, 12 insertions, 9 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 2cb2108b9..33f6a6703 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua
@@ -258,7 +258,6 @@ function iface_status(ifaces)
type = device:type(),
ifname = device:name(),
macaddr = device:mac(),
- macaddr = device:mac(),
is_up = device:is_up(),
rx_bytes = device:rx_bytes(),
tx_bytes = device:tx_bytes(),
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
index 2acda0b73..66d9942a1 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
@@ -2,6 +2,7 @@
-- Licensed to the public under the Apache License 2.0.
local ipc = require "luci.ip"
+local sys = require "luci.sys"
local o
require "luci.util"
@@ -311,10 +312,10 @@ end
hostid = s:option(Value, "hostid", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Suffix (hex)"))
-ipc.neighbors({ family = 4 }, function(n)
- if n.mac and n.dest then
- ip:value(n.dest:string())
- mac:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
+sys.net.host_hints(function(m, v4, v6, name)
+ if m and v4 then
+ ip:value(v4)
+ mac:value(m, "%s (%s)" %{ m, name or v4 })
end
end)
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua
index fafacf35c..46945af58 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua
@@ -3,6 +3,7 @@
-- Licensed to the public under the Apache License 2.0.
local ipc = require "luci.ip"
+local sys = require "luci.sys"
m = Map("dhcp", translate("Hostnames"))
@@ -19,9 +20,11 @@ ip = s:option(Value, "ip", translate("IP address"))
ip.datatype = "ipaddr"
ip.rmempty = true
-ipc.neighbors({ }, function(n)
- if n.mac and n.dest and not n.dest:is6linklocal() then
- ip:value(n.dest:string(), "%s (%s)" %{ n.dest:string(), n.mac })
+sys.net.host_hints(function(mac, v4, v6, name)
+ v6 = v6 and ipc.IPv6(v6)
+
+ if v4 or (v6 and not v6:is6linklocal()) then
+ ip:value(tostring(v4 or v6), "%s (%s)" %{ tostring(v4 or v6), name or mac })
end
end)
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm
index 5f2c07493..f474c7156 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm
@@ -53,7 +53,7 @@
<tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
<td class="cbi-value-field"><%=v.dest%></td>
<td class="cbi-value-field"><%=v.mac%></td>
- <td class="cbi-value-field"><%=v.dev%></td>
+ <td class="cbi-value-field"><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%></td>
</tr>
<%
style = not style