From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 3/3] netdev: handle local CMD_ASSOCIATE failures (for FT)
Date: Fri, 15 Aug 2025 08:26:04 -0700 [thread overview]
Message-ID: <20250815152604.175977-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20250815152604.175977-1-prestwoj@gmail.com>
The issue surrounding this was described in detail in the previous
patch. The netdev piece simple and does two things:
1. Don't deauthenticate and fail the connection if the CMD_ASSOCIATE
ACK comes back with a failure. A local rejection like this should
not change the kernels internal state, so we can recover. In this
case call the connect callback directly with a failure which
station will handle.
2. Upon a successful CMD_ASSOCIATE ACK, signal
NETDEV_EVENT_ASSOCIATING to let station know. This did require
modifying the netdev_associate_event() to not duplicate event
calls, specifically when FT is being used.
---
src/netdev.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index ca8bfea0..e45423be 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -2993,15 +2993,32 @@ static void netdev_cmd_ft_reassociate_cb(struct l_genl_msg *msg,
void *user_data)
{
struct netdev *netdev = user_data;
+ int err = l_genl_msg_get_error(msg);
netdev->connect_cmd_id = 0;
- if (l_genl_msg_get_error(msg) >= 0)
+ /*
+ * If CMD_ASSOCIATE was accepted we're committed to association and
+ * can no longer go back. Signal this to station so the state can
+ * transition to ft-roaming.
+ */
+ if (err >= 0) {
+ if (netdev->event_filter)
+ netdev->event_filter(netdev, NETDEV_EVENT_ASSOCIATING,
+ NULL, netdev->user_data);
return;
+ }
- netdev_deauth_and_fail_connection(netdev,
- NETDEV_RESULT_ASSOCIATION_FAILED,
- MMPDU_STATUS_CODE_UNSPECIFIED);
+ l_debug("failed FT reassocaition (%d)", err);
+
+ /*
+ * A failed ACK should not have changed the kernel's state. This means
+ * we should still be connected to the current AP and can proceed to
+ * trying more BSS's.
+ */
+
+ netdev->connect_cb(netdev, NETDEV_RESULT_ASSOCIATION_FAILED, NULL,
+ netdev->user_data);
}
static bool kernel_will_retry_auth(uint16_t status_code,
@@ -3185,7 +3202,12 @@ static void netdev_associate_event(struct l_genl_msg *msg,
if (!netdev->connected || netdev->aborting)
return;
- if (netdev->event_filter)
+ /*
+ * For FT this event is sent in the CMD_ASSOCIATE ack to indicate
+ * association was successfully started in the kernel, don't duplicate
+ * and send here too.
+ */
+ if (!netdev->in_ft && netdev->event_filter)
netdev->event_filter(netdev, NETDEV_EVENT_ASSOCIATING,
NULL, netdev->user_data);
--
2.34.1
prev parent reply other threads:[~2025-08-15 15:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 15:26 [PATCH 1/3] netdev: check connected in channel switch event James Prestwood
2025-08-15 15:26 ` [PATCH 2/3] station: transition to ft-roaming on NETDEV_EVENT_ASSOCIATING James Prestwood
2025-08-15 15:26 ` James Prestwood [this message]
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=20250815152604.175977-3-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