station: update logic for handshake failure

After adding the NETDEV_RESULT_DISCONNECTED enum, handshake failures
initiated by the AP come in via this result so the existing logic
to call network_connect_failed() was broken. We could still get a
handshake failure generated internally, so that has been preserved
(via NETDEV_RESULT_HANDSHAKE_FAILED) but a check for a 4-way
handshake timeout reason code was also added.
This commit is contained in:
James Prestwood 2024-07-18 04:45:07 -07:00 committed by Denis Kenzior
parent 906afefbf3
commit 22f238706c
1 changed files with 7 additions and 1 deletions

View File

@ -3368,7 +3368,13 @@ static void station_connect_cb(struct netdev *netdev, enum netdev_result result,
continue_autoconnect = station->state == STATION_STATE_CONNECTING_AUTO;
if (station->state == STATION_STATE_CONNECTING) {
bool during_eapol = result == NETDEV_RESULT_HANDSHAKE_FAILED;
/*
* Either a handshake failure (generated internally) or a 4-way
* handshake timeout should trigger the PSK to be asked for
* again. Set during_eapol accordingly.
*/
bool during_eapol = result == NETDEV_RESULT_HANDSHAKE_FAILED ||
reason == MMPDU_REASON_CODE_4WAY_HANDSHAKE_TIMEOUT;
network_connect_failed(station->connected_network,
during_eapol);
}