Skip to content

Conversation

@IWDTestBot
Copy link
Owner

In an ideal world userspace should never be getting a channel switch
event unless connected to an AP, but alas this has been seen at least
with ath10k hardware. This causes IWD to crash since the logic
assumes netdev->handshake is set.

src/netdev.c | 3 +++
1 file changed, 3 insertions(+)

jprestwo added 12 commits August 7, 2025 23:01
This is taken care of by the individual cache items and
if none exist, tar fails.
In an ideal world userspace should never be getting a channel switch
event unless connected to an AP, but alas this has been seen at least
with ath10k hardware. This causes IWD to crash since the logic
assumes netdev->handshake is set.
This is the station portion of a 2 part patch (netdev being the
other piece).

After CSA IE parsing was added to the kernel this opened up the
possibility that associations could be rejected locally based on
the contents of this CSA IE in the AP's beacons. Overall, it was
always possible for a local rejection but this case was never
considered by IWD. The CSA-based rejection is something that can
and does happen out in the wild.

When this association rejection happens it desync's IWD and the
kernel's state:

1. IWD begins an FT roam. Authenticates successfully, then proceeds
   to calling netdev_ft_reassociate().
2. Immediately IWD transitions to a ft-roaming state and waits for
   an association response.
3. CMD_ASSOCIATE is rejected by the kernel in the ACK which IWD
   handles by sending a deauthenticate command to the kernel (since
   we have a valid authentication to the new BSS).
4. Due to a bug IWD uses the target BSSID to deauthenticate which
   the kernel rejects since it has no knowledge of this auth. This
   error is not handled or logged.
5. IWD proceeds, assuming its deauthenticated, and transitions to a
   disconnected state. The kernel remains "connected" which of course
   prevents any future connections.

This patch addresses IWD's recovery behavior when the kernel rejects
a CMD_ASSOCIATION (for any reason, not just CSA-rejection)

 - Now IWD will not change state until netdev signals that
   CMD_ASSOCIATE was accepted (in subsequent patch). This signal will
   come via the NETDEV_EVENT_ASSOCIATING event. If this event arrives,
   and IWD is still in a "preparing_roam" state, we can proceed to
   ft-roaming.
 - If station_reassociate_cb() is called with a failure result but
   IWD is still in a "preparing_roam" state the connection to the
   current AP is assumed to be maintained and IWD can proceed to
   trying more BSS's. Otherwise this indicates a failed roam.

Notes:
 - The station_ft_work_ready() callback did need to be reworked to
   keep the target roam_bss in the list when FT-Association is
   started. This required modifying some of the other paths to pop
   and free the roam_bss rather than doing that by default.
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.
@IWDTestBot
Copy link
Owner Author

Fetch PR
Test ID: fetch
Desc: Fetch the PR commits for this CI run
Duration: 3.08 seconds
Result: PASS

Prep - Setup ELL
Test ID: setupell
Desc: Clone, build, and install ELL
Duration: 25.27 seconds
Result: PASS

Make Distcheck
Test ID: makedistcheck
Desc: Run distcheck to check the distribution
Duration: 55.10 seconds
Result: PASS

Build - Configure
Test ID: build
Desc: Configure the BlueZ source tree
Duration: 12.52 seconds
Result: PASS

Make Check
Test ID: makecheck
Desc: Run 'make check'
Duration: 1.56 seconds
Result: PASS

Make Check w/Valgrind
Test ID: makecheckvalgrind
Desc: Run 'make check' with Valgrind
Duration: 103.03 seconds
Result: PASS

Incremental Build with patches
Test ID: incremental_build
Desc: Incremental build per patch in the series
Duration: 184.98 seconds
Result: PASS

@IWDTestBot
Copy link
Owner Author

Fetch PR
Test ID: fetch
Desc: Fetch the PR commits for this CI run
Duration: 2.38 seconds
Result: PASS

GitLint
Test ID: gitlint
Desc: Run gitlint with rule in .gitlint
Duration: 2.72 seconds
Result: PASS

Prep - Setup ELL
Test ID: setupell
Desc: Clone, build, and install ELL
Duration: 29.84 seconds
Result: PASS

Make Distcheck
Test ID: makedistcheck
Desc: Run distcheck to check the distribution
Duration: 37.76 seconds
Result: PASS

Build - Configure
Test ID: build
Desc: Configure the BlueZ source tree
Duration: 21.99 seconds
Result: PASS

Make Check
Test ID: makecheck
Desc: Run 'make check'
Duration: 5.22 seconds
Result: PASS

Make Check w/Valgrind
Test ID: makecheckvalgrind
Desc: Run 'make check' with Valgrind
Duration: 119.77 seconds
Result: PASS

Incremental Build with patches
Test ID: incremental_build
Desc: Incremental build per patch in the series
Duration: 228.58 seconds
Result: PASS

Autotest Runner
Test ID: testrunner
Desc: Runs IWD's autotest framework
Duration: 1868.59 seconds
Result: PASS

Clang Build
Test ID: clang
Desc: Build IWD using clang compiler
Duration: 122.68 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants