From bf88adcf3d055e36df36e340cb5aa5e7dc37a9d0 Mon Sep 17 00:00:00 2001
From: Janusz Dziedzic <janusz.dziedzic@iopsys.eu>
Date: Fri, 8 Jan 2021 16:04:33 +0000
Subject: [PATCH] brcm63xx: mac80211.sh: use DFS workaround for AP

Use DFS workaround only for AP interface.
In other case we hit strange problem:
 - have wlX as a station
 - have wlX.1 as a AP

Hostapd startup failed on wlX.1 while
macaddr set IOCTL fail.

Interesting that we/hostapd can change/set mac
address only when wl is down.

root@iopsys:~# ifconfig wl2.1 hw ether EE:6C:9A:52:AC:CB
ifconfig: SIOCSIFHWADDR: I/O error
root@iopsys:~# wl -i wl1 isup
1
root@iopsys:~#

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@iopsys.eu>
---
 .../base-files/lib/netifd/wireless/mac80211.sh              | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/iopsys-brcm63xx-arm/base-files/lib/netifd/wireless/mac80211.sh b/iopsys-brcm63xx-arm/base-files/lib/netifd/wireless/mac80211.sh
index 6cccc423e..63ff5fd90 100755
--- a/iopsys-brcm63xx-arm/base-files/lib/netifd/wireless/mac80211.sh
+++ b/iopsys-brcm63xx-arm/base-files/lib/netifd/wireless/mac80211.sh
@@ -697,8 +697,10 @@ mac80211_iw_interface_add() {
 		echo "$ifname set type status $rc"
 
 		# activate brcm DFS offload
-		ifconfig "$ifname" up
-		ifconfig "$ifname" down
+		if [ "$type" = "__ap" ]; then
+			ifconfig "$ifname" up
+			ifconfig "$ifname" down
+		fi
 
 		return $rc
 	}
-- 
GitLab