luci-app-shadowsocks-libev: enumerate ifnames with sys.net.devices()
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 22 Aug 2017 02:48:51 +0000 (10:48 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Tue, 22 Aug 2017 12:19:50 +0000 (20:19 +0800)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua

index e2a07adae185007626d546f2bec073cbc35a8f02..7ba6b40c5309b7a236880e6aefed31f75f81a2fa 100644 (file)
@@ -3,6 +3,7 @@
 
 local _up = getfenv(3)
 local ut = require("luci.util")
+local sys = require("luci.sys")
 local ds = require("luci.dispatcher")
 local nw = require("luci.model.network")
 nw.init()
@@ -56,10 +57,8 @@ function values_ipaddr(o)
 end
 
 function values_ifnames(o)
-       for _, v in ipairs(nw:get_interfaces()) do
-               if v.dev then
-                       o:value(v.dev.name)
-               end
+       for _, v in ipairs(sys.net.devices()) do
+               o:value(v)
        end
 end