Skip to contentSkip to conversation

blacklist: rename ROAM_REQUESTED to AP_BUSY

PATCH In review James Prestwood 2 participants 5 messages May 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 blacklist: rename ROAM_REQUESTED to AP_BUSY

The initial pass of this feature only envisioned BSS transition management frames as the trigger to "roam blacklist" a BSS, hence the original name. But some APs actually utilize status codes that also indicate to the stations that they are busy, or not able to handle more connections. This directly aligns with the original motivation of the "roam blacklist" series and these events should also trigger this type of blacklist.

First, since we will be applying this blacklist to cases other than being told to roam, rename this reason code internally to BLACKLIST_REASON_AP_BUSY. The config option is also being renamed to [Blacklist].InitialAccessPointBusyTimeout while also supporting the old config option, but warning that it is deprecated.

---
 src/blacklist.c | 20 ++++++++++++++------
 src/blacklist.h | 12 +++++++-----
 src/station.c   |  5 ++---
 3 files changed, 23 insertions(+), 14 deletions(-)
src/blacklist.c +14 -6
index 4250618b..a1299261 100644
@@ -45,7 +45,7 @@
 
 static uint64_t blacklist_multiplier;
 static uint64_t blacklist_initial_timeout;
-static uint64_t blacklist_roam_initial_timeout;
+static uint64_t blacklist_ap_busy_initial_timeout;
 static uint64_t blacklist_max_timeout;
 
 struct blacklist_entry {
@@ -67,8 +67,8 @@ static uint64_t get_reason_timeout(enum blacklist_reason reason)
 	switch (reason) {
 	case BLACKLIST_REASON_CONNECT_FAILED:
 		return blacklist_initial_timeout;
-	case BLACKLIST_REASON_ROAM_REQUESTED:
-		return blacklist_roam_initial_timeout;
+	case BLACKLIST_REASON_AP_BUSY:
+		return blacklist_ap_busy_initial_timeout;
 	default:
 		l_warn("Unhandled blacklist reason: %u", reason);
 		return 0;
@@ -218,11 +218,19 @@ static int blacklist_init(void)
 
 	if (!l_settings_get_uint64(config, "Blacklist",
 					"InitialRoamRequestedTimeout",
-					&blacklist_roam_initial_timeout))
-		blacklist_roam_initial_timeout = BLACKLIST_DEFAULT_TIMEOUT;
+					&blacklist_ap_busy_initial_timeout))
+		blacklist_ap_busy_initial_timeout = BLACKLIST_DEFAULT_TIMEOUT;
+	else
+		l_warn("[Blacklist].InitialRoamRequestedTimeout is deprecated, "
+			"use [Blacklist].InitialAccessPointBusyTimeout");
+
+	if (!l_settings_get_uint64(config, "Blacklist",
+					"InitialAccessPointBusyTimeout",
+					&blacklist_ap_busy_initial_timeout))
+		blacklist_ap_busy_initial_timeout = BLACKLIST_DEFAULT_TIMEOUT;
 
 	/* For easier user configuration the timeout values are in seconds */
