From 8b15e7f661b4263a7b9fb6a410a5f58263b72caa Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 31 Oct 2019 12:36:55 +0100 Subject: mac80211: add support for multiple wiphys behind a single device The device path will be the same for the first phy. For all subsequent phys, the path gets an extra +1, +2, ... Move the code for converting path to phy and vice versa to a separate library script shared by config detection code and the netifd wireless handler script Signed-off-by: Felix Fietkau --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh') diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index f9d5c0c6d5..12af2d1d0e 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -1,6 +1,7 @@ #!/bin/sh . /lib/netifd/netifd-wireless.sh . /lib/netifd/hostapd.sh +. /lib/netifd/mac80211.sh init_wireless_driver "$@" @@ -407,11 +408,8 @@ mac80211_generate_mac() { find_phy() { [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 [ -n "$path" ] && { - for phy in $(ls /sys/class/ieee80211 2>/dev/null); do - case "$(readlink -f /sys/class/ieee80211/$phy/device)" in - *$path) return 0;; - esac - done + phy="$(mac80211_path_to_phy "$path")" + [ -n "$phy" ] && return 0 } [ -n "$macaddr" ] && { for phy in $(ls /sys/class/ieee80211 2>/dev/null); do @@ -740,6 +738,9 @@ mac80211_interface_cleanup() { local phy="$1" for wdev in $(list_phy_interfaces "$phy"); do + local wdev_phy="$(readlink /sys/class/net/${wdev}/phy80211)" + wdev_phy="$(basename "$wdev_phy")" + [ -n "$wdev_phy" -a "$wdev_phy" != "$phy" ] && continue ip link set dev "$wdev" down 2>/dev/null iw dev "$wdev" del done -- cgit v1.2.3