From: Jo-Philipp Wich Date: Thu, 22 Jan 2015 17:50:00 +0000 (+0100) Subject: luci-mod-admin-mini: convert luci.sys.net.arptable() to luci.ip.neighbors() X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=b24dfd52ac4e45741bfe5049bf0f2e863ffffad2 luci-mod-admin-mini: convert luci.sys.net.arptable() to luci.ip.neighbors() Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua b/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua index 5d3d8ad22..9a1c1fea4 100644 --- a/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua +++ b/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua @@ -3,7 +3,7 @@ -- Licensed to the public under the Apache License 2.0. local uci = require "luci.model.uci".cursor() -local sys = require "luci.sys" +local ipc = require "luci.ip" local wa = require "luci.tools.webadmin" local fs = require "nixio.fs" @@ -86,12 +86,12 @@ s2.template = "cbi/tblsection" name = s2:option(Value, "name", translate("Hostname")) mac = s2:option(Value, "mac", translate("MAC-Address")) ip = s2:option(Value, "ip", translate("IPv4-Address")) -sys.net.arptable(function(entry) - ip:value(entry["IP address"]) - mac:value( - entry["HW address"], - entry["HW address"] .. " (" .. entry["IP address"] .. ")" - ) + +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() }) + end end) return m