Lines Matching refs:hapd

31 static void hostapd_dpp_auth_success(struct hostapd_data *hapd, int initiator);
33 static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd);
34 static void hostapd_dpp_set_testing_options(struct hostapd_data *hapd,
36 static void hostapd_dpp_start_gas_client(struct hostapd_data *hapd);
40 static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd,
56 int hostapd_dpp_qr_code(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_qr_code() argument
59 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_qr_code()
61 bi = dpp_add_qr_code(hapd->iface->interfaces->dpp, cmd); in hostapd_dpp_qr_code()
69 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_qr_code()
73 hostapd_drv_send_action(hapd, auth->curr_freq, 0, in hostapd_dpp_qr_code()
75 wpabuf_head(hapd->dpp_auth->resp_msg), in hostapd_dpp_qr_code()
76 wpabuf_len(hapd->dpp_auth->resp_msg)); in hostapd_dpp_qr_code()
80 dpp_controller_new_qr_code(hapd->iface->interfaces->dpp, bi); in hostapd_dpp_qr_code()
93 int hostapd_dpp_nfc_uri(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_nfc_uri() argument
97 bi = dpp_add_nfc_uri(hapd->iface->interfaces->dpp, cmd); in hostapd_dpp_nfc_uri()
105 int hostapd_dpp_nfc_handover_req(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_nfc_handover_req() argument
114 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_nfc_handover_req()
122 peer_bi = dpp_add_nfc_uri(hapd->iface->interfaces->dpp, pos); in hostapd_dpp_nfc_handover_req()
136 int hostapd_dpp_nfc_handover_sel(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_nfc_handover_sel() argument
145 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_nfc_handover_sel()
153 peer_bi = dpp_add_nfc_uri(hapd->iface->interfaces->dpp, pos); in hostapd_dpp_nfc_handover_sel()
173 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_auth_resp_retry_timeout() local
174 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_resp_retry_timeout()
181 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_auth_resp_retry_timeout()
185 hostapd_drv_send_action(hapd, auth->curr_freq, 500, auth->peer_mac_addr, in hostapd_dpp_auth_resp_retry_timeout()
191 static void hostapd_dpp_auth_resp_retry(struct hostapd_data *hapd) in hostapd_dpp_auth_resp_retry() argument
193 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_resp_retry()
199 if (hapd->dpp_resp_max_tries) in hostapd_dpp_auth_resp_retry()
200 max_tries = hapd->dpp_resp_max_tries; in hostapd_dpp_auth_resp_retry()
207 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_resp_retry()
208 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_resp_retry()
209 hapd->dpp_auth = NULL; in hostapd_dpp_auth_resp_retry()
213 if (hapd->dpp_resp_retry_time) in hostapd_dpp_auth_resp_retry()
214 wait_time = hapd->dpp_resp_retry_time; in hostapd_dpp_auth_resp_retry()
220 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_auth_resp_retry()
223 hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_auth_resp_retry()
227 static int hostapd_dpp_allow_ir(struct hostapd_data *hapd, unsigned int freq) in hostapd_dpp_allow_ir() argument
231 if (!hapd->iface->hw_features) in hostapd_dpp_allow_ir()
234 for (i = 0; i < hapd->iface->num_hw_features; i++) { in hostapd_dpp_allow_ir()
235 struct hostapd_hw_modes *mode = &hapd->iface->hw_features[i]; in hostapd_dpp_allow_ir()
260 static int hostapd_dpp_pkex_next_channel(struct hostapd_data *hapd, in hostapd_dpp_pkex_next_channel() argument
272 if (hostapd_dpp_allow_ir(hapd, pkex->freq) == 1) { in hostapd_dpp_pkex_next_channel()
279 return hostapd_dpp_pkex_next_channel(hapd, pkex); in hostapd_dpp_pkex_next_channel()
283 static void hostapd_dpp_pkex_clear_code(struct hostapd_data *hapd) in hostapd_dpp_pkex_clear_code() argument
285 if (!hapd->dpp_pkex_code && !hapd->dpp_pkex_identifier) in hostapd_dpp_pkex_clear_code()
292 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_clear_code()
293 hapd->dpp_pkex_code = NULL; in hostapd_dpp_pkex_clear_code()
294 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_clear_code()
295 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_clear_code()
303 struct hostapd_data *hapd = ctx; in hostapd_dpp_pkex_done() local
310 hostapd_dpp_pkex_clear_code(hapd); in hostapd_dpp_pkex_done()
313 hapd->dpp_pkex_auth_cmd ? hapd->dpp_pkex_auth_cmd : ""); in hostapd_dpp_pkex_done()
320 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, in hostapd_dpp_pkex_done()
350 auth = dpp_auth_init(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_pkex_done()
352 hapd->iface->hw_features, in hostapd_dpp_pkex_done()
353 hapd->iface->num_hw_features); in hostapd_dpp_pkex_done()
357 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_pkex_done()
363 return dpp_tcp_auth(hapd->iface->interfaces->dpp, conn, auth, in hostapd_dpp_pkex_done()
364 hapd->conf->dpp_name, DPP_NETROLE_AP, in hostapd_dpp_pkex_done()
365 hapd->conf->dpp_mud_url, in hostapd_dpp_pkex_done()
366 hapd->conf->dpp_extra_conf_req_name, in hostapd_dpp_pkex_done()
367 hapd->conf->dpp_extra_conf_req_value, in hostapd_dpp_pkex_done()
373 static int hostapd_dpp_pkex_init(struct hostapd_data *hapd, in hostapd_dpp_pkex_init() argument
384 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_pkex_init()
385 hapd->dpp_pkex = NULL; in hostapd_dpp_pkex_init()
386 pkex = dpp_pkex_init(hapd->msg_ctx, hapd->dpp_pkex_bi, hapd->own_addr, in hostapd_dpp_pkex_init()
387 hapd->dpp_pkex_identifier, in hostapd_dpp_pkex_init()
388 hapd->dpp_pkex_code, hapd->dpp_pkex_code_len, v2); in hostapd_dpp_pkex_init()
395 return dpp_tcp_pkex_init(hapd->iface->interfaces->dpp, pkex, in hostapd_dpp_pkex_init()
397 hapd->msg_ctx, hapd, in hostapd_dpp_pkex_init()
404 hapd->dpp_pkex = pkex; in hostapd_dpp_pkex_init()
405 msg = hapd->dpp_pkex->exchange_req; in hostapd_dpp_pkex_init()
408 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_pkex_init()
412 hostapd_drv_send_action(hapd, pkex->freq, 0, broadcast, in hostapd_dpp_pkex_init()
423 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_pkex_retry_timeout() local
424 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_pkex_retry_timeout()
429 if (hostapd_dpp_pkex_next_channel(hapd, pkex) < 0) { in hostapd_dpp_pkex_retry_timeout()
434 hostapd_dpp_pkex_init(hapd, PKEX_VER_ONLY_1, in hostapd_dpp_pkex_retry_timeout()
439 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_pkex_retry_timeout()
442 hapd->dpp_pkex = NULL; in hostapd_dpp_pkex_retry_timeout()
451 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_pkex_retry_timeout()
456 hostapd_drv_send_action(hapd, pkex->freq, pkex->exch_req_wait_time, in hostapd_dpp_pkex_retry_timeout()
463 static void hostapd_dpp_pkex_tx_status(struct hostapd_data *hapd, const u8 *dst, in hostapd_dpp_pkex_tx_status() argument
466 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_pkex_tx_status()
474 hapd->dpp_pkex = NULL; in hostapd_dpp_pkex_tx_status()
481 eloop_cancel_timeout(hostapd_dpp_pkex_retry_timeout, hapd, in hostapd_dpp_pkex_tx_status()
485 hostapd_dpp_pkex_retry_timeout, hapd, in hostapd_dpp_pkex_tx_status()
491 void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst, in hostapd_dpp_tx_status() argument
494 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_tx_status()
498 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR in hostapd_dpp_tx_status()
501 if (!hapd->dpp_auth) { in hostapd_dpp_tx_status()
502 if (hapd->dpp_pkex) { in hostapd_dpp_tx_status()
503 hostapd_dpp_pkex_tx_status(hapd, dst, data, data_len, in hostapd_dpp_tx_status()
516 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_tx_status()
517 hapd->dpp_auth = NULL; in hostapd_dpp_tx_status()
522 if (hapd->dpp_auth->remove_on_tx_status) { in hostapd_dpp_tx_status()
525 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_tx_status()
527 hapd, NULL); in hostapd_dpp_tx_status()
529 hapd, NULL); in hostapd_dpp_tx_status()
530 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, in hostapd_dpp_tx_status()
534 hapd, NULL); in hostapd_dpp_tx_status()
536 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
537 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_tx_status()
538 hapd->dpp_auth = NULL; in hostapd_dpp_tx_status()
542 if (hapd->dpp_auth_ok_on_ack) { in hostapd_dpp_tx_status()
543 hostapd_dpp_auth_success(hapd, 1); in hostapd_dpp_tx_status()
544 if (!hapd->dpp_auth) { in hostapd_dpp_tx_status()
558 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
559 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_tx_status()
563 hostapd_dpp_auth_resp_retry(hapd); in hostapd_dpp_tx_status()
573 eloop_cancel_timeout(hostapd_dpp_auth_conf_wait_timeout, hapd, in hostapd_dpp_tx_status()
576 hapd, NULL); in hostapd_dpp_tx_status()
585 if (!hapd->dpp_auth_ok_on_ack && hapd->dpp_auth->neg_freq > 0 && in hostapd_dpp_tx_status()
586 hapd->dpp_auth->curr_freq != hapd->dpp_auth->neg_freq) { in hostapd_dpp_tx_status()
589 hapd->dpp_auth->curr_freq, in hostapd_dpp_tx_status()
590 hapd->dpp_auth->neg_freq); in hostapd_dpp_tx_status()
591 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
593 if (hapd->dpp_auth->neg_freq != in hostapd_dpp_tx_status()
594 (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_tx_status()
598 hapd->dpp_auth->neg_freq, hapd->iface->freq); in hostapd_dpp_tx_status()
602 if (hapd->dpp_auth_ok_on_ack) in hostapd_dpp_tx_status()
603 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_tx_status()
609 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_reply_wait_timeout() local
610 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_reply_wait_timeout()
618 wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_reply_wait_timeout()
619 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_reply_wait_timeout()
621 os_reltime_sub(&now, &hapd->dpp_last_init, &diff); in hostapd_dpp_reply_wait_timeout()
632 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_AUTH_INIT_FAILED); in hostapd_dpp_reply_wait_timeout()
633 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_reply_wait_timeout()
634 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reply_wait_timeout()
636 hapd->dpp_auth = NULL; in hostapd_dpp_reply_wait_timeout()
645 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_reply_wait_timeout()
646 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reply_wait_timeout()
647 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_reply_wait_timeout()
665 hapd->dpp_in_response_listen = 1; in hostapd_dpp_reply_wait_timeout()
667 if (freq != (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_reply_wait_timeout()
671 freq, hapd->iface->freq); in hostapd_dpp_reply_wait_timeout()
675 hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_reply_wait_timeout()
682 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_auth_conf_wait_timeout() local
683 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_conf_wait_timeout()
690 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_auth_conf_wait_timeout()
692 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_conf_wait_timeout()
694 hapd->dpp_auth = NULL; in hostapd_dpp_auth_conf_wait_timeout()
698 static void hostapd_dpp_set_testing_options(struct hostapd_data *hapd, in hostapd_dpp_set_testing_options() argument
702 if (hapd->dpp_config_obj_override) in hostapd_dpp_set_testing_options()
704 os_strdup(hapd->dpp_config_obj_override); in hostapd_dpp_set_testing_options()
705 if (hapd->dpp_discovery_override) in hostapd_dpp_set_testing_options()
707 os_strdup(hapd->dpp_discovery_override); in hostapd_dpp_set_testing_options()
708 if (hapd->dpp_groups_override) in hostapd_dpp_set_testing_options()
709 auth->groups_override = os_strdup(hapd->dpp_groups_override); in hostapd_dpp_set_testing_options()
711 hapd->dpp_ignore_netaccesskey_mismatch; in hostapd_dpp_set_testing_options()
718 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_init_timeout() local
720 if (!hapd->dpp_auth) in hostapd_dpp_init_timeout()
723 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_init_timeout()
727 static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd) in hostapd_dpp_auth_init_next() argument
729 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_init_next()
738 os_get_reltime(&hapd->dpp_init_iter_start); in hostapd_dpp_auth_init_next()
742 if (hapd->dpp_init_max_tries) in hostapd_dpp_auth_init_next()
743 max_tries = hapd->dpp_init_max_tries; in hostapd_dpp_auth_init_next()
749 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_auth_init_next()
752 hapd, NULL); in hostapd_dpp_auth_init_next()
753 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_init_next()
754 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init_next()
755 hapd->dpp_auth = NULL; in hostapd_dpp_auth_init_next()
759 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
760 if (hapd->dpp_init_retry_time) in hostapd_dpp_auth_init_next()
761 wait_time = hapd->dpp_init_retry_time; in hostapd_dpp_auth_init_next()
765 os_reltime_sub(&now, &hapd->dpp_init_iter_start, &diff); in hostapd_dpp_auth_init_next()
775 hostapd_dpp_init_timeout, hapd, in hostapd_dpp_auth_init_next()
788 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_auth_init_next()
789 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
791 max_wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_auth_init_next()
792 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_auth_init_next()
797 hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
804 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_auth_init_next()
808 os_get_reltime(&hapd->dpp_last_init); in hostapd_dpp_auth_init_next()
809 return hostapd_drv_send_action(hapd, freq, wait_time, in hostapd_dpp_auth_init_next()
811 wpabuf_head(hapd->dpp_auth->req_msg), in hostapd_dpp_auth_init_next()
812 wpabuf_len(hapd->dpp_auth->req_msg)); in hostapd_dpp_auth_init_next()
820 struct hostapd_data *hapd = ctx; in hostapd_dpp_process_conf_obj() local
824 hostapd_dpp_handle_config_obj(hapd, auth, in hostapd_dpp_process_conf_obj()
832 int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_auth_init() argument
850 peer_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_auth_init()
889 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, in hostapd_dpp_auth_init()
923 if (!tcp && hapd->dpp_auth) { in hostapd_dpp_auth_init()
924 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_auth_init()
926 hapd, NULL); in hostapd_dpp_auth_init()
928 hapd, NULL); in hostapd_dpp_auth_init()
929 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, in hostapd_dpp_auth_init()
933 hapd, NULL); in hostapd_dpp_auth_init()
935 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_init()
936 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init()
939 auth = dpp_auth_init(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_auth_init()
941 hapd->iface->hw_features, in hostapd_dpp_auth_init()
942 hapd->iface->num_hw_features); in hostapd_dpp_auth_init()
945 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_auth_init()
958 return dpp_tcp_init(hapd->iface->interfaces->dpp, auth, in hostapd_dpp_auth_init()
959 &ipaddr, tcp_port, hapd->conf->dpp_name, in hostapd_dpp_auth_init()
960 DPP_NETROLE_AP, hapd->conf->dpp_mud_url, in hostapd_dpp_auth_init()
961 hapd->conf->dpp_extra_conf_req_name, in hostapd_dpp_auth_init()
962 hapd->conf->dpp_extra_conf_req_value, in hostapd_dpp_auth_init()
963 hapd->msg_ctx, hapd, in hostapd_dpp_auth_init()
967 hapd->dpp_auth = auth; in hostapd_dpp_auth_init()
968 return hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_auth_init()
974 int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_listen() argument
983 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR; in hostapd_dpp_listen()
985 hapd->dpp_allowed_roles = DPP_CAPAB_ENROLLEE; in hostapd_dpp_listen()
987 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | in hostapd_dpp_listen()
989 hapd->dpp_qr_mutual = os_strstr(cmd, " qr=mutual") != NULL; in hostapd_dpp_listen()
991 if (freq != hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_listen()
995 freq, hapd->iface->freq); in hostapd_dpp_listen()
999 hostapd_drv_dpp_listen(hapd, true); in hostapd_dpp_listen()
1004 void hostapd_dpp_listen_stop(struct hostapd_data *hapd) in hostapd_dpp_listen_stop() argument
1006 hostapd_drv_dpp_listen(hapd, false); in hostapd_dpp_listen_stop()
1013 hostapd_dpp_relay_needs_controller(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_relay_needs_controller() argument
1018 if (!hapd->conf->dpp_relay_port) in hostapd_dpp_relay_needs_controller()
1022 if (hapd->dpp_relay_last_needs_ctrl.sec && in hostapd_dpp_relay_needs_controller()
1023 !os_reltime_expired(&now, &hapd->dpp_relay_last_needs_ctrl, 60)) in hostapd_dpp_relay_needs_controller()
1025 hapd->dpp_relay_last_needs_ctrl = now; in hostapd_dpp_relay_needs_controller()
1026 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RELAY_NEEDS_CONTROLLER in hostapd_dpp_relay_needs_controller()
1032 static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_req() argument
1040 if (!hapd->iface->interfaces->dpp) in hostapd_dpp_rx_auth_req()
1047 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_rx_auth_req()
1053 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
1063 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
1072 dpp_bootstrap_find_pair(hapd->iface->interfaces->dpp, i_bootstrap, in hostapd_dpp_rx_auth_req()
1076 if (dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_auth_req()
1078 r_bootstrap, hapd) == 0) in hostapd_dpp_rx_auth_req()
1080 hostapd_dpp_relay_needs_controller(hapd, src, in hostapd_dpp_rx_auth_req()
1085 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
1092 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
1099 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
1105 if (hapd->dpp_auth) { in hostapd_dpp_rx_auth_req()
1106 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
1111 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_rx_auth_req()
1112 hapd->dpp_auth = dpp_auth_req_rx(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_auth_req()
1113 hapd->msg_ctx, hapd->dpp_allowed_roles, in hostapd_dpp_rx_auth_req()
1114 hapd->dpp_qr_mutual, in hostapd_dpp_rx_auth_req()
1116 if (!hapd->dpp_auth) { in hostapd_dpp_rx_auth_req()
1120 hostapd_dpp_set_testing_options(hapd, hapd->dpp_auth); in hostapd_dpp_rx_auth_req()
1121 if (dpp_set_configurator(hapd->dpp_auth, in hostapd_dpp_rx_auth_req()
1122 hapd->dpp_configurator_params) < 0) { in hostapd_dpp_rx_auth_req()
1123 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_rx_auth_req()
1124 hapd->dpp_auth = NULL; in hostapd_dpp_rx_auth_req()
1127 os_memcpy(hapd->dpp_auth->peer_mac_addr, src, ETH_ALEN); in hostapd_dpp_rx_auth_req()
1129 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_auth_req()
1131 MAC2STR(src), hapd->dpp_auth->curr_freq, in hostapd_dpp_rx_auth_req()
1133 hostapd_drv_send_action(hapd, hapd->dpp_auth->curr_freq, 0, in hostapd_dpp_rx_auth_req()
1134 src, wpabuf_head(hapd->dpp_auth->resp_msg), in hostapd_dpp_rx_auth_req()
1135 wpabuf_len(hapd->dpp_auth->resp_msg)); in hostapd_dpp_rx_auth_req()
1139 static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd, in hostapd_dpp_handle_config_obj() argument
1143 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_RECEIVED); in hostapd_dpp_handle_config_obj()
1144 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_AKM "%s", in hostapd_dpp_handle_config_obj()
1147 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_SSID "%s", in hostapd_dpp_handle_config_obj()
1155 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONNECTOR "%s", in hostapd_dpp_handle_config_obj()
1164 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_PASS "%s", in hostapd_dpp_handle_config_obj()
1170 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_PSK "%s", in hostapd_dpp_handle_config_obj()
1183 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
1199 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
1204 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
1212 static int hostapd_dpp_handle_key_pkg(struct hostapd_data *hapd, in hostapd_dpp_handle_key_pkg() argument
1222 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_RECEIVED); in hostapd_dpp_handle_key_pkg()
1226 hapd->iface->interfaces->dpp, key); in hostapd_dpp_handle_key_pkg()
1229 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFIGURATOR_ID "%d", in hostapd_dpp_handle_key_pkg()
1242 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_build_new_key() local
1243 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_build_new_key()
1249 hostapd_dpp_start_gas_client(hapd); in hostapd_dpp_build_new_key()
1259 struct hostapd_data *hapd = ctx; in hostapd_dpp_gas_resp_cb() local
1261 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_resp_cb()
1298 eloop_register_timeout(0, 0, hostapd_dpp_build_new_key, hapd, in hostapd_dpp_gas_resp_cb()
1308 hostapd_dpp_handle_config_obj(hapd, auth, &auth->conf_obj[0]); in hostapd_dpp_gas_resp_cb()
1309 if (hostapd_dpp_handle_key_pkg(hapd, auth->conf_key_pkg) < 0) in hostapd_dpp_gas_resp_cb()
1321 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_resp_cb()
1332 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_gas_resp_cb()
1336 hostapd_drv_send_action(hapd, auth->curr_freq, 0, in hostapd_dpp_gas_resp_cb()
1347 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_gas_resp_cb()
1348 hapd->dpp_auth = NULL; in hostapd_dpp_gas_resp_cb()
1352 static void hostapd_dpp_start_gas_client(struct hostapd_data *hapd) in hostapd_dpp_start_gas_client() argument
1354 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_start_gas_client()
1358 buf = dpp_build_conf_req_helper(auth, hapd->conf->dpp_name, in hostapd_dpp_start_gas_client()
1360 hapd->conf->dpp_mud_url, NULL, in hostapd_dpp_start_gas_client()
1361 hapd->conf->dpp_extra_conf_req_name, in hostapd_dpp_start_gas_client()
1362 hapd->conf->dpp_extra_conf_req_value); in hostapd_dpp_start_gas_client()
1372 res = gas_query_ap_req(hapd->gas, auth->peer_mac_addr, auth->curr_freq, in hostapd_dpp_start_gas_client()
1373 buf, hostapd_dpp_gas_resp_cb, hapd); in hostapd_dpp_start_gas_client()
1375 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in hostapd_dpp_start_gas_client()
1385 static void hostapd_dpp_auth_success(struct hostapd_data *hapd, int initiator) in hostapd_dpp_auth_success() argument
1388 dpp_notify_auth_success(hapd->dpp_auth, initiator); in hostapd_dpp_auth_success()
1393 if (hapd->dpp_auth->configurator) { in hostapd_dpp_auth_success()
1395 hapd->dpp_auth->auth_success = 0; in hostapd_dpp_auth_success()
1401 if (!hapd->dpp_auth->configurator) in hostapd_dpp_auth_success()
1402 hostapd_dpp_start_gas_client(hapd); in hostapd_dpp_auth_success()
1406 static void hostapd_dpp_rx_auth_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_resp() argument
1410 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_auth_resp()
1429 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_rx_auth_resp()
1437 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_rx_auth_resp()
1449 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_auth_resp()
1452 hostapd_drv_send_action(hapd, auth->curr_freq, 0, src, in hostapd_dpp_rx_auth_resp()
1455 hapd->dpp_auth_ok_on_ack = 1; in hostapd_dpp_rx_auth_resp()
1459 static void hostapd_dpp_rx_auth_conf(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_conf() argument
1462 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_auth_conf()
1484 hostapd_dpp_auth_success(hapd, 0); in hostapd_dpp_rx_auth_conf()
1493 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_config_result_wait_timeout() local
1494 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_config_result_wait_timeout()
1501 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_config_result_wait_timeout()
1503 hapd->dpp_auth = NULL; in hostapd_dpp_config_result_wait_timeout()
1510 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_conn_status_result_wait_timeout() local
1511 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_conn_status_result_wait_timeout()
1518 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_conn_status_result_wait_timeout()
1521 hapd->dpp_auth = NULL; in hostapd_dpp_conn_status_result_wait_timeout()
1527 static bool hostapd_dpp_pb_active(struct hostapd_data *hapd) in hostapd_dpp_pb_active() argument
1529 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_pb_active()
1536 static void hostapd_dpp_remove_pb_hash(struct hostapd_data *hapd) in hostapd_dpp_remove_pb_hash() argument
1538 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_remove_pb_hash()
1564 static void hostapd_dpp_rx_conf_result(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_conf_result() argument
1567 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_conf_result()
1570 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_rx_conf_result()
1591 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_rx_conf_result()
1596 hapd, NULL); in hostapd_dpp_rx_conf_result()
1600 hapd, NULL); in hostapd_dpp_rx_conf_result()
1603 hapd, NULL); in hostapd_dpp_rx_conf_result()
1606 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_rx_conf_result()
1607 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_rx_conf_result()
1609 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_SENT in hostapd_dpp_rx_conf_result()
1612 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_rx_conf_result()
1614 hapd->dpp_auth = NULL; in hostapd_dpp_rx_conf_result()
1615 eloop_cancel_timeout(hostapd_dpp_config_result_wait_timeout, hapd, in hostapd_dpp_rx_conf_result()
1618 if (!ifaces->dpp_pb_result_indicated && hostapd_dpp_pb_active(hapd)) { in hostapd_dpp_rx_conf_result()
1620 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PB_RESULT in hostapd_dpp_rx_conf_result()
1623 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PB_RESULT in hostapd_dpp_rx_conf_result()
1627 hostapd_dpp_remove_pb_hash(hapd); in hostapd_dpp_rx_conf_result()
1628 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_rx_conf_result()
1634 static void hostapd_dpp_rx_conn_status_result(struct hostapd_data *hapd, in hostapd_dpp_rx_conn_status_result() argument
1638 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_conn_status_result()
1654 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONN_STATUS_RESULT in hostapd_dpp_rx_conn_status_result()
1659 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_rx_conn_status_result()
1660 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_rx_conn_status_result()
1662 hapd->dpp_auth = NULL; in hostapd_dpp_rx_conn_status_result()
1664 hapd, NULL); in hostapd_dpp_rx_conn_status_result()
1669 hostapd_dpp_rx_presence_announcement(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_presence_announcement() argument
1684 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_presence_announcement()
1690 peer_bi = dpp_bootstrap_find_chirp(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_presence_announcement()
1692 dpp_notify_chirp_received(hapd->msg_ctx, in hostapd_dpp_rx_presence_announcement()
1696 if (dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_presence_announcement()
1698 r_bootstrap, hapd) == 0) in hostapd_dpp_rx_presence_announcement()
1703 hapd, src, DPP_PA_PRESENCE_ANNOUNCEMENT); in hostapd_dpp_rx_presence_announcement()
1707 if (hapd->dpp_auth) { in hostapd_dpp_rx_presence_announcement()
1713 auth = dpp_auth_init(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_rx_presence_announcement()
1718 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_rx_presence_announcement()
1720 hapd->dpp_configurator_params) < 0) { in hostapd_dpp_rx_presence_announcement()
1731 hapd->dpp_auth = auth; in hostapd_dpp_rx_presence_announcement()
1732 if (hostapd_dpp_auth_init_next(hapd) < 0) { in hostapd_dpp_rx_presence_announcement()
1733 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_rx_presence_announcement()
1734 hapd->dpp_auth = NULL; in hostapd_dpp_rx_presence_announcement()
1742 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_reconfig_reply_wait_timeout() local
1743 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_reconfig_reply_wait_timeout()
1749 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reconfig_reply_wait_timeout()
1751 hapd->dpp_auth = NULL; in hostapd_dpp_reconfig_reply_wait_timeout()
1756 hostapd_dpp_rx_reconfig_announcement(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_reconfig_announcement() argument
1767 if (hapd->dpp_auth) { in hostapd_dpp_rx_reconfig_announcement()
1779 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_reconfig_announcement()
1785 conf = dpp_configurator_find_kid(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_reconfig_announcement()
1788 if (dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_reconfig_announcement()
1790 NULL, hapd) == 0) in hostapd_dpp_rx_reconfig_announcement()
1795 hapd, src, DPP_PA_RECONFIG_ANNOUNCEMENT); in hostapd_dpp_rx_reconfig_announcement()
1802 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_reconfig_announcement()
1812 auth = dpp_reconfig_init(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_rx_reconfig_announcement()
1817 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_rx_reconfig_announcement()
1818 if (dpp_set_configurator(auth, hapd->dpp_configurator_params) < 0) { in hostapd_dpp_rx_reconfig_announcement()
1824 hapd->dpp_auth = auth; in hostapd_dpp_rx_reconfig_announcement()
1826 hapd->dpp_in_response_listen = 0; in hostapd_dpp_rx_reconfig_announcement()
1827 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_rx_reconfig_announcement()
1829 max_wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_rx_reconfig_announcement()
1830 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_rx_reconfig_announcement()
1836 hapd, NULL); in hostapd_dpp_rx_reconfig_announcement()
1839 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_reconfig_announcement()
1842 if (hostapd_drv_send_action(hapd, freq, wait_time, src, in hostapd_dpp_rx_reconfig_announcement()
1845 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_rx_reconfig_announcement()
1846 hapd->dpp_auth = NULL; in hostapd_dpp_rx_reconfig_announcement()
1852 hostapd_dpp_rx_reconfig_auth_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_reconfig_auth_resp() argument
1856 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_reconfig_auth_resp()
1879 hapd, NULL); in hostapd_dpp_rx_reconfig_auth_resp()
1881 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_reconfig_auth_resp()
1884 if (hostapd_drv_send_action(hapd, freq, 500, src, in hostapd_dpp_rx_reconfig_auth_resp()
1887 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_rx_reconfig_auth_resp()
1888 hapd->dpp_auth = NULL; in hostapd_dpp_rx_reconfig_auth_resp()
1897 static void hostapd_dpp_send_peer_disc_resp(struct hostapd_data *hapd, in hostapd_dpp_send_peer_disc_resp() argument
1905 len = 5 + 5 + 4 + os_strlen(hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1958 hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1974 wpabuf_put_le16(msg, os_strlen(hapd->conf->dpp_connector)); in hostapd_dpp_send_peer_disc_resp()
1975 wpabuf_put_str(msg, hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1992 conn_ver = dpp_get_connector_version(hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
2021 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_send_peer_disc_resp()
2024 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_send_peer_disc_resp()
2030 static bool hapd_dpp_connector_available(struct hostapd_data *hapd) in hapd_dpp_connector_available() argument
2032 if (!hapd->wpa_auth || in hapd_dpp_connector_available()
2033 !(hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) || in hapd_dpp_connector_available()
2034 !(hapd->conf->wpa & WPA_PROTO_RSN)) { in hapd_dpp_connector_available()
2039 if (!hapd->conf->dpp_connector || !hapd->conf->dpp_netaccesskey || in hapd_dpp_connector_available()
2040 !hapd->conf->dpp_csign) { in hapd_dpp_connector_available()
2049 static void hostapd_dpp_rx_peer_disc_req(struct hostapd_data *hapd, in hostapd_dpp_rx_peer_disc_req() argument
2067 if (!hapd_dpp_connector_available(hapd)) in hostapd_dpp_rx_peer_disc_req()
2072 if (hapd->conf->dpp_netaccesskey_expiry && in hostapd_dpp_rx_peer_disc_req()
2073 (os_time_t) hapd->conf->dpp_netaccesskey_expiry < now.sec) { in hostapd_dpp_rx_peer_disc_req()
2093 res = dpp_peer_intro(&intro, hapd->conf->dpp_connector, in hostapd_dpp_rx_peer_disc_req()
2094 wpabuf_head(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_peer_disc_req()
2095 wpabuf_len(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_peer_disc_req()
2096 wpabuf_head(hapd->conf->dpp_csign), in hostapd_dpp_rx_peer_disc_req()
2097 wpabuf_len(hapd->conf->dpp_csign), in hostapd_dpp_rx_peer_disc_req()
2109 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, trans_id[0], in hostapd_dpp_rx_peer_disc_req()
2128 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, in hostapd_dpp_rx_peer_disc_req()
2136 if (!expire || (os_time_t) hapd->conf->dpp_netaccesskey_expiry < expire) in hostapd_dpp_rx_peer_disc_req()
2137 expire = hapd->conf->dpp_netaccesskey_expiry; in hostapd_dpp_rx_peer_disc_req()
2143 if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, in hostapd_dpp_rx_peer_disc_req()
2150 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, trans_id[0], in hostapd_dpp_rx_peer_disc_req()
2158 hostapd_dpp_rx_pkex_exchange_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_exchange_req() argument
2167 if (hapd->dpp_pkex_ver == PKEX_VER_ONLY_1 && v2) { in hostapd_dpp_rx_pkex_exchange_req()
2172 if (hapd->dpp_pkex_ver == PKEX_VER_ONLY_2 && !v2) { in hostapd_dpp_rx_pkex_exchange_req()
2181 if (!hapd->dpp_pkex_code || !hapd->dpp_pkex_bi) { in hostapd_dpp_rx_pkex_exchange_req()
2188 if (dpp_controller_is_own_pkex_req(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_pkex_exchange_req()
2196 if (hapd->dpp_pkex) { in hostapd_dpp_rx_pkex_exchange_req()
2203 hapd->dpp_pkex = dpp_pkex_rx_exchange_req(hapd->msg_ctx, in hostapd_dpp_rx_pkex_exchange_req()
2204 hapd->dpp_pkex_bi, in hostapd_dpp_rx_pkex_exchange_req()
2205 hapd->own_addr, src, in hostapd_dpp_rx_pkex_exchange_req()
2206 hapd->dpp_pkex_identifier, in hostapd_dpp_rx_pkex_exchange_req()
2207 hapd->dpp_pkex_code, in hostapd_dpp_rx_pkex_exchange_req()
2208 hapd->dpp_pkex_code_len, in hostapd_dpp_rx_pkex_exchange_req()
2210 if (!hapd->dpp_pkex) { in hostapd_dpp_rx_pkex_exchange_req()
2216 msg = hapd->dpp_pkex->exchange_resp; in hostapd_dpp_rx_pkex_exchange_req()
2217 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_exchange_req()
2220 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_exchange_req()
2222 if (hapd->dpp_pkex->failed) { in hostapd_dpp_rx_pkex_exchange_req()
2225 if (hapd->dpp_pkex->t > hapd->dpp_pkex->own_bi->pkex_t) in hostapd_dpp_rx_pkex_exchange_req()
2226 hapd->dpp_pkex->own_bi->pkex_t = hapd->dpp_pkex->t; in hostapd_dpp_rx_pkex_exchange_req()
2227 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_rx_pkex_exchange_req()
2228 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_exchange_req()
2235 if (v2 && dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_pkex_exchange_req()
2237 hapd) != 0) { in hostapd_dpp_rx_pkex_exchange_req()
2240 hostapd_dpp_relay_needs_controller(hapd, src, in hostapd_dpp_rx_pkex_exchange_req()
2250 hostapd_dpp_rx_pkex_exchange_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_exchange_resp() argument
2261 if (!hapd->dpp_pkex || !hapd->dpp_pkex->initiator || in hostapd_dpp_rx_pkex_exchange_resp()
2262 hapd->dpp_pkex->exchange_done) { in hostapd_dpp_rx_pkex_exchange_resp()
2267 eloop_cancel_timeout(hostapd_dpp_pkex_retry_timeout, hapd, NULL); in hostapd_dpp_rx_pkex_exchange_resp()
2268 hapd->dpp_pkex->exch_req_wait_time = 0; in hostapd_dpp_rx_pkex_exchange_resp()
2270 msg = dpp_pkex_rx_exchange_resp(hapd->dpp_pkex, src, buf, len); in hostapd_dpp_rx_pkex_exchange_resp()
2279 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_exchange_resp()
2282 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_exchange_resp()
2289 hostapd_dpp_rx_pkex_commit_reveal_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_commit_reveal_req() argument
2294 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_rx_pkex_commit_reveal_req()
2308 if (hapd->dpp_pkex->failed) { in hostapd_dpp_rx_pkex_commit_reveal_req()
2310 if (hapd->dpp_pkex->t > hapd->dpp_pkex->own_bi->pkex_t) in hostapd_dpp_rx_pkex_commit_reveal_req()
2311 hapd->dpp_pkex->own_bi->pkex_t = in hostapd_dpp_rx_pkex_commit_reveal_req()
2312 hapd->dpp_pkex->t; in hostapd_dpp_rx_pkex_commit_reveal_req()
2313 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_rx_pkex_commit_reveal_req()
2314 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_req()
2322 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_commit_reveal_req()
2325 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_commit_reveal_req()
2329 hostapd_dpp_pkex_clear_code(hapd); in hostapd_dpp_rx_pkex_commit_reveal_req()
2330 bi = dpp_pkex_finish(hapd->iface->interfaces->dpp, pkex, src, freq); in hostapd_dpp_rx_pkex_commit_reveal_req()
2333 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_req()
2338 hostapd_dpp_rx_pkex_commit_reveal_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_commit_reveal_resp() argument
2342 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_rx_pkex_commit_reveal_resp()
2345 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_rx_pkex_commit_reveal_resp()
2362 hostapd_dpp_pkex_clear_code(hapd); in hostapd_dpp_rx_pkex_commit_reveal_resp()
2366 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_resp()
2385 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_rx_pkex_commit_reveal_resp()
2392 hapd->dpp_pkex_auth_cmd ? hapd->dpp_pkex_auth_cmd : ""); in hostapd_dpp_rx_pkex_commit_reveal_resp()
2396 if (hostapd_dpp_auth_init(hapd, cmd) < 0) { in hostapd_dpp_rx_pkex_commit_reveal_resp()
2406 static void hostapd_dpp_pb_pkex_init(struct hostapd_data *hapd, in hostapd_dpp_pb_pkex_init() argument
2410 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_pb_pkex_init()
2423 if (hapd->dpp_pkex) { in hostapd_dpp_pb_pkex_init()
2427 msg = hapd->dpp_pkex->exchange_req; in hostapd_dpp_pb_pkex_init()
2428 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_pb_pkex_init()
2436 hapd->dpp_pkex_bi = ifaces->dpp_pb_bi; in hostapd_dpp_pb_pkex_init()
2439 pkex = dpp_pkex_init(hapd->msg_ctx, hapd->dpp_pkex_bi, hapd->own_addr, in hostapd_dpp_pb_pkex_init()
2444 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_pb_pkex_init()
2449 hapd->dpp_pkex = pkex; in hostapd_dpp_pb_pkex_init()
2450 msg = hapd->dpp_pkex->exchange_req; in hostapd_dpp_pb_pkex_init()
2454 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pb_pkex_init()
2456 hapd->dpp_pkex_auth_cmd = os_malloc(len); in hostapd_dpp_pb_pkex_init()
2457 if (!hapd->dpp_pkex_auth_cmd) { in hostapd_dpp_pb_pkex_init()
2458 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_pb_pkex_init()
2461 os_snprintf(hapd->dpp_pkex_auth_cmd, len, " own=%d %s", in hostapd_dpp_pb_pkex_init()
2462 hapd->dpp_pkex_bi->id, ifaces->dpp_pb_cmd); in hostapd_dpp_pb_pkex_init()
2468 (const u8 *) hapd->conf->ssid.ssid, in hostapd_dpp_pb_pkex_init()
2469 hapd->conf->ssid.ssid_len); in hostapd_dpp_pb_pkex_init()
2471 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) { in hostapd_dpp_pb_pkex_init()
2476 if (hapd->conf->wpa & WPA_PROTO_RSN) { in hostapd_dpp_pb_pkex_init()
2477 psk = hapd->conf->wpa_key_mgmt & (WPA_KEY_MGMT_PSK | in hostapd_dpp_pb_pkex_init()
2480 sae = hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_SAE; in hostapd_dpp_pb_pkex_init()
2485 for (e = hapd->conf->sae_passwords; sae && e && !password; in hostapd_dpp_pb_pkex_init()
2492 if (!password && hapd->conf->ssid.wpa_passphrase_set && in hostapd_dpp_pb_pkex_init()
2493 hapd->conf->ssid.wpa_passphrase) in hostapd_dpp_pb_pkex_init()
2494 password = hapd->conf->ssid.wpa_passphrase; in hostapd_dpp_pb_pkex_init()
2499 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_pb_pkex_init()
2534 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_pb_pkex_init()
2539 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pb_pkex_init()
2541 hapd->dpp_pkex_auth_cmd = os_malloc(len); in hostapd_dpp_pb_pkex_init()
2542 if (hapd->dpp_pkex_auth_cmd) in hostapd_dpp_pb_pkex_init()
2543 os_snprintf(hapd->dpp_pkex_auth_cmd, len, " own=%d %s", in hostapd_dpp_pb_pkex_init()
2544 hapd->dpp_pkex_bi->id, cmd); in hostapd_dpp_pb_pkex_init()
2546 if (!hapd->dpp_pkex_auth_cmd) { in hostapd_dpp_pb_pkex_init()
2547 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_pb_pkex_init()
2552 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_pb_pkex_init()
2555 hostapd_drv_send_action(hapd, pkex->freq, 0, src, in hostapd_dpp_pb_pkex_init()
2563 hostapd_dpp_rx_pb_presence_announcement(struct hostapd_data *hapd, in hostapd_dpp_rx_pb_presence_announcement() argument
2568 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_rx_pb_presence_announcement()
2624 hostapd_dpp_pb_active(hapd)) { in hostapd_dpp_rx_pb_presence_announcement()
2625 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_rx_pb_presence_announcement()
2629 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_rx_pb_presence_announcement()
2645 if (!hostapd_dpp_pb_active(hapd)) { in hostapd_dpp_rx_pb_presence_announcement()
2671 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_rx_pb_presence_announcement()
2690 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_rx_pb_presence_announcement()
2699 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pb_presence_announcement()
2702 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pb_presence_announcement()
2707 hostapd_dpp_pb_pkex_init(hapd, freq, src, r_hash); in hostapd_dpp_rx_pb_presence_announcement()
2712 hostapd_dpp_rx_priv_peer_intro_query(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_priv_peer_intro_query() argument
2725 if (!hapd_dpp_connector_available(hapd)) in hostapd_dpp_rx_priv_peer_intro_query()
2747 len = 5 + 5 + 4 + os_strlen(hapd->conf->dpp_connector); in hostapd_dpp_rx_priv_peer_intro_query()
2758 conn_ver = dpp_get_connector_version(hapd->conf->dpp_connector); in hostapd_dpp_rx_priv_peer_intro_query()
2771 wpabuf_put_le16(msg, os_strlen(hapd->conf->dpp_connector)); in hostapd_dpp_rx_priv_peer_intro_query()
2772 wpabuf_put_str(msg, hapd->conf->dpp_connector); in hostapd_dpp_rx_priv_peer_intro_query()
2776 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_priv_peer_intro_query()
2779 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_priv_peer_intro_query()
2786 hostapd_dpp_rx_priv_peer_intro_update(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_priv_peer_intro_update() argument
2812 if (!hapd_dpp_connector_available(hapd)) in hostapd_dpp_rx_priv_peer_intro_update()
2817 if (hapd->conf->dpp_netaccesskey_expiry && in hostapd_dpp_rx_priv_peer_intro_update()
2818 (os_time_t) hapd->conf->dpp_netaccesskey_expiry < now.sec) { in hostapd_dpp_rx_priv_peer_intro_update()
2839 wpabuf_head(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_priv_peer_intro_update()
2840 wpabuf_len(hapd->conf->dpp_netaccesskey)); in hostapd_dpp_rx_priv_peer_intro_update()
2878 res = dpp_peer_intro(&intro, hapd->conf->dpp_connector, in hostapd_dpp_rx_priv_peer_intro_update()
2879 wpabuf_head(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_priv_peer_intro_update()
2880 wpabuf_len(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_priv_peer_intro_update()
2881 wpabuf_head(hapd->conf->dpp_csign), in hostapd_dpp_rx_priv_peer_intro_update()
2882 wpabuf_len(hapd->conf->dpp_csign), in hostapd_dpp_rx_priv_peer_intro_update()
2910 if (!expire || (os_time_t) hapd->conf->dpp_netaccesskey_expiry < expire) in hostapd_dpp_rx_priv_peer_intro_update()
2911 expire = hapd->conf->dpp_netaccesskey_expiry; in hostapd_dpp_rx_priv_peer_intro_update()
2917 if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, in hostapd_dpp_rx_priv_peer_intro_update()
2935 void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_action() argument
2961 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
2968 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
2973 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
2977 if (dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_action()
2979 hapd) == 0) in hostapd_dpp_rx_action()
2985 hostapd_dpp_rx_auth_req(hapd, src, hdr, buf, len, freq); in hostapd_dpp_rx_action()
2988 hostapd_dpp_rx_auth_resp(hapd, src, hdr, buf, len, freq); in hostapd_dpp_rx_action()
2991 hostapd_dpp_rx_auth_conf(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
2994 hostapd_dpp_rx_peer_disc_req(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
3001 hostapd_dpp_rx_pkex_exchange_req(hapd, src, hdr, buf, len, freq, in hostapd_dpp_rx_action()
3006 hostapd_dpp_rx_pkex_exchange_req(hapd, src, hdr, buf, len, freq, in hostapd_dpp_rx_action()
3010 hostapd_dpp_rx_pkex_exchange_resp(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
3013 hostapd_dpp_rx_pkex_commit_reveal_req(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
3017 hostapd_dpp_rx_pkex_commit_reveal_resp(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
3022 hostapd_dpp_rx_conf_result(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
3025 hostapd_dpp_rx_conn_status_result(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
3028 hostapd_dpp_rx_presence_announcement(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
3032 hostapd_dpp_rx_reconfig_announcement(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
3036 hostapd_dpp_rx_reconfig_auth_resp(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
3042 hostapd_dpp_rx_pb_presence_announcement(hapd, src, hdr, in hostapd_dpp_rx_action()
3046 hostapd_dpp_rx_priv_peer_intro_query(hapd, src, hdr, in hostapd_dpp_rx_action()
3050 hostapd_dpp_rx_priv_peer_intro_update(hapd, src, hdr, in hostapd_dpp_rx_action()
3060 if (hapd->dpp_pkex) in hostapd_dpp_rx_action()
3061 pkex_t = hapd->dpp_pkex->t; in hostapd_dpp_rx_action()
3062 else if (hapd->dpp_pkex_bi) in hostapd_dpp_rx_action()
3063 pkex_t = hapd->dpp_pkex_bi->pkex_t; in hostapd_dpp_rx_action()
3067 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PKEX_T_LIMIT "id=0"); in hostapd_dpp_rx_action()
3068 hostapd_dpp_pkex_remove(hapd, "*"); in hostapd_dpp_rx_action()
3074 hostapd_dpp_gas_req_handler(struct hostapd_data *hapd, const u8 *sa, in hostapd_dpp_gas_req_handler() argument
3078 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_req_handler()
3085 if (dpp_relay_rx_gas_req(hapd->iface->interfaces->dpp, sa, data, in hostapd_dpp_gas_req_handler()
3095 if (hapd->dpp_auth_ok_on_ack && auth->configurator) { in hostapd_dpp_gas_req_handler()
3102 dpp_notify_auth_success(hapd->dpp_auth, 1); in hostapd_dpp_gas_req_handler()
3103 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_gas_req_handler()
3116 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_REQ_RX "src=" MACSTR, in hostapd_dpp_gas_req_handler()
3120 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_req_handler()
3125 void hostapd_dpp_gas_status_handler(struct hostapd_data *hapd, int ok) in hostapd_dpp_gas_status_handler() argument
3127 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_status_handler()
3129 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_gas_status_handler()
3144 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
3145 eloop_cancel_timeout(hostapd_dpp_auth_conf_wait_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
3146 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
3149 hapd, NULL); in hostapd_dpp_gas_status_handler()
3155 hapd, NULL); in hostapd_dpp_gas_status_handler()
3158 hapd, NULL); in hostapd_dpp_gas_status_handler()
3162 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_gas_status_handler()
3165 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_SENT in hostapd_dpp_gas_status_handler()
3168 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_status_handler()
3169 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_gas_status_handler()
3170 hapd->dpp_auth = NULL; in hostapd_dpp_gas_status_handler()
3172 if (!ifaces->dpp_pb_result_indicated && hostapd_dpp_pb_active(hapd)) { in hostapd_dpp_gas_status_handler()
3174 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PB_RESULT in hostapd_dpp_gas_status_handler()
3177 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PB_RESULT in hostapd_dpp_gas_status_handler()
3181 hostapd_dpp_remove_pb_hash(hapd); in hostapd_dpp_gas_status_handler()
3182 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_gas_status_handler()
3188 int hostapd_dpp_configurator_sign(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_configurator_sign() argument
3194 auth = dpp_alloc_auth(hapd->iface->interfaces->dpp, hapd->msg_ctx); in hostapd_dpp_configurator_sign()
3199 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_configurator_sign()
3202 hostapd_dpp_handle_config_obj(hapd, auth, &auth->conf_obj[0]); in hostapd_dpp_configurator_sign()
3213 int hostapd_dpp_pkex_add(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_pkex_add() argument
3250 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_pkex_add()
3261 hapd->dpp_pkex_bi = own_bi; in hostapd_dpp_pkex_add()
3264 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_add()
3265 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_add()
3272 hapd->dpp_pkex_identifier = os_malloc(end - pos + 1); in hostapd_dpp_pkex_add()
3273 if (!hapd->dpp_pkex_identifier) in hostapd_dpp_pkex_add()
3275 os_memcpy(hapd->dpp_pkex_identifier, pos, end - pos); in hostapd_dpp_pkex_add()
3276 hapd->dpp_pkex_identifier[end - pos] = '\0'; in hostapd_dpp_pkex_add()
3282 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_add()
3283 hapd->dpp_pkex_code = os_strdup(pos + 6); in hostapd_dpp_pkex_add()
3284 if (!hapd->dpp_pkex_code) in hostapd_dpp_pkex_add()
3286 hapd->dpp_pkex_code_len = os_strlen(hapd->dpp_pkex_code); in hostapd_dpp_pkex_add()
3301 hapd->dpp_pkex_ver = ver; in hostapd_dpp_pkex_add()
3304 if (hostapd_dpp_pkex_init(hapd, ver, ipaddr, tcp_port) < 0) in hostapd_dpp_pkex_add()
3308 dpp_controller_pkex_add(hapd->iface->interfaces->dpp, own_bi, in hostapd_dpp_pkex_add()
3309 hapd->dpp_pkex_code, in hostapd_dpp_pkex_add()
3310 hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_add()
3316 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pkex_add()
3317 hapd->dpp_pkex_auth_cmd = os_strdup(cmd); in hostapd_dpp_pkex_add()
3323 int hostapd_dpp_pkex_remove(struct hostapd_data *hapd, const char *id) in hostapd_dpp_pkex_remove() argument
3339 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_remove()
3340 hapd->dpp_pkex_code = NULL; in hostapd_dpp_pkex_remove()
3341 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_remove()
3342 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_remove()
3343 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pkex_remove()
3344 hapd->dpp_pkex_auth_cmd = NULL; in hostapd_dpp_pkex_remove()
3345 hapd->dpp_pkex_bi = NULL; in hostapd_dpp_pkex_remove()
3347 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_pkex_remove()
3348 hapd->dpp_pkex = NULL; in hostapd_dpp_pkex_remove()
3353 void hostapd_dpp_stop(struct hostapd_data *hapd) in hostapd_dpp_stop() argument
3355 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_stop()
3356 hapd->dpp_auth = NULL; in hostapd_dpp_stop()
3357 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_stop()
3358 hapd->dpp_pkex = NULL; in hostapd_dpp_stop()
3360 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_stop()
3370 struct hostapd_data *hapd = ctx; in hostapd_dpp_relay_tx() local
3374 freq = hapd->iface->freq; in hostapd_dpp_relay_tx()
3384 hostapd_drv_send_action(hapd, freq, 0, addr, buf, 2 + len); in hostapd_dpp_relay_tx()
3393 struct hostapd_data *hapd = ctx; in hostapd_dpp_relay_gas_resp_tx() local
3395 gas_serv_req_dpp_processing(hapd, addr, dialog_token, prot, buf, 0); in hostapd_dpp_relay_gas_resp_tx()
3401 static int hostapd_dpp_add_controllers(struct hostapd_data *hapd) in hostapd_dpp_add_controllers() argument
3408 config.msg_ctx = hapd->msg_ctx; in hostapd_dpp_add_controllers()
3409 config.cb_ctx = hapd; in hostapd_dpp_add_controllers()
3412 for (ctrl = hapd->conf->dpp_controller; ctrl; ctrl = ctrl->next) { in hostapd_dpp_add_controllers()
3415 if (dpp_relay_add_controller(hapd->iface->interfaces->dpp, in hostapd_dpp_add_controllers()
3420 if (hapd->conf->dpp_relay_port) in hostapd_dpp_add_controllers()
3421 dpp_relay_listen(hapd->iface->interfaces->dpp, in hostapd_dpp_add_controllers()
3422 hapd->conf->dpp_relay_port, in hostapd_dpp_add_controllers()
3432 int hostapd_dpp_add_controller(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_add_controller() argument
3440 struct dpp_global *dpp = hapd->iface->interfaces->dpp; in hostapd_dpp_add_controller()
3454 config.msg_ctx = hapd->msg_ctx; in hostapd_dpp_add_controller()
3455 config.cb_ctx = hapd; in hostapd_dpp_add_controller()
3464 ieee802_11_update_beacons(hapd->iface); in hostapd_dpp_add_controller()
3471 void hostapd_dpp_remove_controller(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_remove_controller() argument
3475 struct dpp_global *dpp = hapd->iface->interfaces->dpp; in hostapd_dpp_remove_controller()
3483 ieee802_11_update_beacons(hapd->iface); in hostapd_dpp_remove_controller()
3489 int hostapd_dpp_init(struct hostapd_data *hapd) in hostapd_dpp_init() argument
3491 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | DPP_CAPAB_ENROLLEE; in hostapd_dpp_init()
3492 hapd->dpp_init_done = 1; in hostapd_dpp_init()
3493 return hostapd_dpp_add_controllers(hapd); in hostapd_dpp_init()
3497 void hostapd_dpp_deinit(struct hostapd_data *hapd) in hostapd_dpp_deinit() argument
3500 os_free(hapd->dpp_config_obj_override); in hostapd_dpp_deinit()
3501 hapd->dpp_config_obj_override = NULL; in hostapd_dpp_deinit()
3502 os_free(hapd->dpp_discovery_override); in hostapd_dpp_deinit()
3503 hapd->dpp_discovery_override = NULL; in hostapd_dpp_deinit()
3504 os_free(hapd->dpp_groups_override); in hostapd_dpp_deinit()
3505 hapd->dpp_groups_override = NULL; in hostapd_dpp_deinit()
3506 hapd->dpp_ignore_netaccesskey_mismatch = 0; in hostapd_dpp_deinit()
3508 if (!hapd->dpp_init_done) in hostapd_dpp_deinit()
3510 eloop_cancel_timeout(hostapd_dpp_pkex_retry_timeout, hapd, NULL); in hostapd_dpp_deinit()
3511 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_deinit()
3512 eloop_cancel_timeout(hostapd_dpp_auth_conf_wait_timeout, hapd, NULL); in hostapd_dpp_deinit()
3513 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_deinit()
3514 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_deinit()
3517 hapd, NULL); in hostapd_dpp_deinit()
3518 eloop_cancel_timeout(hostapd_dpp_config_result_wait_timeout, hapd, in hostapd_dpp_deinit()
3520 eloop_cancel_timeout(hostapd_dpp_conn_status_result_wait_timeout, hapd, in hostapd_dpp_deinit()
3522 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_deinit()
3523 if (hapd->iface->interfaces) { in hostapd_dpp_deinit()
3524 dpp_relay_stop_listen(hapd->iface->interfaces->dpp); in hostapd_dpp_deinit()
3525 dpp_controller_stop_for_ctx(hapd->iface->interfaces->dpp, hapd); in hostapd_dpp_deinit()
3529 eloop_cancel_timeout(hostapd_dpp_build_new_key, hapd, NULL); in hostapd_dpp_deinit()
3530 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_deinit()
3532 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_deinit()
3533 hapd->dpp_auth = NULL; in hostapd_dpp_deinit()
3534 hostapd_dpp_pkex_remove(hapd, "*"); in hostapd_dpp_deinit()
3535 hapd->dpp_pkex = NULL; in hostapd_dpp_deinit()
3536 os_free(hapd->dpp_configurator_params); in hostapd_dpp_deinit()
3537 hapd->dpp_configurator_params = NULL; in hostapd_dpp_deinit()
3538 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_deinit()
3539 hapd->dpp_pkex_auth_cmd = NULL; in hostapd_dpp_deinit()
3545 int hostapd_dpp_controller_start(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_controller_start() argument
3553 config.msg_ctx = hapd->msg_ctx; in hostapd_dpp_controller_start()
3554 config.cb_ctx = hapd; in hostapd_dpp_controller_start()
3579 config.configurator_params = hapd->dpp_configurator_params; in hostapd_dpp_controller_start()
3580 return dpp_controller_start(hapd->iface->interfaces->dpp, &config); in hostapd_dpp_controller_start()
3588 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_chirp_timeout() local
3591 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_chirp_timeout()
3592 hostapd_dpp_chirp_next(hapd, NULL); in hostapd_dpp_chirp_timeout()
3596 static void hostapd_dpp_chirp_start(struct hostapd_data *hapd) in hostapd_dpp_chirp_start() argument
3601 msg = hapd->dpp_presence_announcement; in hostapd_dpp_chirp_start()
3603 wpa_printf(MSG_DEBUG, "DPP: Chirp on %d MHz", hapd->dpp_chirp_freq); in hostapd_dpp_chirp_start()
3604 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_chirp_start()
3606 MAC2STR(broadcast), hapd->dpp_chirp_freq, type); in hostapd_dpp_chirp_start()
3608 hapd, hapd->dpp_chirp_freq, 2000, broadcast, in hostapd_dpp_chirp_start()
3611 hapd, NULL) < 0) in hostapd_dpp_chirp_start()
3612 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_chirp_start()
3617 dpp_get_mode(struct hostapd_data *hapd, in dpp_get_mode() argument
3620 struct hostapd_hw_modes *modes = hapd->iface->hw_features; in dpp_get_mode()
3621 u16 num_modes = hapd->iface->num_hw_features; in dpp_get_mode()
3638 struct hostapd_data *hapd = iface->bss[0]; in hostapd_dpp_chirp_scan_res_handler() local
3640 struct dpp_bootstrap_info *bi = hapd->dpp_chirp_bi; in hostapd_dpp_chirp_scan_res_handler()
3644 bool chan6 = hapd->iface->hw_features == NULL; in hostapd_dpp_chirp_scan_res_handler()
3649 hapd->dpp_chirp_scan_done = 1; in hostapd_dpp_chirp_scan_res_handler()
3651 scan_res = hostapd_driver_get_scan_results(hapd); in hostapd_dpp_chirp_scan_res_handler()
3653 os_free(hapd->dpp_chirp_freqs); in hostapd_dpp_chirp_scan_res_handler()
3654 hapd->dpp_chirp_freqs = NULL; in hostapd_dpp_chirp_scan_res_handler()
3659 int_array_add_unique(&hapd->dpp_chirp_freqs, in hostapd_dpp_chirp_scan_res_handler()
3664 mode = dpp_get_mode(hapd, HOSTAPD_MODE_IEEE80211G); in hostapd_dpp_chirp_scan_res_handler()
3678 int_array_add_unique(&hapd->dpp_chirp_freqs, 2437); in hostapd_dpp_chirp_scan_res_handler()
3680 mode = dpp_get_mode(hapd, HOSTAPD_MODE_IEEE80211A); in hostapd_dpp_chirp_scan_res_handler()
3696 int_array_add_unique(&hapd->dpp_chirp_freqs, 5745); in hostapd_dpp_chirp_scan_res_handler()
3698 int_array_add_unique(&hapd->dpp_chirp_freqs, 5220); in hostapd_dpp_chirp_scan_res_handler()
3701 mode = dpp_get_mode(hapd, HOSTAPD_MODE_IEEE80211AD); in hostapd_dpp_chirp_scan_res_handler()
3710 int_array_add_unique(&hapd->dpp_chirp_freqs, 60480); in hostapd_dpp_chirp_scan_res_handler()
3725 int_array_add_unique(&hapd->dpp_chirp_freqs, in hostapd_dpp_chirp_scan_res_handler()
3729 if (!hapd->dpp_chirp_freqs || in hostapd_dpp_chirp_scan_res_handler()
3731 hapd, NULL) < 0) in hostapd_dpp_chirp_scan_res_handler()
3732 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_chirp_scan_res_handler()
3740 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_chirp_next() local
3743 if (hapd->dpp_chirp_listen) in hostapd_dpp_chirp_next()
3744 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_chirp_next()
3746 if (hapd->dpp_chirp_freq == 0) { in hostapd_dpp_chirp_next()
3747 if (hapd->dpp_chirp_round % 4 == 0 && in hostapd_dpp_chirp_next()
3748 !hapd->dpp_chirp_scan_done) { in hostapd_dpp_chirp_next()
3755 ret = hostapd_driver_scan(hapd, &params); in hostapd_dpp_chirp_next()
3760 hostapd_dpp_chirp_scan_res_handler(hapd->iface); in hostapd_dpp_chirp_next()
3762 hapd->iface->scan_cb = in hostapd_dpp_chirp_next()
3767 hapd->dpp_chirp_freq = hapd->dpp_chirp_freqs[0]; in hostapd_dpp_chirp_next()
3768 hapd->dpp_chirp_round++; in hostapd_dpp_chirp_next()
3770 hapd->dpp_chirp_round); in hostapd_dpp_chirp_next()
3772 for (i = 0; hapd->dpp_chirp_freqs[i]; i++) in hostapd_dpp_chirp_next()
3773 if (hapd->dpp_chirp_freqs[i] == hapd->dpp_chirp_freq) in hostapd_dpp_chirp_next()
3775 if (!hapd->dpp_chirp_freqs[i]) { in hostapd_dpp_chirp_next()
3778 hapd->dpp_chirp_freq); in hostapd_dpp_chirp_next()
3782 if (hapd->dpp_chirp_freqs[i]) { in hostapd_dpp_chirp_next()
3783 hapd->dpp_chirp_freq = hapd->dpp_chirp_freqs[i]; in hostapd_dpp_chirp_next()
3785 hapd->dpp_chirp_iter--; in hostapd_dpp_chirp_next()
3786 if (hapd->dpp_chirp_iter <= 0) { in hostapd_dpp_chirp_next()
3789 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_chirp_next()
3792 hapd->dpp_chirp_freq = 0; in hostapd_dpp_chirp_next()
3793 hapd->dpp_chirp_scan_done = 0; in hostapd_dpp_chirp_next()
3796 hapd, NULL) < 0) { in hostapd_dpp_chirp_next()
3797 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_chirp_next()
3800 if (hapd->dpp_chirp_listen) { in hostapd_dpp_chirp_next()
3803 hapd->dpp_chirp_listen); in hostapd_dpp_chirp_next()
3813 hostapd_dpp_chirp_start(hapd); in hostapd_dpp_chirp_next()
3817 int hostapd_dpp_chirp(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_chirp() argument
3827 bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_chirp()
3848 hostapd_dpp_chirp_stop(hapd); in hostapd_dpp_chirp()
3849 hapd->dpp_allowed_roles = DPP_CAPAB_ENROLLEE; in hostapd_dpp_chirp()
3850 hapd->dpp_qr_mutual = 0; in hostapd_dpp_chirp()
3851 hapd->dpp_chirp_bi = bi; in hostapd_dpp_chirp()
3852 hapd->dpp_presence_announcement = dpp_build_presence_announcement(bi); in hostapd_dpp_chirp()
3853 if (!hapd->dpp_presence_announcement) in hostapd_dpp_chirp()
3855 hapd->dpp_chirp_iter = iter; in hostapd_dpp_chirp()
3856 hapd->dpp_chirp_round = 0; in hostapd_dpp_chirp()
3857 hapd->dpp_chirp_scan_done = 0; in hostapd_dpp_chirp()
3858 hapd->dpp_chirp_listen = listen_freq; in hostapd_dpp_chirp()
3860 return eloop_register_timeout(0, 0, hostapd_dpp_chirp_next, hapd, NULL); in hostapd_dpp_chirp()
3864 void hostapd_dpp_chirp_stop(struct hostapd_data *hapd) in hostapd_dpp_chirp_stop() argument
3866 if (hapd->dpp_presence_announcement) { in hostapd_dpp_chirp_stop()
3867 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_chirp_stop()
3868 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CHIRP_STOPPED); in hostapd_dpp_chirp_stop()
3870 hapd->dpp_chirp_bi = NULL; in hostapd_dpp_chirp_stop()
3871 wpabuf_free(hapd->dpp_presence_announcement); in hostapd_dpp_chirp_stop()
3872 hapd->dpp_presence_announcement = NULL; in hostapd_dpp_chirp_stop()
3873 if (hapd->dpp_chirp_listen) in hostapd_dpp_chirp_stop()
3874 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_chirp_stop()
3875 hapd->dpp_chirp_listen = 0; in hostapd_dpp_chirp_stop()
3876 hapd->dpp_chirp_freq = 0; in hostapd_dpp_chirp_stop()
3877 os_free(hapd->dpp_chirp_freqs); in hostapd_dpp_chirp_stop()
3878 hapd->dpp_chirp_freqs = NULL; in hostapd_dpp_chirp_stop()
3879 eloop_cancel_timeout(hostapd_dpp_chirp_next, hapd, NULL); in hostapd_dpp_chirp_stop()
3880 eloop_cancel_timeout(hostapd_dpp_chirp_timeout, hapd, NULL); in hostapd_dpp_chirp_stop()
3881 if (hapd->iface->scan_cb == hostapd_dpp_chirp_scan_res_handler) { in hostapd_dpp_chirp_stop()
3883 hapd->iface->scan_cb = NULL; in hostapd_dpp_chirp_stop()
3894 struct hostapd_data *hapd = iface->bss[i]; in handle_dpp_remove_bi() local
3896 if (bi == hapd->dpp_chirp_bi) in handle_dpp_remove_bi()
3897 hostapd_dpp_chirp_stop(hapd); in handle_dpp_remove_bi()
3918 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_push_button_expire() local
3921 hostapd_dpp_push_button_stop(hapd); in hostapd_dpp_push_button_expire()
3925 int hostapd_dpp_push_button(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_push_button() argument
3927 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_push_button()
3942 hapd, NULL); in hostapd_dpp_push_button()
3944 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PB_STATUS "started"); in hostapd_dpp_push_button()
3949 void hostapd_dpp_push_button_stop(struct hostapd_data *hapd) in hostapd_dpp_push_button_stop() argument
3951 struct hapd_interfaces *ifaces = hapd->iface->interfaces; in hostapd_dpp_push_button_stop()
3955 eloop_cancel_timeout(hostapd_dpp_push_button_expire, hapd, NULL); in hostapd_dpp_push_button_stop()
3956 if (hostapd_dpp_pb_active(hapd)) { in hostapd_dpp_push_button_stop()
3959 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_push_button_stop()
3964 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_push_button_stop()
3965 hapd->dpp_pkex = NULL; in hostapd_dpp_push_button_stop()
3966 hapd->dpp_pkex_bi = NULL; in hostapd_dpp_push_button_stop()
3967 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_push_button_stop()
3968 hapd->dpp_pkex_auth_cmd = NULL; in hostapd_dpp_push_button_stop()
4001 bool hostapd_dpp_configurator_connectivity(struct hostapd_data *hapd) in hostapd_dpp_configurator_connectivity() argument
4003 return hapd->conf->dpp_configurator_connectivity || in hostapd_dpp_configurator_connectivity()
4004 (hapd->iface->interfaces && in hostapd_dpp_configurator_connectivity()
4005 dpp_relay_controller_available(hapd->iface->interfaces->dpp)); in hostapd_dpp_configurator_connectivity()