luci-app-shadowsocks-libev: eliminate use of luci.sys.net.arptable()
authorJo-Philipp Wich <jo@mein.io>
Mon, 10 Jul 2017 14:16:35 +0000 (16:16 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 11 Jul 2017 12:05:31 +0000 (14:05 +0200)
Translate the use of luci.sys.net.arptable() to luci.ip.neighbors() to allow
dropping the former function from base LuCI later on.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua

index 76435e2..97ce83f 100644 (file)
@@ -137,13 +137,14 @@ o:value("2", translate("Allow all except listed"))
 o.default = 0
 o.rmempty = false
 
-a = luci.sys.net.arptable() or {}
-
 o = s:taboption("lan_ac", DynamicList, "lan_ac_ip", translate("LAN IP List"))
 o.datatype = "ipaddr"
-for i,v in ipairs(a) do
-       o:value(v["IP address"])
-end
+
+luci.ip.neighbors({ family = 4 }, function(entry)
+       if entry.reachable then
+               o:value(entry.dest:string())
+       end
+end)
 
 s:tab("wan_ac", translate("WAN"))