Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 01/13] station: always network (temp) blacklist on failure
Date: Mon, 24 Mar 2025 07:15:26 -0700	[thread overview]
Message-ID: <20250324141538.144578-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20250324141538.144578-1-prestwoj@gmail.com>

Allowing the timeout blacklist to be disabled has introduced a bug
where a failed connection will not result in the BSS list to be
traversed. This causes IWD to retry the same BSS over and over which
be either a) have some issue preventing a connection or b) may simply
be unreachable/out of range.

This is because IWD was inherently relying on the timeout blacklist
to flag BSS's on failures. With it disabled there was nothing to tell
network_bss_select that we should skip the BSS and it would return
the same BSS indefinitely.

To fix this some of the blacklisting logic was re-worked in station.
Now, a BSS will always get network blacklisted upon a failure. This
allows network.c to traverse to the next BSS upon failure.

For auth/assoc failures we will then only timeout blacklist under
certain conditions, i.e. the status code was not in the temporary
list.

Fixes: 77639d2d452e ("blacklist: allow configuration to disable the blacklist")
---
 src/station.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/station.c b/src/station.c
index 5403c332..0b20e785 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3402,6 +3402,13 @@ static bool station_retry_with_reason(struct station *station,
 
 	blacklist_add_bss(station->connected_bss->addr);
 
+	/*
+	 * Network blacklist the BSS as well, since the timeout blacklist could
+	 * be disabled
+	 */
+	network_blacklist_add(station->connected_network,
+				station->connected_bss);
+
 try_next:
 	return station_try_next_bss(station);
 }
@@ -3449,6 +3456,10 @@ static bool station_pmksa_fallback(struct station *station, uint16_t status)
 static bool station_retry_with_status(struct station *station,
 					uint16_t status_code)
 {
+	/* If PMKSA failed don't blacklist so we can retry this BSS */
+	if (station_pmksa_fallback(station, status_code))
+		goto try_next;
+
 	/*
 	 * Certain Auth/Assoc failures should not cause a timeout blacklist.
 	 * In these cases we want to only temporarily blacklist the BSS until
@@ -3459,12 +3470,18 @@ static bool station_retry_with_status(struct station *station,
 	 *       specific BSS on our next attempt. There is currently no way to
 	 *       obtain that IE, but this should be done in the future.
 	 */
-	if (IS_TEMPORARY_STATUS(status_code))
-		network_blacklist_add(station->connected_network,
-						station->connected_bss);
-	else if (!station_pmksa_fallback(station, status_code))
+	if (!IS_TEMPORARY_STATUS(status_code))
 		blacklist_add_bss(station->connected_bss->addr);
 
+	/*
+	 * Unconditionally network blacklist the BSS if we are retrying. This
+	 * will allow network_bss_select to traverse the BSS list and ignore
+	 * BSS's which have previously failed
+	 */
+	network_blacklist_add(station->connected_network,
+				station->connected_bss);
+
+try_next:
 	iwd_notice(IWD_NOTICE_CONNECT_FAILED, "status: %u", status_code);
 
 	return station_try_next_bss(station);
-- 
2.34.1


  reply	other threads:[~2025-03-24 14:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 14:15 [PATCH v2 00/13] Roam blacklisting and scan BSS groups James Prestwood
2025-03-24 14:15 ` James Prestwood [this message]
2025-03-24 14:15 ` [PATCH v2 02/13] auto-t: add test for disabling the timeout blacklist James Prestwood
2025-03-24 14:15 ` [PATCH v2 03/13] blacklist: include a blacklist reason when adding/finding James Prestwood
2025-03-24 14:15 ` [PATCH v2 04/13] blacklist: fix pruning to remove the entry if its expired James Prestwood
2025-03-24 14:15 ` [PATCH v2 05/13] blacklist: add BLACKLIST_REASON_TRANSIENT_ERROR James Prestwood
2025-03-24 14:15 ` [PATCH v2 06/13] network: update to use blacklist's new temporary type James Prestwood
2025-03-24 14:15 ` [PATCH v2 07/13] blacklist: add new blacklist reason, ROAM_REQUESTED James Prestwood
2025-03-24 14:15 ` [PATCH v2 08/13] scan: Introduce higher level scan BSS groups James Prestwood
2025-03-24 14:15 ` [PATCH v2 09/13] station: roam blacklist BSS when a roam is requested James Prestwood
2025-03-24 14:15 ` [PATCH v2 10/13] station: roam blacklist AP even mid-roam James Prestwood
2025-03-24 14:15 ` [PATCH v2 11/13] station: adapt roam scan logic to look at the bss group James Prestwood
2025-03-24 14:15 ` [PATCH v2 12/13] auto-t: add tests for AP roam blacklisting James Prestwood
2025-03-24 14:15 ` [PATCH v2 13/13] doc: document OptimalSignalThreshold and InitialRoamRequestedTimeout James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250324141538.144578-2-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox