]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Clear wpa_s->p2p2 for NFC cases
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 20 Nov 2024 11:11:45 +0000 (13:11 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 20 Nov 2024 11:11:45 +0000 (13:11 +0200)
wpa_s->p2p2 is used to track whether a new P2P connection is using P2P2.
However, it was not cleared in some cases and that could result in
unexpected behavior and failures, e.g., with NFC-initiated P2P.

Clear wpa_s->p2p2 for the operations that start NFC-based P2P
connection. In addition, clear it on the FLUSH control interface
command.

This showed up with the following test case sequence:
p2p_pairing_opportunistic nfc_p2p_static_handover_tagdev_client

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/p2p_supplicant.c

index 87da9636f8f8e5bd90f83a83172fc5013483cdbf..cfb51ca9f9edb5b097c0f15580f034378f8367cd 100644 (file)
@@ -7773,6 +7773,8 @@ static void p2p_ctrl_flush(struct wpa_supplicant *wpa_s)
        wpa_s->parent->p2ps_method_config_any = 0;
        if (wpa_s->global->p2p)
                p2p_flush(wpa_s->global->p2p);
+
+       wpa_s->p2p2 = false;
 }
 
 
index 7f89cdb7516364913f1dc822a72ab4c901ca2693..71c510f75b95a6734bde97f04363a62c204c78e6 100644 (file)
@@ -10157,6 +10157,8 @@ struct wpabuf * wpas_p2p_nfc_handover_req(struct wpa_supplicant *wpa_s,
                return NULL;
        }
 
+       wpa_s->p2p2 = false;
+
        if (cli_freq == 0) {
                wsc = wps_build_nfc_handover_req_p2p(
                        wpa_s->parent->wps, wpa_s->conf->wps_nfc_dh_pubkey);
@@ -10186,6 +10188,8 @@ struct wpabuf * wpas_p2p_nfc_handover_sel(struct wpa_supplicant *wpa_s,
                           &wpa_s->conf->wps_nfc_dh_privkey) < 0)
                return NULL;
 
+       wpa_s->p2p2 = false;
+
        if (cli_freq == 0) {
                wsc = wps_build_nfc_handover_sel_p2p(
                        wpa_s->parent->wps,
@@ -10454,6 +10458,8 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
                  params.oob_dev_pw, WPS_OOB_PUBKEY_HASH_LEN);
        wpa_s->p2p_peer_oob_pk_hash_known = 1;
 
+       wpa_s->p2p2 = false;
+
        if (tag) {
                if (id < 0x10) {
                        wpa_printf(MSG_DEBUG, "P2P: Static handover - invalid "