mac80211: fix list_phy_interfaces for multiple wiphys on the same device
[openwrt/staging/dedeckeh.git] / 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