From: Felix Fietkau Date: Mon, 13 Jan 2020 21:10:03 +0000 (+0100) Subject: mac80211: fix list_phy_interfaces for multiple wiphys on the same device X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=b1a1c222c93bb4e8f2d2e13f50fe6329e523ae3b;p=openwrt%2Fstaging%2Fadrian.git mac80211: fix list_phy_interfaces for multiple wiphys on the same device Network interfaces are looked up based on the device behind a phy, so the phy needs to be checked separately Signed-off-by: Felix Fietkau --- diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index f1882ec509..b0fc5fb37b 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -983,7 +983,7 @@ drv_mac80211_setup() { wireless_set_up } -list_phy_interfaces() { +_list_phy_interfaces() { local phy="$1" if [ -d "/sys/class/ieee80211/${phy}/device/net" ]; then ls "/sys/class/ieee80211/${phy}/device/net" 2>/dev/null; @@ -992,6 +992,15 @@ list_phy_interfaces() { fi } +list_phy_interfaces() { + local phy="$1" + + for dev in $(_list_phy_interfaces "$phy"); do + readlink "/sys/class/net/${dev}/phy80211" | grep -q "/${phy}\$" || continue + echo "$dev" + done +} + drv_mac80211_teardown() { wireless_process_kill_all