X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Ftools%2Fwebadmin.lua;h=106810aa03e44e6ac1fa22dd0af436d4b821fbeb;hp=34d8301ae05dc64ab0c55dbab0ee234164df270b;hb=9db5fa93afdbb4667e523cba0e6bde4e73a01150;hpb=577b772824bae3e2a35c6eb404796a04776e9f14 diff --git a/modules/luci-base/luasrc/tools/webadmin.lua b/modules/luci-base/luasrc/tools/webadmin.lua index 34d8301ae..106810aa0 100644 --- a/modules/luci-base/luasrc/tools/webadmin.lua +++ b/modules/luci-base/luasrc/tools/webadmin.lua @@ -83,28 +83,20 @@ 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 local uciname = cur:get("network", net.interface, "ifname") - if not uciname or uciname:sub(1, 1) ~= "@" then + if type(uciname) == "string" and uciname:sub(1,1) ~= "@" or uciname then return net.interface end end