From: Jo-Philipp Wich Date: Thu, 20 Jul 2017 09:44:25 +0000 (+0200) Subject: luci-base: let luci.sys.net.devices() return all netdevs X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=4201282559d85988990c8f48f4075bed5f785c2f luci-base: let luci.sys.net.devices() return all netdevs The previous implementation of the function only returned ethernet interfaces because it relied on the AF_PACKET family entries returned by getifaddrs(). Change the function to simply collect all interface names it sees in order to avoid missing tunnel interfaces. Fixes FS#917. Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua index 99f3ee291..115c54d54 100644 --- a/modules/luci-base/luasrc/sys.lua +++ b/modules/luci-base/luasrc/sys.lua @@ -348,8 +348,10 @@ end function net.devices() local devs = {} + local seen = {} for k, v in ipairs(nixio.getifaddrs()) do - if v.family == "packet" then + if v.name and not seen[v.name] then + seen[v.name] = true devs[#devs+1] = v.name end end