]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP3: Do not initiate PKEX for PB if no configuration is available
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 26 Aug 2022 21:50:05 +0000 (00:50 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 26 Aug 2022 21:50:05 +0000 (00:50 +0300)
Reorder PKEX initiation function to send out the PKEX Exchange Request
frame at the end after all possible error cases have been checked. This
prevents Enrollee from seeing a PKEX frame when the session is about to
fail.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/ap/dpp_hostapd.c

index 232b5fbbc1e0999406619802bb51bb7f1895b975..32ddb3b21a7f8e133de1b83d2986b83fe3044508 100644 (file)
@@ -2439,13 +2439,6 @@ static void hostapd_dpp_pb_pkex_init(struct hostapd_data *hapd,
 
        hapd->dpp_pkex = pkex;
        msg = hapd->dpp_pkex->exchange_req;
-       wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-               " freq=%u type=%d", MAC2STR(src), freq,
-               DPP_PA_PKEX_EXCHANGE_REQ);
-       hostapd_drv_send_action(hapd, pkex->freq, 0, src,
-                               wpabuf_head(msg), wpabuf_len(msg));
-       pkex->exch_req_wait_time = 2000;
-       pkex->exch_req_tries = 1;
 
        if (ifaces->dpp_pb_cmd) {
                /* Use the externally provided configuration */
@@ -2458,7 +2451,7 @@ static void hostapd_dpp_pb_pkex_init(struct hostapd_data *hapd,
                }
                os_snprintf(hapd->dpp_pkex_auth_cmd, len, " own=%d %s",
                            hapd->dpp_pkex_bi->id, ifaces->dpp_pb_cmd);
-               return;
+               goto send_frame;
        }
 
        /* Build config based on the current AP configuration */
@@ -2545,6 +2538,15 @@ static void hostapd_dpp_pb_pkex_init(struct hostapd_data *hapd,
                hostapd_dpp_push_button_stop(hapd);
                return;
        }
+
+send_frame:
+       wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
+               " freq=%u type=%d", MAC2STR(src), freq,
+               DPP_PA_PKEX_EXCHANGE_REQ);
+       hostapd_drv_send_action(hapd, pkex->freq, 0, src,
+                               wpabuf_head(msg), wpabuf_len(msg));
+       pkex->exch_req_wait_time = 2000;
+       pkex->exch_req_tries = 1;
 }