DPP3: Do not initiate PKEX for PB if no configuration is available

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>
This commit is contained in:
Jouni Malinen 2022-08-27 00:50:05 +03:00 committed by Jouni Malinen
parent aa75aa1dc0
commit 1f9a988f1f

View 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;
}