mac80211: fix list_phy_interfaces for multiple wiphys on the same device
authorFelix Fietkau <nbd@nbd.name>
Mon, 13 Jan 2020 21:10:03 +0000 (22:10 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2020 13:57:13 +0000 (14:57 +0100)
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 <nbd@nbd.name>
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

index f1882ec509d34a6d6758532a46535c71044b97b7..b0fc5fb37be3970801572bd1547e63ae2e8c0313 100644 (file)
@@ -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