[PATCH] multiple_bssid: make the AID space shared

John Crispin <[email protected]> Fri, 5 Jun 2020 13:03:02 +0200
Newsgroups gmane.linux.drivers.hostap
Message-ID <[email protected]>
There is a shared TIM IE in the transmitting BSSs beacon. For STAs connected to
the non-transmitting BSSs to be able to find their TIM bit we needs a shared
AID index. Also the AID0 used for mc/bc becomes AID<ifnum> so we need to adjust
the base offset.

Signed-off-by: John Crispin <[email protected]>
---
Hi Jouni,
this depends on the other multiple bssid patches
	John
 src/ap/ieee802_11.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 0822dfd34..cc9efe7cd 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2711,7 +2711,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;
 
@@ -4371,7 +4375,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;
-- 
2.20.1