From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v4 08/11] station: roam blacklist AP even mid-roam
Date: Fri, 28 Mar 2025 07:42:50 -0700 [thread overview]
Message-ID: <20250328144253.421425-8-prestwoj@gmail.com> (raw)
In-Reply-To: <20250328144253.421425-1-prestwoj@gmail.com>
If an AP directed roam frame comes in while IWD is roaming its
still valuable to parse that frame and blacklist the BSS that
sent it.
This can happen most frequently during a roam scan while connected
to an overloaded BSS that is requesting IWD roams elsewhere.
---
src/station.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/station.c b/src/station.c
index 623cfdca..c5529842 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3225,12 +3225,10 @@ static void station_ap_directed_roam(struct station *station,
uint8_t req_mode;
uint16_t dtimer;
uint8_t valid_interval;
+ bool can_roam = !station_cannot_roam(station);
l_debug("ifindex: %u", netdev_get_ifindex(station->netdev));
- if (station_cannot_roam(station))
- return;
-
if (station->state != STATION_STATE_CONNECTED) {
l_debug("roam: unexpected AP directed roam -- ignore");
return;
@@ -3294,8 +3292,13 @@ static void station_ap_directed_roam(struct station *station,
* disassociating us. If either of these bits are set, set the
* ap_directed_roaming flag. Otherwise still try roaming but don't
* treat it any different than a normal roam.
+ *
+ * The only exception here is if we are in the middle of roaming
+ * (can_roam == false) since we cannot reliably know if the roam scan
+ * included frequencies from potential candidates in this request,
+ * forcing a roam in this case might result in unintended behavior.
*/
- if (req_mode & (WNM_REQUEST_MODE_DISASSOCIATION_IMMINENT |
+ if (can_roam && req_mode & (WNM_REQUEST_MODE_DISASSOCIATION_IMMINENT |
WNM_REQUEST_MODE_TERMINATION_IMMINENT |
WNM_REQUEST_MODE_ESS_DISASSOCIATION_IMMINENT))
station->ap_directed_roaming = true;
@@ -3322,15 +3325,24 @@ static void station_ap_directed_roam(struct station *station,
pos += url_len;
}
+ blacklist_add_bss(station->connected_bss->addr,
+ BLACKLIST_REASON_ROAM_REQUESTED);
+ station_debug_event(station, "ap-roam-blacklist-added");
+
+ /*
+ * Validating the frame and blacklisting should still be done even if
+ * we are mid-roam. Its important to track the BSS requesting the
+ * transition so when the current roam completes IWD will be less likely
+ * to roam back to the current BSS.
+ */
+ if (!can_roam)
+ return;
+
station->preparing_roam = true;
l_timeout_remove(station->roam_trigger_timeout);
station->roam_trigger_timeout = NULL;
- blacklist_add_bss(station->connected_bss->addr,
- BLACKLIST_REASON_ROAM_REQUESTED);
- station_debug_event(station, "ap-roam-blacklist-added");
-
if (req_mode & WNM_REQUEST_MODE_PREFERRED_CANDIDATE_LIST) {
l_debug("roam: AP sent a preferred candidate list");
station_neighbor_report_cb(station->netdev, 0, body + pos,
--
2.34.1
next prev parent reply other threads:[~2025-03-28 14:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 14:42 [PATCH v4 01/11] station: always add BSS to network blacklist on failure James Prestwood
2025-03-28 14:42 ` [PATCH v4 02/11] auto-t: add test for disabling the timeout blacklist James Prestwood
2025-03-28 14:42 ` [PATCH v4 03/11] blacklist: include a blacklist reason when adding/finding James Prestwood
2025-03-28 14:42 ` [PATCH v4 04/11] blacklist: fix pruning to remove the entry if its expired James Prestwood
2025-03-28 14:42 ` [PATCH v4 05/11] blacklist: add new blacklist reason, ROAM_REQUESTED James Prestwood
2025-03-28 14:42 ` [PATCH v4 06/11] netdev: add netdev_get_low_signal_threshold James Prestwood
2025-03-28 14:42 ` [PATCH v4 07/11] station: roam blacklist BSS's, and consider when roaming James Prestwood
2025-04-01 16:08 ` Denis Kenzior
2025-03-28 14:42 ` James Prestwood [this message]
2025-03-28 14:42 ` [PATCH v4 09/11] auto-t: add tests for AP roam blacklisting James Prestwood
2025-03-28 14:42 ` [PATCH v4 10/11] doc: document InitialRoamRequestedTimeout James Prestwood
2025-03-28 14:42 ` [PATCH v4 11/11] netdev: fix invalid read after netdev_free 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=20250328144253.421425-8-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