-	blacklist_roam_initial_timeout *= L_USEC_PER_SEC;
+	blacklist_ap_busy_initial_timeout *= L_USEC_PER_SEC;
 
 	if (!l_settings_get_uint64(config, "Blacklist",
 					"Multiplier",
src/blacklist.h +7 -5
index f5c899e0..f606157c 100644
@@ -27,12 +27,14 @@ enum blacklist_reason {
 	 */
 	BLACKLIST_REASON_CONNECT_FAILED,
 	/*
-	 * This type of blacklist is added when a BSS requests IWD roams
-	 * elsewhere. This is to aid in preventing IWD from roaming/connecting
-	 * back to that BSS in the future unless there are no other "good"
-	 * candidates to connect to.
+	 * This type of blacklist is added when an AP indicates that its unable
+	 * to handle more connections. This is done via BSS-TM requests or
+	 * denied authentications/associations with certain status codes.
+	 *
+	 * Once this type of blacklist is applied to a BSS IWD will attempt to
+	 * avoid roaming to it for a configured period of time.
 	 */
-	BLACKLIST_REASON_ROAM_REQUESTED,
+	BLACKLIST_REASON_AP_BUSY,
 };
 
 void blacklist_add_bss(const uint8_t *addr, enum blacklist_reason reason);
src/station.c +2 -3
index d8016c2a..71f4db99 100644
@@ -191,8 +191,7 @@ static uint32_t evaluate_bss_group_rank(const uint8_t *addr, uint32_t freq,
 	if (blacklist_contains_bss(addr, BLACKLIST_REASON_CONNECT_FAILED))
 		return 0;
 
-	roam_blacklist = blacklist_contains_bss(addr,
-					BLACKLIST_REASON_ROAM_REQUESTED);
+	roam_blacklist = blacklist_contains_bss(addr, BLACKLIST_REASON_AP_BUSY);
 	good_signal = signal >= netdev_get_low_signal_threshold(freq);
 
 	if (good_signal)
@@ -3326,7 +3325,7 @@ static void station_ap_directed_roam(struct station *station,
 	}
 
 	blacklist_add_bss(station->connected_bss->addr,
-				BLACKLIST_REASON_ROAM_REQUESTED);
+				BLACKLIST_REASON_AP_BUSY);
 	station_debug_event(station, "ap-roam-blacklist-added");
 
 	/*
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/4 docs: replace/deprecate InitialRoamRequestedTimeout

This is being replaced by InitialAccessPointBusyTimeout but will still be supported until full removal.

---
 src/iwd.config.rst | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
src/iwd.config.rst +14 -4
index 9761e8fd..b54670de 100644
@@ -292,12 +292,22 @@ control how long a misbehaved BSS spends on the blacklist.
 
        The initial time that a BSS spends on the blacklist. Setting this to zero
        will disable blacklisting functionality in IWD.
-   * - InitialRoamRequestedTimeout
+   * - InitialRoamRequestedTimeout (**deprecated**)
      - Values: uint64 value in seconds (default: **30**)
 
-       The initial time that a BSS will be marked after a BSS requests a roam.
-       This is to aid in avoiding roaming back to BSS's which are likely
-       overloaded. Setting this to zero will disabled this form of blacklisting.
+       This setting is deprecated, please use
+       [Blacklist].InitialAccessPointBusyTimeout instead.
+   * - InitialAccessPointBusyTimeout
+     - Values: uint64 value in seconds (default: **30**)
+
+       The initial time that a BSS will be blacklisted after indicating it
+       cannot handle more connections. This is triggered by either a BSS
+       transition management request (telling IWD to roam elsewhere) or by a
+       denied authentication or association with the NO_MORE_STAS status code.
+
+       Once a BSS is blacklisted in this manor IWD will attempt to avoid it for
+       the configured amount of time.
+
    * - Multiplier
      - Values: unsigned int value greater than zero, in seconds
        (default: **30**)
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/4 station: utilize the AP_BUSY blacklist for denied auth/assoc

In reply to James Prestwood

Specifically for the NO_MORE_STAS reason code, add the BSS to the (now renamed) AP_BUSY blacklist to avoid roaming to this BSS for the near future.

Since we are now handling individual reason codes differently the whole IS_TEMPORARY_STATUS macro was removed and replaced with a case statement.

---
 src/station.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
src/station.c +20 -9
index 71f4db99..2b6a18f8 100644
@@ -3522,13 +3522,6 @@ static bool station_pmksa_fallback(struct station *station, uint16_t status)
 	return true;
 }
 
-/* A bit more concise for trying to fit these into 80 characters */
-#define IS_TEMPORARY_STATUS(code) \
-	((code) == MMPDU_STATUS_CODE_DENIED_UNSUFFICIENT_BANDWIDTH || \
-	(code) == MMPDU_STATUS_CODE_DENIED_POOR_CHAN_CONDITIONS || \
-	(code) == MMPDU_STATUS_CODE_REJECTED_WITH_SUGG_BSS_TRANS || \
-	(code) == MMPDU_STATUS_CODE_DENIED_NO_MORE_STAS)
-
 static bool station_retry_with_status(struct station *station,
 					uint16_t status_code)
 {
@@ -3536,19 +3529,37 @@ static bool station_retry_with_status(struct station *station,
 	if (station_pmksa_fallback(station, status_code))
 		goto try_next;
 
+	switch (status_code) {
 	/*
 	 * Certain Auth/Assoc failures should not cause a timeout blacklist.
 	 * In these cases we want to only temporarily blacklist the BSS until
 	 * the connection is complete.
-	 *
+	 */
+	case MMPDU_STATUS_CODE_DENIED_UNSUFFICIENT_BANDWIDTH:
+	case MMPDU_STATUS_CODE_DENIED_POOR_CHAN_CONDITIONS:
+	/*
 	 * TODO: The WITH_SUGG_BSS_TRANS case should also include a neighbor
 	 *       report IE in the frame. This would allow us to target a
 	 *       specific BSS on our next attempt. There is currently no way to
 	 *       obtain that IE, but this should be done in the future.
+	*/
+	case MMPDU_STATUS_CODE_REJECTED_WITH_SUGG_BSS_TRANS:
+		break;
+	/*
+	 * If a BSS is indicating its unable to handle more connections we will
+	 * blacklist this the same way we do for BSS's issuing BSS-TM requests
+	 * thereby avoiding roams to this BSS for the configured timeout.
 	 */
-	if (!IS_TEMPORARY_STATUS(status_code))
+	case MMPDU_STATUS_CODE_DENIED_NO_MORE_STAS:
+		blacklist_add_bss(station->connected_bss->addr,
+					BLACKLIST_REASON_AP_BUSY);
+		break;
+	/* For any other status codes, blacklist the BSS */
+	default:
 		blacklist_add_bss(station->connected_bss->addr,
 					BLACKLIST_REASON_CONNECT_FAILED);
+		break;
+	}
 
 	/*
 	 * Unconditionally network blacklist the BSS if we are retrying. This
Signature · 1 line
2.34.1
#3 lore raw

PATCH 4/4 auto-t: use renamed InitialAccessPointBusyTimeout

In reply to James Prestwood
---
 autotests/testAPRoam/main.conf.roaming | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
autotests/testAPRoam/main.conf.roaming +1 -1
index 1ff23571..49a74685 100644
@@ -3,4 +3,4 @@ RoamThreshold=-72
 CriticalRoamThreshold=-72
 
 [Blacklist]
-InitialRoamRequestedTimeout=20
+InitialAccessPointBusyTimeout=20
Signature · 1 line
2.34.1
#4 lore raw
In reply to James Prestwood

Hi James,

Quoted 13 lines · James Prestwood

The initial pass of this feature only envisioned BSS transition management frames as the trigger to "roam blacklist" a BSS, hence the original name. But some APs actually utilize status codes that also indicate to the stations that they are busy, or not able to handle more connections. This directly aligns with the original motivation of the "roam blacklist" series and these events should also trigger this type of blacklist.

First, since we will be applying this blacklist to cases other than being told to roam, rename this reason code internally to BLACKLIST_REASON_AP_BUSY. The config option is also being renamed to [Blacklist].InitialAccessPointBusyTimeout while also supporting the old config option, but warning that it is deprecated.

Quoted 6 lines
---
  src/blacklist.c | 20 ++++++++++++++------
  src/blacklist.h | 12 +++++++-----
  src/station.c   |  5 ++---
  3 files changed, 23 insertions(+), 14 deletions(-)

All applied, thanks.

Regards,
-Denis