diff mbox series

[V2,7/7] multiple_bssid: make the AID space shared

Message ID 20200706125031.668258-8-john@phrozen.org
State Superseded
Headers show
Series multiple_bssid: add support | expand

Commit Message

John Crispin July 6, 2020, 12:50 p.m. UTC
There is only one shared TIM field in the transmitted beacon for all BSSs.
AID0 becomes AIDx where x is the bss_index. The STA AID offset needs to be
shifted accordingly.

Signed-off-by: John Crispin <john@phrozen.org>
---
 src/ap/ieee802_11.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index de4a7dfa3..b0575337b 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2701,7 +2701,11 @@  int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
 	}
 	if (j == 32)
 		return -1;
-	aid = i * 32 + j + 1;
+	aid = i * 32 + j;
+	if (hapd->iconf->multiple_bssid)
+		aid += hapd->iface->num_bss;
+	else
+		aid += 1;
 	if (aid > 2007)
 		return -1;
 
@@ -4368,7 +4372,7 @@  static void handle_assoc(struct hostapd_data *hapd,
 		goto fail;
 	omit_rsnxe = !get_ie(pos, left, WLAN_EID_RSNX);
 
-	if (hostapd_get_aid(hapd, sta) < 0) {
+	if (hostapd_get_aid(hostapd_get_primary_bss(hapd), sta) < 0) {
 		hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_INFO, "No room for more AIDs");
 		resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;