Subject: [PATCH 1/1] STA_ASSOC: Mark Port authorization and State Completion based on authorized state in connect event

Vinayak Yadawad vinayak.yadawad at broadcom.com
Sun Jun 19 23:48:23 PDT 2022


PFA  patch for reference generated using the git repo

On Mon, Jun 20, 2022 at 11:26 AM Vinayak Yadawad
<vinayak.yadawad at broadcom.com> wrote:
>
> In case of drivers supporting 4way handshake offload, mark port
> authorized and state completion only if driver advertizes authorized
> state in the connect event. Otherwise there are fair chances of driver
> port authorization api gets called while 4-way handshake is in progress
> at the lower layer.
> In order to avoid this possible race condition always update port
> authorization and supplicant state WPA_COMPLETED setting from
> EVENT_PORT_AUTHORIZED context when driver is done with 4way handshake.
>
> Signed-off-by: Vinayak Yadawad <vinayak.yadawad at broadcom.com>
> ---
>  wpa_supplicant/events.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> index ec56cfdc0..f20e1c87b 100644
> --- a/wpa_supplicant/events.c
> +++ b/wpa_supplicant/events.c
> @@ -3478,14 +3478,23 @@ static void wpa_supplicant_event_assoc(struct
> wpa_supplicant *wpa_s,
>   eapol_sm_notify_eap_success(wpa_s->eapol, true);
>   } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK) &&
>      wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
> - /*
> - * We are done; the driver will take care of RSN 4-way
> - * handshake.
> - */
> - wpa_supplicant_cancel_auth_timeout(wpa_s);
> - wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
> - eapol_sm_notify_portValid(wpa_s->eapol, true);
> - eapol_sm_notify_eap_success(wpa_s->eapol, true);
> + if (already_authorized) {
> + /*
> + * We are done; the driver will take care of RSN 4-way
> + * handshake.
> + */
> + wpa_supplicant_cancel_auth_timeout(wpa_s);
> + wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
> + eapol_sm_notify_portValid(wpa_s->eapol, true);
> + eapol_sm_notify_eap_success(wpa_s->eapol, true);
> + } else {
> + /* Update port, WPA_COMPLETED state from
> + * EVENT_PORT_AUTHORIZED context when driver is done
> + * with 4way handshake.
> + */
> + wpa_msg(wpa_s, MSG_INFO, "ASSOC INFO: wait for driver port "
> + "authorized indication");
> + }
>   } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X) &&
>      wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) {
>   /*
> --
> 2.32.0

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-STA_ASSOC-Mark-Port-authorization-and-State-Completi.patch
Type: application/octet-stream
Size: 2482 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20220620/7145c02b/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4218 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20220620/7145c02b/attachment-0001.p7s>


More information about the Hostap mailing list