diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-23 15:26:33 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-23 15:26:33 +0100 |
commit | 40066a6799ba04cbf23c7752de6e83103a33ccad (patch) | |
tree | b311ff37314865c398449537a83840fab9c1f356 /modules/luci-base/luasrc/tools | |
parent | 671566d701a18d273b4bdcfbe4b08ed28df1f711 (diff) |
luci-base: optimize luci.tools.webadmin.iface_get_network()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/luasrc/tools')
-rw-r--r-- | modules/luci-base/luasrc/tools/webadmin.lua | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/modules/luci-base/luasrc/tools/webadmin.lua b/modules/luci-base/luasrc/tools/webadmin.lua index 34d8301ae0..8273175de7 100644 --- a/modules/luci-base/luasrc/tools/webadmin.lua +++ b/modules/luci-base/luasrc/tools/webadmin.lua @@ -83,23 +83,15 @@ function firewall_find_zone(name) end function iface_get_network(iface) - local devs = util.ubus("network.device", "status", { }) - local _, net, subdev, dev, status - - for dev, status in pairs(devs) do - if status["bridge-members"] then - for _, subdev in ipairs(status["bridge-members"]) do - if subdev == iface then - iface = dev - break - end - end - end + local link = ip.link(tostring(iface)) + if link.master then + iface = link.master end local cur = uci.cursor() local dump = util.ubus("network.interface", "dump", { }) if dump then + local _, net for _, net in ipairs(dump.interface) do if net.l3_device == iface or net.device == iface then -- cross check with uci to filter out @name style aliases |