Lines Matching refs:hapd

25 static void hostapd_dpp_auth_success(struct hostapd_data *hapd, int initiator);
27 static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd);
38 int hostapd_dpp_qr_code(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_qr_code() argument
41 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_qr_code()
43 bi = dpp_add_qr_code(hapd->iface->interfaces->dpp, cmd); in hostapd_dpp_qr_code()
51 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_qr_code()
55 hostapd_drv_send_action(hapd, auth->curr_freq, 0, in hostapd_dpp_qr_code()
57 wpabuf_head(hapd->dpp_auth->resp_msg), in hostapd_dpp_qr_code()
58 wpabuf_len(hapd->dpp_auth->resp_msg)); in hostapd_dpp_qr_code()
68 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_auth_resp_retry_timeout() local
69 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_resp_retry_timeout()
76 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_auth_resp_retry_timeout()
80 hostapd_drv_send_action(hapd, auth->curr_freq, 500, auth->peer_mac_addr, in hostapd_dpp_auth_resp_retry_timeout()
86 static void hostapd_dpp_auth_resp_retry(struct hostapd_data *hapd) in hostapd_dpp_auth_resp_retry() argument
88 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_resp_retry()
94 if (hapd->dpp_resp_max_tries) in hostapd_dpp_auth_resp_retry()
95 max_tries = hapd->dpp_resp_max_tries; in hostapd_dpp_auth_resp_retry()
102 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_resp_retry()
103 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_resp_retry()
104 hapd->dpp_auth = NULL; in hostapd_dpp_auth_resp_retry()
108 if (hapd->dpp_resp_retry_time) in hostapd_dpp_auth_resp_retry()
109 wait_time = hapd->dpp_resp_retry_time; in hostapd_dpp_auth_resp_retry()
115 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_auth_resp_retry()
118 hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_auth_resp_retry()
122 void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst, in hostapd_dpp_tx_status() argument
125 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_tx_status()
129 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR in hostapd_dpp_tx_status()
132 if (!hapd->dpp_auth) { in hostapd_dpp_tx_status()
142 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_tx_status()
143 hapd->dpp_auth = NULL; in hostapd_dpp_tx_status()
148 if (hapd->dpp_auth->remove_on_tx_status) { in hostapd_dpp_tx_status()
151 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_tx_status()
153 hapd, NULL); in hostapd_dpp_tx_status()
154 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, in hostapd_dpp_tx_status()
156 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
157 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_tx_status()
158 hapd->dpp_auth = NULL; in hostapd_dpp_tx_status()
162 if (hapd->dpp_auth_ok_on_ack) in hostapd_dpp_tx_status()
163 hostapd_dpp_auth_success(hapd, 1); in hostapd_dpp_tx_status()
171 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
172 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_tx_status()
176 hostapd_dpp_auth_resp_retry(hapd); in hostapd_dpp_tx_status()
187 if (!hapd->dpp_auth_ok_on_ack && hapd->dpp_auth->neg_freq > 0 && in hostapd_dpp_tx_status()
188 hapd->dpp_auth->curr_freq != hapd->dpp_auth->neg_freq) { in hostapd_dpp_tx_status()
191 hapd->dpp_auth->curr_freq, in hostapd_dpp_tx_status()
192 hapd->dpp_auth->neg_freq); in hostapd_dpp_tx_status()
193 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
195 if (hapd->dpp_auth->neg_freq != in hostapd_dpp_tx_status()
196 (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_tx_status()
200 hapd->dpp_auth->neg_freq, hapd->iface->freq); in hostapd_dpp_tx_status()
204 if (hapd->dpp_auth_ok_on_ack) in hostapd_dpp_tx_status()
205 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_tx_status()
211 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_reply_wait_timeout() local
212 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_reply_wait_timeout()
220 wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_reply_wait_timeout()
221 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_reply_wait_timeout()
223 os_reltime_sub(&now, &hapd->dpp_last_init, &diff); in hostapd_dpp_reply_wait_timeout()
234 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_AUTH_INIT_FAILED); in hostapd_dpp_reply_wait_timeout()
235 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_reply_wait_timeout()
236 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reply_wait_timeout()
238 hapd->dpp_auth = NULL; in hostapd_dpp_reply_wait_timeout()
247 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_reply_wait_timeout()
248 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reply_wait_timeout()
249 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_reply_wait_timeout()
267 hapd->dpp_in_response_listen = 1; in hostapd_dpp_reply_wait_timeout()
269 if (freq != (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_reply_wait_timeout()
273 freq, hapd->iface->freq); in hostapd_dpp_reply_wait_timeout()
277 hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_reply_wait_timeout()
281 static void hostapd_dpp_set_testing_options(struct hostapd_data *hapd, in hostapd_dpp_set_testing_options() argument
285 if (hapd->dpp_config_obj_override) in hostapd_dpp_set_testing_options()
287 os_strdup(hapd->dpp_config_obj_override); in hostapd_dpp_set_testing_options()
288 if (hapd->dpp_discovery_override) in hostapd_dpp_set_testing_options()
290 os_strdup(hapd->dpp_discovery_override); in hostapd_dpp_set_testing_options()
291 if (hapd->dpp_groups_override) in hostapd_dpp_set_testing_options()
292 auth->groups_override = os_strdup(hapd->dpp_groups_override); in hostapd_dpp_set_testing_options()
294 hapd->dpp_ignore_netaccesskey_mismatch; in hostapd_dpp_set_testing_options()
301 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_init_timeout() local
303 if (!hapd->dpp_auth) in hostapd_dpp_init_timeout()
306 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_init_timeout()
310 static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd) in hostapd_dpp_auth_init_next() argument
312 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_init_next()
321 os_get_reltime(&hapd->dpp_init_iter_start); in hostapd_dpp_auth_init_next()
325 if (hapd->dpp_init_max_tries) in hostapd_dpp_auth_init_next()
326 max_tries = hapd->dpp_init_max_tries; in hostapd_dpp_auth_init_next()
332 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_auth_init_next()
335 hapd, NULL); in hostapd_dpp_auth_init_next()
336 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_init_next()
337 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init_next()
338 hapd->dpp_auth = NULL; in hostapd_dpp_auth_init_next()
342 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
343 if (hapd->dpp_init_retry_time) in hostapd_dpp_auth_init_next()
344 wait_time = hapd->dpp_init_retry_time; in hostapd_dpp_auth_init_next()
348 os_reltime_sub(&now, &hapd->dpp_init_iter_start, &diff); in hostapd_dpp_auth_init_next()
358 hostapd_dpp_init_timeout, hapd, in hostapd_dpp_auth_init_next()
369 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_auth_init_next()
370 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
372 max_wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_auth_init_next()
373 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_auth_init_next()
378 hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
385 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_auth_init_next()
389 os_get_reltime(&hapd->dpp_last_init); in hostapd_dpp_auth_init_next()
390 return hostapd_drv_send_action(hapd, freq, wait_time, in hostapd_dpp_auth_init_next()
392 wpabuf_head(hapd->dpp_auth->req_msg), in hostapd_dpp_auth_init_next()
393 wpabuf_len(hapd->dpp_auth->req_msg)); in hostapd_dpp_auth_init_next()
397 int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_auth_init() argument
408 peer_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_auth_init()
418 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, in hostapd_dpp_auth_init()
452 if (hapd->dpp_auth) { in hostapd_dpp_auth_init()
453 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_auth_init()
455 hapd, NULL); in hostapd_dpp_auth_init()
456 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, in hostapd_dpp_auth_init()
458 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_init()
459 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init()
462 hapd->dpp_auth = dpp_auth_init(hapd->msg_ctx, peer_bi, own_bi, in hostapd_dpp_auth_init()
464 hapd->iface->hw_features, in hostapd_dpp_auth_init()
465 hapd->iface->num_hw_features); in hostapd_dpp_auth_init()
466 if (!hapd->dpp_auth) in hostapd_dpp_auth_init()
468 hostapd_dpp_set_testing_options(hapd, hapd->dpp_auth); in hostapd_dpp_auth_init()
469 if (dpp_set_configurator(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_auth_init()
470 hapd->dpp_auth, cmd) < 0) { in hostapd_dpp_auth_init()
471 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init()
472 hapd->dpp_auth = NULL; in hostapd_dpp_auth_init()
476 hapd->dpp_auth->neg_freq = neg_freq; in hostapd_dpp_auth_init()
479 os_memcpy(hapd->dpp_auth->peer_mac_addr, peer_bi->mac_addr, in hostapd_dpp_auth_init()
482 return hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_auth_init()
488 int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_listen() argument
497 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR; in hostapd_dpp_listen()
499 hapd->dpp_allowed_roles = DPP_CAPAB_ENROLLEE; in hostapd_dpp_listen()
501 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | in hostapd_dpp_listen()
503 hapd->dpp_qr_mutual = os_strstr(cmd, " qr=mutual") != NULL; in hostapd_dpp_listen()
505 if (freq != hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_listen()
509 freq, hapd->iface->freq); in hostapd_dpp_listen()
517 void hostapd_dpp_listen_stop(struct hostapd_data *hapd) in hostapd_dpp_listen_stop() argument
523 static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_req() argument
531 if (!hapd->iface->interfaces->dpp) in hostapd_dpp_rx_auth_req()
540 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
550 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
559 dpp_bootstrap_find_pair(hapd->iface->interfaces->dpp, i_bootstrap, in hostapd_dpp_rx_auth_req()
563 if (dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_auth_req()
570 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
575 if (hapd->dpp_auth) { in hostapd_dpp_rx_auth_req()
576 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
581 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_rx_auth_req()
582 hapd->dpp_auth = dpp_auth_req_rx(hapd->msg_ctx, hapd->dpp_allowed_roles, in hostapd_dpp_rx_auth_req()
583 hapd->dpp_qr_mutual, in hostapd_dpp_rx_auth_req()
585 if (!hapd->dpp_auth) { in hostapd_dpp_rx_auth_req()
589 hostapd_dpp_set_testing_options(hapd, hapd->dpp_auth); in hostapd_dpp_rx_auth_req()
590 if (dpp_set_configurator(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_rx_auth_req()
591 hapd->dpp_auth, in hostapd_dpp_rx_auth_req()
592 hapd->dpp_configurator_params) < 0) { in hostapd_dpp_rx_auth_req()
593 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_rx_auth_req()
594 hapd->dpp_auth = NULL; in hostapd_dpp_rx_auth_req()
597 os_memcpy(hapd->dpp_auth->peer_mac_addr, src, ETH_ALEN); in hostapd_dpp_rx_auth_req()
599 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_auth_req()
601 MAC2STR(src), hapd->dpp_auth->curr_freq, in hostapd_dpp_rx_auth_req()
603 hostapd_drv_send_action(hapd, hapd->dpp_auth->curr_freq, 0, in hostapd_dpp_rx_auth_req()
604 src, wpabuf_head(hapd->dpp_auth->resp_msg), in hostapd_dpp_rx_auth_req()
605 wpabuf_len(hapd->dpp_auth->resp_msg)); in hostapd_dpp_rx_auth_req()
609 static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd, in hostapd_dpp_handle_config_obj() argument
612 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_RECEIVED); in hostapd_dpp_handle_config_obj()
613 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_AKM "%s", in hostapd_dpp_handle_config_obj()
616 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_SSID "%s", in hostapd_dpp_handle_config_obj()
624 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONNECTOR "%s", in hostapd_dpp_handle_config_obj()
632 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_PASS "%s", in hostapd_dpp_handle_config_obj()
638 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_PSK "%s", in hostapd_dpp_handle_config_obj()
651 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
667 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
672 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
685 struct hostapd_data *hapd = ctx; in hostapd_dpp_gas_resp_cb() local
687 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_resp_cb()
723 hostapd_dpp_handle_config_obj(hapd, auth); in hostapd_dpp_gas_resp_cb()
733 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_resp_cb()
744 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_gas_resp_cb()
748 hostapd_drv_send_action(hapd, auth->curr_freq, 0, in hostapd_dpp_gas_resp_cb()
759 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_gas_resp_cb()
760 hapd->dpp_auth = NULL; in hostapd_dpp_gas_resp_cb()
764 static void hostapd_dpp_start_gas_client(struct hostapd_data *hapd) in hostapd_dpp_start_gas_client() argument
766 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_start_gas_client()
789 res = gas_query_ap_req(hapd->gas, auth->peer_mac_addr, auth->curr_freq, in hostapd_dpp_start_gas_client()
790 buf, hostapd_dpp_gas_resp_cb, hapd); in hostapd_dpp_start_gas_client()
792 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in hostapd_dpp_start_gas_client()
802 static void hostapd_dpp_auth_success(struct hostapd_data *hapd, int initiator) in hostapd_dpp_auth_success() argument
805 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_AUTH_SUCCESS "init=%d", in hostapd_dpp_auth_success()
811 if (hapd->dpp_auth->configurator) { in hostapd_dpp_auth_success()
813 hapd->dpp_auth->auth_success = 0; in hostapd_dpp_auth_success()
819 if (!hapd->dpp_auth->configurator) in hostapd_dpp_auth_success()
820 hostapd_dpp_start_gas_client(hapd); in hostapd_dpp_auth_success()
824 static void hostapd_dpp_rx_auth_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_resp() argument
828 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_auth_resp()
847 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_rx_auth_resp()
855 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_rx_auth_resp()
867 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_auth_resp()
870 hostapd_drv_send_action(hapd, auth->curr_freq, 0, src, in hostapd_dpp_rx_auth_resp()
873 hapd->dpp_auth_ok_on_ack = 1; in hostapd_dpp_rx_auth_resp()
877 static void hostapd_dpp_rx_auth_conf(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_conf() argument
880 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_auth_conf()
902 hostapd_dpp_auth_success(hapd, 0); in hostapd_dpp_rx_auth_conf()
911 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_config_result_wait_timeout() local
912 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_config_result_wait_timeout()
919 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_config_result_wait_timeout()
921 hapd->dpp_auth = NULL; in hostapd_dpp_config_result_wait_timeout()
925 static void hostapd_dpp_rx_conf_result(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_conf_result() argument
928 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_conf_result()
948 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_rx_conf_result()
949 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_rx_conf_result()
951 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_SENT); in hostapd_dpp_rx_conf_result()
953 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_rx_conf_result()
955 hapd->dpp_auth = NULL; in hostapd_dpp_rx_conf_result()
956 eloop_cancel_timeout(hostapd_dpp_config_result_wait_timeout, hapd, in hostapd_dpp_rx_conf_result()
963 static void hostapd_dpp_send_peer_disc_resp(struct hostapd_data *hapd, in hostapd_dpp_send_peer_disc_resp() argument
971 5 + 5 + 4 + os_strlen(hapd->conf->dpp_connector)); in hostapd_dpp_send_peer_disc_resp()
1020 hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1036 wpabuf_put_le16(msg, os_strlen(hapd->conf->dpp_connector)); in hostapd_dpp_send_peer_disc_resp()
1037 wpabuf_put_str(msg, hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1046 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_send_peer_disc_resp()
1049 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_send_peer_disc_resp()
1055 static void hostapd_dpp_rx_peer_disc_req(struct hostapd_data *hapd, in hostapd_dpp_rx_peer_disc_req() argument
1070 if (!hapd->wpa_auth || in hostapd_dpp_rx_peer_disc_req()
1071 !(hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) || in hostapd_dpp_rx_peer_disc_req()
1072 !(hapd->conf->wpa & WPA_PROTO_RSN)) { in hostapd_dpp_rx_peer_disc_req()
1077 if (!hapd->conf->dpp_connector || !hapd->conf->dpp_netaccesskey || in hostapd_dpp_rx_peer_disc_req()
1078 !hapd->conf->dpp_csign) { in hostapd_dpp_rx_peer_disc_req()
1085 if (hapd->conf->dpp_netaccesskey_expiry && in hostapd_dpp_rx_peer_disc_req()
1086 (os_time_t) hapd->conf->dpp_netaccesskey_expiry < now.sec) { in hostapd_dpp_rx_peer_disc_req()
1106 res = dpp_peer_intro(&intro, hapd->conf->dpp_connector, in hostapd_dpp_rx_peer_disc_req()
1107 wpabuf_head(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_peer_disc_req()
1108 wpabuf_len(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_peer_disc_req()
1109 wpabuf_head(hapd->conf->dpp_csign), in hostapd_dpp_rx_peer_disc_req()
1110 wpabuf_len(hapd->conf->dpp_csign), in hostapd_dpp_rx_peer_disc_req()
1122 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, trans_id[0], in hostapd_dpp_rx_peer_disc_req()
1127 if (!expire || (os_time_t) hapd->conf->dpp_netaccesskey_expiry < expire) in hostapd_dpp_rx_peer_disc_req()
1128 expire = hapd->conf->dpp_netaccesskey_expiry; in hostapd_dpp_rx_peer_disc_req()
1134 if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, in hostapd_dpp_rx_peer_disc_req()
1141 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, trans_id[0], in hostapd_dpp_rx_peer_disc_req()
1147 hostapd_dpp_rx_pkex_exchange_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_exchange_req() argument
1159 if (!hapd->dpp_pkex_code || !hapd->dpp_pkex_bi) { in hostapd_dpp_rx_pkex_exchange_req()
1165 if (hapd->dpp_pkex) { in hostapd_dpp_rx_pkex_exchange_req()
1172 hapd->dpp_pkex = dpp_pkex_rx_exchange_req(hapd->msg_ctx, in hostapd_dpp_rx_pkex_exchange_req()
1173 hapd->dpp_pkex_bi, in hostapd_dpp_rx_pkex_exchange_req()
1174 hapd->own_addr, src, in hostapd_dpp_rx_pkex_exchange_req()
1175 hapd->dpp_pkex_identifier, in hostapd_dpp_rx_pkex_exchange_req()
1176 hapd->dpp_pkex_code, in hostapd_dpp_rx_pkex_exchange_req()
1178 if (!hapd->dpp_pkex) { in hostapd_dpp_rx_pkex_exchange_req()
1184 msg = hapd->dpp_pkex->exchange_resp; in hostapd_dpp_rx_pkex_exchange_req()
1185 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_exchange_req()
1188 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_exchange_req()
1190 if (hapd->dpp_pkex->failed) { in hostapd_dpp_rx_pkex_exchange_req()
1193 if (hapd->dpp_pkex->t > hapd->dpp_pkex->own_bi->pkex_t) in hostapd_dpp_rx_pkex_exchange_req()
1194 hapd->dpp_pkex->own_bi->pkex_t = hapd->dpp_pkex->t; in hostapd_dpp_rx_pkex_exchange_req()
1195 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_rx_pkex_exchange_req()
1196 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_exchange_req()
1202 hostapd_dpp_rx_pkex_exchange_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_exchange_resp() argument
1213 if (!hapd->dpp_pkex || !hapd->dpp_pkex->initiator || in hostapd_dpp_rx_pkex_exchange_resp()
1214 hapd->dpp_pkex->exchange_done) { in hostapd_dpp_rx_pkex_exchange_resp()
1219 msg = dpp_pkex_rx_exchange_resp(hapd->dpp_pkex, src, buf, len); in hostapd_dpp_rx_pkex_exchange_resp()
1228 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_exchange_resp()
1231 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_exchange_resp()
1238 hostapd_dpp_rx_pkex_commit_reveal_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_commit_reveal_req() argument
1243 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_rx_pkex_commit_reveal_req()
1257 if (hapd->dpp_pkex->failed) { in hostapd_dpp_rx_pkex_commit_reveal_req()
1259 if (hapd->dpp_pkex->t > hapd->dpp_pkex->own_bi->pkex_t) in hostapd_dpp_rx_pkex_commit_reveal_req()
1260 hapd->dpp_pkex->own_bi->pkex_t = in hostapd_dpp_rx_pkex_commit_reveal_req()
1261 hapd->dpp_pkex->t; in hostapd_dpp_rx_pkex_commit_reveal_req()
1262 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_rx_pkex_commit_reveal_req()
1263 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_req()
1271 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_commit_reveal_req()
1274 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_commit_reveal_req()
1278 bi = dpp_pkex_finish(hapd->iface->interfaces->dpp, pkex, src, freq); in hostapd_dpp_rx_pkex_commit_reveal_req()
1281 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_req()
1286 hostapd_dpp_rx_pkex_commit_reveal_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_commit_reveal_resp() argument
1292 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_rx_pkex_commit_reveal_resp()
1309 bi = dpp_pkex_finish(hapd->iface->interfaces->dpp, pkex, src, freq); in hostapd_dpp_rx_pkex_commit_reveal_resp()
1312 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_resp()
1316 hapd->dpp_pkex_auth_cmd ? hapd->dpp_pkex_auth_cmd : ""); in hostapd_dpp_rx_pkex_commit_reveal_resp()
1320 if (hostapd_dpp_auth_init(hapd, cmd) < 0) { in hostapd_dpp_rx_pkex_commit_reveal_resp()
1328 void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_action() argument
1354 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
1361 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
1366 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
1370 if (dpp_relay_rx_action(hapd->iface->interfaces->dpp, in hostapd_dpp_rx_action()
1377 hostapd_dpp_rx_auth_req(hapd, src, hdr, buf, len, freq); in hostapd_dpp_rx_action()
1380 hostapd_dpp_rx_auth_resp(hapd, src, hdr, buf, len, freq); in hostapd_dpp_rx_action()
1383 hostapd_dpp_rx_auth_conf(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
1386 hostapd_dpp_rx_peer_disc_req(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
1389 hostapd_dpp_rx_pkex_exchange_req(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
1392 hostapd_dpp_rx_pkex_exchange_resp(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
1395 hostapd_dpp_rx_pkex_commit_reveal_req(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
1399 hostapd_dpp_rx_pkex_commit_reveal_resp(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
1404 hostapd_dpp_rx_conf_result(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
1413 if (hapd->dpp_pkex) in hostapd_dpp_rx_action()
1414 pkex_t = hapd->dpp_pkex->t; in hostapd_dpp_rx_action()
1415 else if (hapd->dpp_pkex_bi) in hostapd_dpp_rx_action()
1416 pkex_t = hapd->dpp_pkex_bi->pkex_t; in hostapd_dpp_rx_action()
1420 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PKEX_T_LIMIT "id=0"); in hostapd_dpp_rx_action()
1421 hostapd_dpp_pkex_remove(hapd, "*"); in hostapd_dpp_rx_action()
1427 hostapd_dpp_gas_req_handler(struct hostapd_data *hapd, const u8 *sa, in hostapd_dpp_gas_req_handler() argument
1431 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_req_handler()
1438 if (dpp_relay_rx_gas_req(hapd->iface->interfaces->dpp, sa, data, in hostapd_dpp_gas_req_handler()
1450 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_REQ_RX "src=" MACSTR, in hostapd_dpp_gas_req_handler()
1454 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_req_handler()
1459 void hostapd_dpp_gas_status_handler(struct hostapd_data *hapd, int ok) in hostapd_dpp_gas_status_handler() argument
1461 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_status_handler()
1468 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
1469 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
1476 hapd, NULL); in hostapd_dpp_gas_status_handler()
1479 hapd, NULL); in hostapd_dpp_gas_status_handler()
1483 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_gas_status_handler()
1486 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_SENT); in hostapd_dpp_gas_status_handler()
1488 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_status_handler()
1489 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_gas_status_handler()
1490 hapd->dpp_auth = NULL; in hostapd_dpp_gas_status_handler()
1494 int hostapd_dpp_configurator_sign(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_configurator_sign() argument
1505 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_configurator_sign()
1506 if (dpp_set_configurator(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_configurator_sign()
1509 hostapd_dpp_handle_config_obj(hapd, auth); in hostapd_dpp_configurator_sign()
1520 int hostapd_dpp_pkex_add(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_pkex_add() argument
1529 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_pkex_add()
1540 hapd->dpp_pkex_bi = own_bi; in hostapd_dpp_pkex_add()
1543 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_add()
1544 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_add()
1551 hapd->dpp_pkex_identifier = os_malloc(end - pos + 1); in hostapd_dpp_pkex_add()
1552 if (!hapd->dpp_pkex_identifier) in hostapd_dpp_pkex_add()
1554 os_memcpy(hapd->dpp_pkex_identifier, pos, end - pos); in hostapd_dpp_pkex_add()
1555 hapd->dpp_pkex_identifier[end - pos] = '\0'; in hostapd_dpp_pkex_add()
1561 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_add()
1562 hapd->dpp_pkex_code = os_strdup(pos + 6); in hostapd_dpp_pkex_add()
1563 if (!hapd->dpp_pkex_code) in hostapd_dpp_pkex_add()
1570 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_pkex_add()
1571 hapd->dpp_pkex = dpp_pkex_init(hapd->msg_ctx, own_bi, in hostapd_dpp_pkex_add()
1572 hapd->own_addr, in hostapd_dpp_pkex_add()
1573 hapd->dpp_pkex_identifier, in hostapd_dpp_pkex_add()
1574 hapd->dpp_pkex_code); in hostapd_dpp_pkex_add()
1575 if (!hapd->dpp_pkex) in hostapd_dpp_pkex_add()
1578 msg = hapd->dpp_pkex->exchange_req; in hostapd_dpp_pkex_add()
1580 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_pkex_add()
1583 hostapd_drv_send_action(hapd, 2437, 0, broadcast, in hostapd_dpp_pkex_add()
1589 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pkex_add()
1590 hapd->dpp_pkex_auth_cmd = os_strdup(cmd); in hostapd_dpp_pkex_add()
1596 int hostapd_dpp_pkex_remove(struct hostapd_data *hapd, const char *id) in hostapd_dpp_pkex_remove() argument
1608 if ((id_val != 0 && id_val != 1) || !hapd->dpp_pkex_code) in hostapd_dpp_pkex_remove()
1612 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_remove()
1613 hapd->dpp_pkex_code = NULL; in hostapd_dpp_pkex_remove()
1614 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_remove()
1615 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_remove()
1616 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pkex_remove()
1617 hapd->dpp_pkex_auth_cmd = NULL; in hostapd_dpp_pkex_remove()
1618 hapd->dpp_pkex_bi = NULL; in hostapd_dpp_pkex_remove()
1620 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_pkex_remove()
1621 hapd->dpp_pkex = NULL; in hostapd_dpp_pkex_remove()
1626 void hostapd_dpp_stop(struct hostapd_data *hapd) in hostapd_dpp_stop() argument
1628 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_stop()
1629 hapd->dpp_auth = NULL; in hostapd_dpp_stop()
1630 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_stop()
1631 hapd->dpp_pkex = NULL; in hostapd_dpp_stop()
1640 struct hostapd_data *hapd = ctx; in hostapd_dpp_relay_tx() local
1651 hostapd_drv_send_action(hapd, freq, 0, addr, buf, 2 + len); in hostapd_dpp_relay_tx()
1660 struct hostapd_data *hapd = ctx; in hostapd_dpp_relay_gas_resp_tx() local
1662 gas_serv_req_dpp_processing(hapd, addr, dialog_token, prot, buf); in hostapd_dpp_relay_gas_resp_tx()
1668 static int hostapd_dpp_add_controllers(struct hostapd_data *hapd) in hostapd_dpp_add_controllers() argument
1675 config.cb_ctx = hapd; in hostapd_dpp_add_controllers()
1678 for (ctrl = hapd->conf->dpp_controller; ctrl; ctrl = ctrl->next) { in hostapd_dpp_add_controllers()
1681 if (dpp_relay_add_controller(hapd->iface->interfaces->dpp, in hostapd_dpp_add_controllers()
1691 int hostapd_dpp_init(struct hostapd_data *hapd) in hostapd_dpp_init() argument
1693 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | DPP_CAPAB_ENROLLEE; in hostapd_dpp_init()
1694 hapd->dpp_init_done = 1; in hostapd_dpp_init()
1695 return hostapd_dpp_add_controllers(hapd); in hostapd_dpp_init()
1699 void hostapd_dpp_deinit(struct hostapd_data *hapd) in hostapd_dpp_deinit() argument
1702 os_free(hapd->dpp_config_obj_override); in hostapd_dpp_deinit()
1703 hapd->dpp_config_obj_override = NULL; in hostapd_dpp_deinit()
1704 os_free(hapd->dpp_discovery_override); in hostapd_dpp_deinit()
1705 hapd->dpp_discovery_override = NULL; in hostapd_dpp_deinit()
1706 os_free(hapd->dpp_groups_override); in hostapd_dpp_deinit()
1707 hapd->dpp_groups_override = NULL; in hostapd_dpp_deinit()
1708 hapd->dpp_ignore_netaccesskey_mismatch = 0; in hostapd_dpp_deinit()
1710 if (!hapd->dpp_init_done) in hostapd_dpp_deinit()
1712 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_deinit()
1713 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_deinit()
1714 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_deinit()
1716 eloop_cancel_timeout(hostapd_dpp_config_result_wait_timeout, hapd, in hostapd_dpp_deinit()
1719 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_deinit()
1720 hapd->dpp_auth = NULL; in hostapd_dpp_deinit()
1721 hostapd_dpp_pkex_remove(hapd, "*"); in hostapd_dpp_deinit()
1722 hapd->dpp_pkex = NULL; in hostapd_dpp_deinit()
1723 os_free(hapd->dpp_configurator_params); in hostapd_dpp_deinit()
1724 hapd->dpp_configurator_params = NULL; in hostapd_dpp_deinit()