[PATCH] Ensure WDS is available on combined backhaul and fronthaul APs

Stefan Schake stefan.schake at devolo.de
Wed Oct 18 02:21:38 PDT 2023


It is valid to configure an AP to be both backhaul and
fronthaul (multi_ap=3), so we should not test for a missing
fronthaul flag but instead test directly for backhaul capability.

Signed-off-by: Stefan Schake <stefan.schake at devolo.de>
---
 src/ap/ieee802_11.c          | 2 +-
 src/ap/sta_info.c            | 2 +-
 tests/hwsim/test_multi_ap.py | 8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index a9b3e8c60..19796dce3 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -6471,7 +6471,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
 	/* WPS not supported on backhaul BSS. Disable 4addr mode on fronthaul */
 	if ((sta->flags & WLAN_STA_WDS) ||
 	    (sta->flags & WLAN_STA_MULTI_AP &&
-	     !(hapd->conf->multi_ap & FRONTHAUL_BSS) &&
+	     (hapd->conf->multi_ap & BACKHAUL_BSS) &&
 	     !(sta->flags & WLAN_STA_WPS))) {
 		int ret;
 		char ifname_wds[IFNAMSIZ + 1];
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index d87214ec7..4f84839e3 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -199,7 +199,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 
 	if ((sta->flags & WLAN_STA_WDS) ||
 	    (sta->flags & WLAN_STA_MULTI_AP &&
-	     !(hapd->conf->multi_ap & FRONTHAUL_BSS) &&
+	     (hapd->conf->multi_ap & BACKHAUL_BSS) &&
 	     !(sta->flags & WLAN_STA_WPS)))
 		hostapd_set_wds_sta(hapd, NULL, sta->addr, sta->aid, 0);
 
diff --git a/tests/hwsim/test_multi_ap.py b/tests/hwsim/test_multi_ap.py
index 99db14ebf..8bfcbda21 100644
--- a/tests/hwsim/test_multi_ap.py
+++ b/tests/hwsim/test_multi_ap.py
@@ -30,6 +30,13 @@ def test_multi_ap_association_shared_bss(dev, apdev):
     run_multi_ap_association(dev, apdev, 3)
     dev[1].connect("multi-ap", psk="12345678", scan_freq="2412")
 
+def test_multi_ap_backhaul_shared_bss(dev, apdev):
+    """Multi-AP backhaul to backhaul+fronthaul BSS"""
+    hapd = run_multi_ap_association(dev, apdev, 3, wait_connect=False)
+    ev = hapd.wait_event(["WDS-STA-INTERFACE-ADDED"], timeout=10)
+    if ev is None:
+        raise Exception("No WDS-STA-INTERFACE-ADDED event seen")
+
 def run_multi_ap_association(dev, apdev, multi_ap, wait_connect=True):
     params = hostapd.wpa2_params(ssid="multi-ap", passphrase="12345678")
     if multi_ap:
@@ -38,6 +45,7 @@ def run_multi_ap_association(dev, apdev, multi_ap, wait_connect=True):
 
     dev[0].connect("multi-ap", psk="12345678", scan_freq="2412",
                    multi_ap_backhaul_sta="1", wait_connect=wait_connect)
+    return hapd
 
 def test_multi_ap_backhaul_roam_with_bridge(dev, apdev):
     """Multi-AP backhaul BSS reassociation to another BSS with bridge"""
-- 
2.34.1




More information about the Hostap mailing list