Lines Matching +full:switch +full:- +full:freq +full:- +full:select
3 * Copyright (c) 2008-2014, Jouni Malinen <j@w1.fi>
56 os_free(wpa_s->wps_ap); in wpas_wps_clear_ap_info()
57 wpa_s->wps_ap = NULL; in wpas_wps_clear_ap_info()
58 wpa_s->num_wps_ap = 0; in wpas_wps_clear_ap_info()
59 wpa_s->wps_ap_iter = 0; in wpas_wps_clear_ap_info()
87 if (bss->beacon_newer) in wpas_wps_get_wps_ie()
99 if (!wpa_s->wps_success && in wpas_wps_eapol_cb()
100 wpa_s->current_ssid && in wpas_wps_eapol_cb()
101 eap_is_wps_pin_enrollee(&wpa_s->current_ssid->eap)) { in wpas_wps_eapol_cb()
102 const u8 *bssid = wpa_s->bssid; in wpas_wps_eapol_cb()
104 bssid = wpa_s->pending_bssid; in wpas_wps_eapol_cb()
107 " did not succeed - continue trying to find " in wpas_wps_eapol_cb()
113 wpa_s->reassociate = 1; in wpas_wps_eapol_cb()
115 wpa_s->bssid_ignore_cleared ? 5 : 0, 0); in wpas_wps_eapol_cb()
116 wpa_s->bssid_ignore_cleared = false; in wpas_wps_eapol_cb()
122 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPS && !wpa_s->wps_success) in wpas_wps_eapol_cb()
125 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPS && wpa_s->current_ssid && in wpas_wps_eapol_cb()
126 !(wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_WPS)) { in wpas_wps_eapol_cb()
127 int disabled = wpa_s->current_ssid->disabled; in wpas_wps_eapol_cb()
128 unsigned int freq = wpa_s->assoc_freq; in wpas_wps_eapol_cb() local
133 wpa_printf(MSG_DEBUG, "WPS: Network configuration replaced - " in wpas_wps_eapol_cb()
135 "(freq=%u)", freq); in wpas_wps_eapol_cb()
136 wpa_s->own_disconnect_req = 1; in wpas_wps_eapol_cb()
141 "disabled - wait for user to enable"); in wpas_wps_eapol_cb()
144 wpa_s->after_wps = 5; in wpas_wps_eapol_cb()
145 wpa_s->wps_freq = freq; in wpas_wps_eapol_cb()
146 wpa_s->normal_scans = 0; in wpas_wps_eapol_cb()
147 wpa_s->reassociate = 1; in wpas_wps_eapol_cb()
179 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPS && wpa_s->current_ssid) { in wpas_wps_eapol_cb()
180 wpa_printf(MSG_DEBUG, "WPS: Registration completed - waiting " in wpas_wps_eapol_cb()
183 wpa_s->own_disconnect_req = 1; in wpas_wps_eapol_cb()
208 * actually supports stronger security and select that if the client in wpas_wps_security_workaround()
215 if (ssid->ssid == NULL) in wpas_wps_security_workaround()
217 bss = wpa_bss_get(wpa_s, cred->mac_addr, ssid->ssid, ssid->ssid_len); in wpas_wps_security_workaround()
219 bss = wpa_bss_get(wpa_s, wpa_s->bssid, in wpas_wps_security_workaround()
220 ssid->ssid, ssid->ssid_len); in wpas_wps_security_workaround()
223 "table - use credential as-is"); in wpas_wps_security_workaround()
241 if (ie == NULL && (ssid->proto & WPA_PROTO_WPA) && in wpas_wps_security_workaround()
242 (ssid->pairwise_cipher & WPA_CIPHER_TKIP)) { in wpas_wps_security_workaround()
250 "support - use credential as-is"); in wpas_wps_security_workaround()
254 iftype = ssid->p2p_group ? WPA_IF_P2P_CLIENT : WPA_IF_STATION; in wpas_wps_security_workaround()
256 if (ccmp && !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) && in wpas_wps_security_workaround()
257 (ssid->pairwise_cipher & WPA_CIPHER_TKIP) && in wpas_wps_security_workaround()
262 if (wpa_s->conf->ap_scan == 1) in wpas_wps_security_workaround()
263 ssid->pairwise_cipher |= WPA_CIPHER_CCMP; in wpas_wps_security_workaround()
265 ssid->pairwise_cipher = WPA_CIPHER_CCMP; in wpas_wps_security_workaround()
268 if (wpa2 && !(ssid->proto & WPA_PROTO_RSN) && in wpas_wps_security_workaround()
269 (ssid->proto & WPA_PROTO_WPA) && in wpas_wps_security_workaround()
273 if (wpa_s->conf->ap_scan == 1) in wpas_wps_security_workaround()
274 ssid->proto |= WPA_PROTO_RSN; in wpas_wps_security_workaround()
276 ssid->proto = WPA_PROTO_RSN; in wpas_wps_security_workaround()
286 for (ssid = wpa_s->conf->ssid, next = ssid ? ssid->next : NULL; ssid; in wpas_wps_remove_dup_network()
287 ssid = next, next = ssid ? ssid->next : NULL) { in wpas_wps_remove_dup_network()
295 if (ssid->bssid_set || new_ssid->bssid_set) { in wpas_wps_remove_dup_network()
296 if (ssid->bssid_set != new_ssid->bssid_set) in wpas_wps_remove_dup_network()
298 if (!ether_addr_equal(ssid->bssid, new_ssid->bssid)) in wpas_wps_remove_dup_network()
303 if (ssid->ssid_len == 0 || ssid->ssid_len != new_ssid->ssid_len) in wpas_wps_remove_dup_network()
306 if (ssid->ssid && new_ssid->ssid) { in wpas_wps_remove_dup_network()
307 if (os_memcmp(ssid->ssid, new_ssid->ssid, in wpas_wps_remove_dup_network()
308 ssid->ssid_len) != 0) in wpas_wps_remove_dup_network()
310 } else if (ssid->ssid || new_ssid->ssid) in wpas_wps_remove_dup_network()
314 if (ssid->auth_alg != new_ssid->auth_alg || in wpas_wps_remove_dup_network()
315 ssid->key_mgmt != new_ssid->key_mgmt || in wpas_wps_remove_dup_network()
316 (ssid->group_cipher != new_ssid->group_cipher && in wpas_wps_remove_dup_network()
317 !(ssid->group_cipher & new_ssid->group_cipher & in wpas_wps_remove_dup_network()
327 if (ssid->wps_run && ssid->wps_run == new_ssid->wps_run && in wpas_wps_remove_dup_network()
328 wpa_key_mgmt_wpa_psk(ssid->key_mgmt)) { in wpas_wps_remove_dup_network()
329 if (new_ssid->passphrase && ssid->passphrase && in wpas_wps_remove_dup_network()
330 os_strcmp(new_ssid->passphrase, ssid->passphrase) != in wpas_wps_remove_dup_network()
333 "WPS: M8 Creds with different passphrase - do not merge"); in wpas_wps_remove_dup_network()
337 if (new_ssid->psk_set && in wpas_wps_remove_dup_network()
338 (!ssid->psk_set || in wpas_wps_remove_dup_network()
339 os_memcmp(new_ssid->psk, ssid->psk, 32) != 0)) { in wpas_wps_remove_dup_network()
341 "WPS: M8 Creds with different PSK - do not merge"); in wpas_wps_remove_dup_network()
345 if ((new_ssid->passphrase && !ssid->passphrase) || in wpas_wps_remove_dup_network()
346 (!new_ssid->passphrase && ssid->passphrase)) { in wpas_wps_remove_dup_network()
348 "WPS: M8 Creds with different passphrase/PSK type - do not merge"); in wpas_wps_remove_dup_network()
353 "WPS: Workaround - merge likely WPA/WPA2-mixed mode creds in same M8 message"); in wpas_wps_remove_dup_network()
354 new_ssid->proto |= ssid->proto; in wpas_wps_remove_dup_network()
355 new_ssid->pairwise_cipher |= ssid->pairwise_cipher; in wpas_wps_remove_dup_network()
359 * non-mixed-mode creds. in wpas_wps_remove_dup_network()
361 if (ssid->proto != new_ssid->proto || in wpas_wps_remove_dup_network()
362 ssid->pairwise_cipher != new_ssid->pairwise_cipher) in wpas_wps_remove_dup_network()
367 wpa_printf(MSG_DEBUG, "Remove duplicate network %d", ssid->id); in wpas_wps_remove_dup_network()
369 wpa_config_remove_network(wpa_s->conf, ssid->id); in wpas_wps_remove_dup_network()
378 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_wps_cred()
385 if ((wpa_s->conf->wps_cred_processing == 1 || in wpa_supplicant_wps_cred()
386 wpa_s->conf->wps_cred_processing == 2) && cred->cred_attr) { in wpa_supplicant_wps_cred()
387 size_t blen = cred->cred_attr_len * 2 + 1; in wpa_supplicant_wps_cred()
391 cred->cred_attr, cred->cred_attr_len); in wpa_supplicant_wps_cred()
402 cred->cred_attr, cred->cred_attr_len); in wpa_supplicant_wps_cred()
404 if (wpa_s->conf->wps_cred_processing == 1) in wpa_supplicant_wps_cred()
407 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", cred->ssid, cred->ssid_len); in wpa_supplicant_wps_cred()
409 cred->auth_type); in wpa_supplicant_wps_cred()
410 wpa_printf(MSG_DEBUG, "WPS: Encryption Type 0x%x", cred->encr_type); in wpa_supplicant_wps_cred()
411 wpa_printf(MSG_DEBUG, "WPS: Network Key Index %d", cred->key_idx); in wpa_supplicant_wps_cred()
413 cred->key, cred->key_len); in wpa_supplicant_wps_cred()
415 MAC2STR(cred->mac_addr)); in wpa_supplicant_wps_cred()
417 auth_type = cred->auth_type; in wpa_supplicant_wps_cred()
419 wpa_printf(MSG_DEBUG, "WPS: Workaround - convert mixed-mode " in wpa_supplicant_wps_cred()
434 if (cred->key_len < 8 || cred->key_len > 2 * PMK_LEN) { in wpa_supplicant_wps_cred()
437 (unsigned long) cred->key_len); in wpa_supplicant_wps_cred()
438 return -1; in wpa_supplicant_wps_cred()
442 if (ssid && (ssid->key_mgmt & WPA_KEY_MGMT_WPS)) { in wpa_supplicant_wps_cred()
446 if (ssid->eap.identity && in wpa_supplicant_wps_cred()
447 ssid->eap.identity_len == WSC_ID_REGISTRAR_LEN && in wpa_supplicant_wps_cred()
448 os_memcmp(ssid->eap.identity, WSC_ID_REGISTRAR, in wpa_supplicant_wps_cred()
452 os_free(ssid->eap.identity); in wpa_supplicant_wps_cred()
453 ssid->eap.identity = NULL; in wpa_supplicant_wps_cred()
454 ssid->eap.identity_len = 0; in wpa_supplicant_wps_cred()
455 os_free(ssid->eap.phase1); in wpa_supplicant_wps_cred()
456 ssid->eap.phase1 = NULL; in wpa_supplicant_wps_cred()
457 os_free(ssid->eap.eap_methods); in wpa_supplicant_wps_cred()
458 ssid->eap.eap_methods = NULL; in wpa_supplicant_wps_cred()
459 if (!ssid->p2p_group) { in wpa_supplicant_wps_cred()
460 ssid->temporary = 0; in wpa_supplicant_wps_cred()
461 ssid->bssid_set = 0; in wpa_supplicant_wps_cred()
463 ssid->disabled_until.sec = 0; in wpa_supplicant_wps_cred()
464 ssid->disabled_until.usec = 0; in wpa_supplicant_wps_cred()
465 ssid->auth_failures = 0; in wpa_supplicant_wps_cred()
469 ssid = wpa_config_add_network(wpa_s->conf); in wpa_supplicant_wps_cred()
471 return -1; in wpa_supplicant_wps_cred()
472 if (wpa_s->current_ssid) { in wpa_supplicant_wps_cred()
477 * marked as such based on the pre-configured values in wpa_supplicant_wps_cred()
480 ssid->p2p_group = wpa_s->current_ssid->p2p_group; in wpa_supplicant_wps_cred()
481 ssid->temporary = wpa_s->current_ssid->temporary; in wpa_supplicant_wps_cred()
487 ssid->wps_run = wpa_s->wps_run; in wpa_supplicant_wps_cred()
489 os_free(ssid->ssid); in wpa_supplicant_wps_cred()
490 ssid->ssid = os_malloc(cred->ssid_len); in wpa_supplicant_wps_cred()
491 if (ssid->ssid) { in wpa_supplicant_wps_cred()
492 os_memcpy(ssid->ssid, cred->ssid, cred->ssid_len); in wpa_supplicant_wps_cred()
493 ssid->ssid_len = cred->ssid_len; in wpa_supplicant_wps_cred()
496 switch (cred->encr_type) { in wpa_supplicant_wps_cred()
500 ssid->pairwise_cipher = WPA_CIPHER_TKIP | WPA_CIPHER_CCMP; in wpa_supplicant_wps_cred()
503 ssid->pairwise_cipher = WPA_CIPHER_CCMP; in wpa_supplicant_wps_cred()
504 if (wpa_s->drv_capa_known && in wpa_supplicant_wps_cred()
505 (wpa_s->drv_enc & WPA_DRIVER_CAPA_ENC_GCMP)) { in wpa_supplicant_wps_cred()
506 ssid->pairwise_cipher |= WPA_CIPHER_GCMP; in wpa_supplicant_wps_cred()
507 ssid->group_cipher |= WPA_CIPHER_GCMP; in wpa_supplicant_wps_cred()
509 if (wpa_s->drv_capa_known && in wpa_supplicant_wps_cred()
510 (wpa_s->drv_enc & WPA_DRIVER_CAPA_ENC_GCMP_256)) { in wpa_supplicant_wps_cred()
511 ssid->pairwise_cipher |= WPA_CIPHER_GCMP_256; in wpa_supplicant_wps_cred()
512 ssid->group_cipher |= WPA_CIPHER_GCMP_256; in wpa_supplicant_wps_cred()
514 if (wpa_s->drv_capa_known && in wpa_supplicant_wps_cred()
515 (wpa_s->drv_enc & WPA_DRIVER_CAPA_ENC_CCMP_256)) { in wpa_supplicant_wps_cred()
516 ssid->pairwise_cipher |= WPA_CIPHER_CCMP_256; in wpa_supplicant_wps_cred()
517 ssid->group_cipher |= WPA_CIPHER_CCMP_256; in wpa_supplicant_wps_cred()
522 switch (auth_type) { in wpa_supplicant_wps_cred()
524 ssid->auth_alg = WPA_AUTH_ALG_OPEN; in wpa_supplicant_wps_cred()
525 ssid->key_mgmt = WPA_KEY_MGMT_NONE; in wpa_supplicant_wps_cred()
526 ssid->proto = 0; in wpa_supplicant_wps_cred()
530 "id=%d - Credentials for an open " in wpa_supplicant_wps_cred()
531 "network disabled by default - use " in wpa_supplicant_wps_cred()
533 ssid->id, ssid->id); in wpa_supplicant_wps_cred()
534 ssid->disabled = 1; in wpa_supplicant_wps_cred()
539 ssid->auth_alg = WPA_AUTH_ALG_OPEN; in wpa_supplicant_wps_cred()
540 ssid->key_mgmt = WPA_KEY_MGMT_PSK; in wpa_supplicant_wps_cred()
541 ssid->proto = WPA_PROTO_WPA | WPA_PROTO_RSN; in wpa_supplicant_wps_cred()
544 ssid->auth_alg = WPA_AUTH_ALG_OPEN; in wpa_supplicant_wps_cred()
545 ssid->key_mgmt = WPA_KEY_MGMT_PSK; in wpa_supplicant_wps_cred()
546 add_sae = wpa_s->conf->wps_cred_add_sae; in wpa_supplicant_wps_cred()
548 if (ssid->p2p_group && is_p2p_6ghz_capable(wpa_s->global->p2p)) in wpa_supplicant_wps_cred()
551 if (add_sae && cred->key_len != 2 * PMK_LEN) { in wpa_supplicant_wps_cred()
552 ssid->auth_alg = 0; in wpa_supplicant_wps_cred()
553 ssid->key_mgmt |= WPA_KEY_MGMT_SAE; in wpa_supplicant_wps_cred()
554 ssid->ieee80211w = MGMT_FRAME_PROTECTION_OPTIONAL; in wpa_supplicant_wps_cred()
556 ssid->proto = WPA_PROTO_RSN; in wpa_supplicant_wps_cred()
560 if (ssid->key_mgmt & WPA_KEY_MGMT_PSK) { in wpa_supplicant_wps_cred()
561 if (cred->key_len == 2 * PMK_LEN) { in wpa_supplicant_wps_cred()
562 if (hexstr2bin((const char *) cred->key, ssid->psk, in wpa_supplicant_wps_cred()
566 return -1; in wpa_supplicant_wps_cred()
568 ssid->psk_set = 1; in wpa_supplicant_wps_cred()
569 ssid->export_keys = 1; in wpa_supplicant_wps_cred()
570 } else if (cred->key_len >= 8 && cred->key_len < 2 * PMK_LEN) { in wpa_supplicant_wps_cred()
571 os_free(ssid->passphrase); in wpa_supplicant_wps_cred()
572 ssid->passphrase = os_malloc(cred->key_len + 1); in wpa_supplicant_wps_cred()
573 if (ssid->passphrase == NULL) in wpa_supplicant_wps_cred()
574 return -1; in wpa_supplicant_wps_cred()
575 os_memcpy(ssid->passphrase, cred->key, cred->key_len); in wpa_supplicant_wps_cred()
576 ssid->passphrase[cred->key_len] = '\0'; in wpa_supplicant_wps_cred()
578 ssid->export_keys = 1; in wpa_supplicant_wps_cred()
582 (unsigned long) cred->key_len); in wpa_supplicant_wps_cred()
583 return -1; in wpa_supplicant_wps_cred()
586 ssid->priority = wpa_s->conf->wps_priority; in wpa_supplicant_wps_cred()
593 if (wpa_s->conf->update_config && in wpa_supplicant_wps_cred()
594 wpa_config_write(wpa_s->confname, wpa_s->conf)) { in wpa_supplicant_wps_cred()
596 return -1; in wpa_supplicant_wps_cred()
600 if (ssid->priority) in wpa_supplicant_wps_cred()
601 wpa_config_update_prio_list(wpa_s->conf); in wpa_supplicant_wps_cred()
604 * Optimize the post-WPS scan based on the channel used during in wpa_supplicant_wps_cred()
605 * the provisioning in case EAP-Failure is not received. in wpa_supplicant_wps_cred()
607 wpa_s->after_wps = 5; in wpa_supplicant_wps_cred()
608 wpa_s->wps_freq = wpa_s->assoc_freq; in wpa_supplicant_wps_cred()
619 m2d->dev_password_id, m2d->config_error); in wpa_supplicant_wps_event_m2d()
622 if (wpa_s->p2pdev && wpa_s->p2pdev != wpa_s) { in wpa_supplicant_wps_event_m2d()
623 wpa_msg(wpa_s->p2pdev, MSG_INFO, WPS_EVENT_M2D in wpa_supplicant_wps_event_m2d()
625 m2d->dev_password_id, m2d->config_error); in wpa_supplicant_wps_event_m2d()
627 if (m2d->config_error == WPS_CFG_MULTIPLE_PBC_DETECTED) { in wpa_supplicant_wps_event_m2d()
650 if (fail->error_indication > 0 && in wpa_supplicant_wps_event_fail()
651 fail->error_indication < NUM_WPS_EI_VALUES) { in wpa_supplicant_wps_event_fail()
654 fail->msg, fail->config_error, fail->error_indication, in wpa_supplicant_wps_event_fail()
655 wps_ei_str(fail->error_indication)); in wpa_supplicant_wps_event_fail()
656 if (wpa_s->p2pdev && wpa_s->p2pdev != wpa_s) in wpa_supplicant_wps_event_fail()
657 wpa_msg(wpa_s->p2pdev, MSG_INFO, WPS_EVENT_FAIL in wpa_supplicant_wps_event_fail()
659 fail->msg, fail->config_error, in wpa_supplicant_wps_event_fail()
660 fail->error_indication, in wpa_supplicant_wps_event_fail()
661 wps_ei_str(fail->error_indication)); in wpa_supplicant_wps_event_fail()
665 fail->msg, fail->config_error); in wpa_supplicant_wps_event_fail()
666 if (wpa_s->p2pdev && wpa_s->p2pdev != wpa_s) in wpa_supplicant_wps_event_fail()
667 wpa_msg(wpa_s->p2pdev, MSG_INFO, WPS_EVENT_FAIL in wpa_supplicant_wps_event_fail()
669 fail->msg, fail->config_error); in wpa_supplicant_wps_event_fail()
693 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpas_wps_reenable_networks()
694 if (ssid->disabled_for_connect && ssid->disabled) { in wpas_wps_reenable_networks()
695 ssid->disabled_for_connect = 0; in wpas_wps_reenable_networks()
696 ssid->disabled = 0; in wpas_wps_reenable_networks()
704 if (wpa_s->conf->update_config && in wpas_wps_reenable_networks()
705 wpa_config_write(wpa_s->confname, wpa_s->conf)) { in wpas_wps_reenable_networks()
732 wpa_s->wps_success = 1; in wpa_supplicant_wps_event_success()
734 if (wpa_s->current_ssid) in wpa_supplicant_wps_event_success()
735 wpas_clear_temp_disabled(wpa_s, wpa_s->current_ssid, 1); in wpa_supplicant_wps_event_success()
736 wpa_s->consecutive_conn_failures = 0; in wpa_supplicant_wps_event_success()
746 wpas_p2p_wps_success(wpa_s, wpa_s->bssid, 0); in wpa_supplicant_wps_event_success()
756 uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str)); in wpa_supplicant_wps_event_er_ap_add()
757 if (ap->pri_dev_type) in wpa_supplicant_wps_event_er_ap_add()
758 wps_dev_type_bin2str(ap->pri_dev_type, dev_type, in wpa_supplicant_wps_event_er_ap_add()
765 uuid_str, MAC2STR(ap->mac_addr), dev_type, ap->wps_state, in wpa_supplicant_wps_event_er_ap_add()
766 ap->friendly_name ? ap->friendly_name : "", in wpa_supplicant_wps_event_er_ap_add()
767 ap->manufacturer ? ap->manufacturer : "", in wpa_supplicant_wps_event_er_ap_add()
768 ap->model_description ? ap->model_description : "", in wpa_supplicant_wps_event_er_ap_add()
769 ap->model_name ? ap->model_name : "", in wpa_supplicant_wps_event_er_ap_add()
770 ap->manufacturer_url ? ap->manufacturer_url : "", in wpa_supplicant_wps_event_er_ap_add()
771 ap->model_url ? ap->model_url : ""); in wpa_supplicant_wps_event_er_ap_add()
779 uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str)); in wpa_supplicant_wps_event_er_ap_remove()
790 uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str)); in wpa_supplicant_wps_event_er_enrollee_add()
791 if (enrollee->pri_dev_type) in wpa_supplicant_wps_event_er_enrollee_add()
792 wps_dev_type_bin2str(enrollee->pri_dev_type, dev_type, in wpa_supplicant_wps_event_er_enrollee_add()
800 uuid_str, MAC2STR(enrollee->mac_addr), enrollee->m1_received, in wpa_supplicant_wps_event_er_enrollee_add()
801 enrollee->config_methods, enrollee->dev_passwd_id, dev_type, in wpa_supplicant_wps_event_er_enrollee_add()
802 enrollee->dev_name ? enrollee->dev_name : "", in wpa_supplicant_wps_event_er_enrollee_add()
803 enrollee->manufacturer ? enrollee->manufacturer : "", in wpa_supplicant_wps_event_er_enrollee_add()
804 enrollee->model_name ? enrollee->model_name : "", in wpa_supplicant_wps_event_er_enrollee_add()
805 enrollee->model_number ? enrollee->model_number : "", in wpa_supplicant_wps_event_er_enrollee_add()
806 enrollee->serial_number ? enrollee->serial_number : ""); in wpa_supplicant_wps_event_er_enrollee_add()
814 uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str)); in wpa_supplicant_wps_event_er_enrollee_remove()
816 uuid_str, MAC2STR(enrollee->mac_addr)); in wpa_supplicant_wps_event_er_enrollee_remove()
826 const struct wps_credential *cred = ap_settings->cred; in wpa_supplicant_wps_event_er_ap_settings()
829 if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK)) { in wpa_supplicant_wps_event_er_ap_settings()
830 if (cred->key_len >= 8 && cred->key_len <= 64) { in wpa_supplicant_wps_event_er_ap_settings()
831 os_memcpy(key_str, cred->key, cred->key_len); in wpa_supplicant_wps_event_er_ap_settings()
832 key_str[cred->key_len] = '\0'; in wpa_supplicant_wps_event_er_ap_settings()
836 uuid_bin2str(ap_settings->uuid, uuid_str, sizeof(uuid_str)); in wpa_supplicant_wps_event_er_ap_settings()
841 uuid_str, wpa_ssid_txt(cred->ssid, cred->ssid_len), in wpa_supplicant_wps_event_er_ap_settings()
842 cred->auth_type, cred->encr_type, key_str); in wpa_supplicant_wps_event_er_ap_settings()
852 uuid_bin2str(ev->uuid, uuid_str, sizeof(uuid_str)); in wpa_supplicant_wps_event_er_set_sel_reg()
853 switch (ev->state) { in wpa_supplicant_wps_event_er_set_sel_reg()
858 uuid_str, ev->sel_reg, ev->dev_passwd_id, in wpa_supplicant_wps_event_er_set_sel_reg()
859 ev->sel_reg_config_methods); in wpa_supplicant_wps_event_er_set_sel_reg()
877 switch (event) { in wpa_supplicant_wps_event()
879 wpa_supplicant_wps_event_m2d(wpa_s, &data->m2d); in wpa_supplicant_wps_event()
882 wpa_supplicant_wps_event_fail(wpa_s, &data->fail); in wpa_supplicant_wps_event()
889 if (wpa_s->ap_iface && data->pwd_auth_fail.enrollee) in wpa_supplicant_wps_event()
904 wpa_supplicant_wps_event_er_ap_add(wpa_s, &data->ap); in wpa_supplicant_wps_event()
907 wpa_supplicant_wps_event_er_ap_remove(wpa_s, &data->ap); in wpa_supplicant_wps_event()
911 &data->enrollee); in wpa_supplicant_wps_event()
915 &data->enrollee); in wpa_supplicant_wps_event()
919 &data->ap_settings); in wpa_supplicant_wps_event()
923 &data->set_sel_reg); in wpa_supplicant_wps_event()
935 if (!wpa_s->current_ssid || !wpa_s->assoc_freq) in wpa_supplicant_wps_rf_band()
938 return (wpa_s->assoc_freq > 50000) ? WPS_RF_60GHZ : in wpa_supplicant_wps_rf_band()
939 (wpa_s->assoc_freq > 2484) ? WPS_RF_50GHZ : WPS_RF_24GHZ; in wpa_supplicant_wps_rf_band()
945 if (eap_is_wps_pbc_enrollee(&ssid->eap) || in wpas_wps_get_req_type()
946 eap_is_wps_pin_enrollee(&ssid->eap)) in wpas_wps_get_req_type()
958 wpa_s->after_wps = 0; in wpas_clear_wps()
959 wpa_s->known_wps_freq = 0; in wpas_clear_wps()
961 prev_current = wpa_s->current_ssid; in wpas_clear_wps()
970 ssid = wpa_s->conf->ssid; in wpas_clear_wps()
972 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) { in wpas_clear_wps()
973 if (ssid == wpa_s->current_ssid) { in wpas_clear_wps()
974 wpa_s->own_disconnect_req = 1; in wpas_clear_wps()
978 id = ssid->id; in wpas_clear_wps()
981 id = -1; in wpas_clear_wps()
982 ssid = ssid->next; in wpas_clear_wps()
985 wpa_sm_set_config(wpa_s->wpa, NULL); in wpas_clear_wps()
986 eapol_sm_notify_config(wpa_s->eapol, NULL, in wpas_clear_wps()
990 wpa_config_remove_network(wpa_s->conf, id); in wpas_clear_wps()
1012 * during an EAP-WSC exchange). in wpas_wps_timeout()
1015 wpa_s->supp_pbc_active = false; in wpas_wps_timeout()
1016 wpa_s->wps_overlap = false; in wpas_wps_timeout()
1027 ssid = wpa_config_add_network(wpa_s->conf); in wpas_wps_add_network()
1032 ssid->temporary = 1; in wpas_wps_add_network()
1039 wpa_config_remove_network(wpa_s->conf, ssid->id); in wpas_wps_add_network()
1045 os_memcpy(ssid->go_p2p_dev_addr, dev_addr, ETH_ALEN); in wpas_wps_add_network()
1054 os_memcpy(ssid->bssid, bssid, ETH_ALEN); in wpas_wps_add_network()
1055 ssid->bssid_set = 1; in wpas_wps_add_network()
1063 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { in wpas_wps_add_network()
1064 if (!ether_addr_equal(bssid, bss->bssid)) in wpas_wps_add_network()
1067 os_free(ssid->ssid); in wpas_wps_add_network()
1068 ssid->ssid = os_memdup(bss->ssid, bss->ssid_len); in wpas_wps_add_network()
1069 if (ssid->ssid == NULL) in wpas_wps_add_network()
1071 ssid->ssid_len = bss->ssid_len; in wpas_wps_add_network()
1074 ssid->ssid, ssid->ssid_len); in wpas_wps_add_network()
1081 os_free(ssid->ssid); in wpas_wps_add_network()
1082 ssid->ssid = NULL; in wpas_wps_add_network()
1083 ssid->ssid_len = 0; in wpas_wps_add_network()
1097 if (wpa_s->current_ssid) { in wpas_wps_temp_disable()
1098 wpa_s->own_disconnect_req = 1; in wpas_wps_temp_disable()
1104 ssid = wpa_s->conf->ssid; in wpas_wps_temp_disable()
1106 int was_disabled = ssid->disabled; in wpas_wps_temp_disable()
1107 ssid->disabled_for_connect = 0; in wpas_wps_temp_disable()
1115 ssid->disabled = ssid != selected; in wpas_wps_temp_disable()
1116 if (was_disabled != ssid->disabled) { in wpas_wps_temp_disable()
1117 if (ssid->disabled) in wpas_wps_temp_disable()
1118 ssid->disabled_for_connect = 1; in wpas_wps_temp_disable()
1123 ssid = ssid->next; in wpas_wps_temp_disable()
1130 int freq) in wpas_wps_reassoc() argument
1134 wpa_s->wps_run++; in wpas_wps_reassoc()
1135 if (wpa_s->wps_run == 0) in wpas_wps_reassoc()
1136 wpa_s->wps_run++; in wpas_wps_reassoc()
1137 wpa_s->after_wps = 0; in wpas_wps_reassoc()
1138 wpa_s->known_wps_freq = 0; in wpas_wps_reassoc()
1139 if (freq) { in wpas_wps_reassoc()
1140 wpa_s->after_wps = 5; in wpas_wps_reassoc()
1141 wpa_s->wps_freq = freq; in wpas_wps_reassoc()
1144 if (bss && bss->freq > 0) { in wpas_wps_reassoc()
1145 wpa_s->known_wps_freq = 1; in wpas_wps_reassoc()
1146 wpa_s->wps_freq = bss->freq; in wpas_wps_reassoc()
1152 wpa_s->disconnected = 0; in wpas_wps_reassoc()
1153 wpa_s->reassociate = 1; in wpas_wps_reassoc()
1154 wpa_s->scan_runs = 0; in wpas_wps_reassoc()
1155 wpa_s->normal_scans = 0; in wpas_wps_reassoc()
1156 wpa_s->wps_success = 0; in wpas_wps_reassoc()
1157 wpa_s->bssid_ignore_cleared = false; in wpas_wps_reassoc()
1171 if (wpa_s->ap_iface) { in wpas_wps_start_pbc()
1174 return -1; in wpas_wps_start_pbc()
1180 return -1; in wpas_wps_start_pbc()
1181 ssid->temporary = 1; in wpas_wps_start_pbc()
1182 ssid->p2p_group = p2p_group; in wpas_wps_start_pbc()
1189 ssid->pbss = 2; in wpas_wps_start_pbc()
1191 if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) { in wpas_wps_start_pbc()
1192 ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1); in wpas_wps_start_pbc()
1193 if (ssid->ssid) { in wpas_wps_start_pbc()
1194 ssid->ssid_len = wpa_s->go_params->ssid_len; in wpas_wps_start_pbc()
1195 os_memcpy(ssid->ssid, wpa_s->go_params->ssid, in wpas_wps_start_pbc()
1196 ssid->ssid_len); in wpas_wps_start_pbc()
1197 if (wpa_s->go_params->freq > 56160) { in wpas_wps_start_pbc()
1199 ssid->pbss = 1; in wpas_wps_start_pbc()
1201 if (wpa_s->go_params->edmg && in wpas_wps_start_pbc()
1203 wpa_s->go_params) == 0) in wpas_wps_start_pbc()
1204 ssid->enable_edmg = 1; in wpas_wps_start_pbc()
1207 "SSID", ssid->ssid, ssid->ssid_len); in wpas_wps_start_pbc()
1217 return -1; in wpas_wps_start_pbc()
1218 if (wpa_s->wps_fragment_size) in wpas_wps_start_pbc()
1219 ssid->eap.fragment_size = wpa_s->wps_fragment_size; in wpas_wps_start_pbc()
1221 ssid->multi_ap_backhaul_sta = 1; in wpas_wps_start_pbc()
1222 ssid->multi_ap_profile = multi_ap_backhaul_sta; in wpas_wps_start_pbc()
1224 wpa_s->supp_pbc_active = true; in wpas_wps_start_pbc()
1225 wpa_s->wps_overlap = false; in wpas_wps_start_pbc()
1238 const u8 *ssid_val, size_t ssid_len, int freq) in wpas_wps_start_dev_pw() argument
1246 if (wpa_s->ap_iface) { in wpas_wps_start_dev_pw()
1249 return -1; in wpas_wps_start_dev_pw()
1258 return -1; in wpas_wps_start_dev_pw()
1260 ssid->temporary = 1; in wpas_wps_start_dev_pw()
1261 ssid->p2p_group = p2p_group; in wpas_wps_start_dev_pw()
1268 ssid->pbss = 2; in wpas_wps_start_dev_pw()
1270 ssid->ssid = os_malloc(ssid_len); in wpas_wps_start_dev_pw()
1271 if (ssid->ssid) { in wpas_wps_start_dev_pw()
1272 os_memcpy(ssid->ssid, ssid_val, ssid_len); in wpas_wps_start_dev_pw()
1273 ssid->ssid_len = ssid_len; in wpas_wps_start_dev_pw()
1278 wpa_snprintf_hex_uppercase(hash + 8, sizeof(hash) - 8, in wpas_wps_start_dev_pw()
1285 if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) { in wpas_wps_start_dev_pw()
1286 os_free(ssid->ssid); in wpas_wps_start_dev_pw()
1287 ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1); in wpas_wps_start_dev_pw()
1288 if (ssid->ssid) { in wpas_wps_start_dev_pw()
1289 ssid->ssid_len = wpa_s->go_params->ssid_len; in wpas_wps_start_dev_pw()
1290 os_memcpy(ssid->ssid, wpa_s->go_params->ssid, in wpas_wps_start_dev_pw()
1291 ssid->ssid_len); in wpas_wps_start_dev_pw()
1292 if (wpa_s->go_params->freq > 56160) { in wpas_wps_start_dev_pw()
1294 ssid->pbss = 1; in wpas_wps_start_dev_pw()
1296 if (wpa_s->go_params->edmg && in wpas_wps_start_dev_pw()
1298 wpa_s->go_params) == 0) in wpas_wps_start_dev_pw()
1299 ssid->enable_edmg = 1; in wpas_wps_start_dev_pw()
1302 "SSID", ssid->ssid, ssid->ssid_len); in wpas_wps_start_dev_pw()
1315 return -1; in wpas_wps_start_dev_pw()
1322 return -1; in wpas_wps_start_dev_pw()
1328 if (wpa_s->wps_fragment_size) in wpas_wps_start_dev_pw()
1329 ssid->eap.fragment_size = wpa_s->wps_fragment_size; in wpas_wps_start_dev_pw()
1332 wpa_s->wps_ap_iter = 1; in wpas_wps_start_dev_pw()
1333 wpas_wps_reassoc(wpa_s, ssid, bssid, freq); in wpas_wps_start_dev_pw()
1341 os_get_reltime(&wpa_s->wps_pin_start_time); in wpas_wps_start_pin()
1358 * during an EAP-WSC exchange). in wpas_wps_pbc_overlap()
1367 if (wpa_s->ap_iface) { in wpas_wps_cancel()
1373 if (wpa_s->wpa_state == WPA_SCANNING || in wpas_wps_cancel()
1374 wpa_s->wpa_state == WPA_DISCONNECTED) { in wpas_wps_cancel()
1375 wpa_printf(MSG_DEBUG, "WPS: Cancel operation - cancel scan"); in wpas_wps_cancel()
1378 } else if (wpa_s->wpa_state >= WPA_ASSOCIATED) { in wpas_wps_cancel()
1379 wpa_printf(MSG_DEBUG, "WPS: Cancel operation - " in wpas_wps_cancel()
1381 wpa_s->own_disconnect_req = 1; in wpas_wps_cancel()
1393 wpa_s->supp_pbc_active = false; in wpas_wps_cancel()
1394 wpa_s->wps_overlap = false; in wpas_wps_cancel()
1396 wpa_s->after_wps = 0; in wpas_wps_cancel()
1411 if (wpa_s->ap_iface) { in wpas_wps_start_reg()
1414 return -1; in wpas_wps_start_reg()
1418 return -1; in wpas_wps_start_reg()
1422 return -1; in wpas_wps_start_reg()
1423 ssid->temporary = 1; in wpas_wps_start_reg()
1426 res = os_snprintf(pos, end - pos, "\"pin=%s", pin); in wpas_wps_start_reg()
1427 if (os_snprintf_error(end - pos, res)) in wpas_wps_start_reg()
1428 return -1; in wpas_wps_start_reg()
1431 res = os_snprintf(pos, end - pos, " new_ssid=%s new_auth=%s " in wpas_wps_start_reg()
1433 settings->ssid_hex, settings->auth, in wpas_wps_start_reg()
1434 settings->encr, settings->key_hex); in wpas_wps_start_reg()
1435 if (os_snprintf_error(end - pos, res)) in wpas_wps_start_reg()
1436 return -1; in wpas_wps_start_reg()
1439 res = os_snprintf(pos, end - pos, "\""); in wpas_wps_start_reg()
1440 if (os_snprintf_error(end - pos, res)) in wpas_wps_start_reg()
1441 return -1; in wpas_wps_start_reg()
1443 return -1; in wpas_wps_start_reg()
1444 if (wpa_s->wps_fragment_size) in wpas_wps_start_reg()
1445 ssid->eap.fragment_size = wpa_s->wps_fragment_size; in wpas_wps_start_reg()
1459 "Received new WPA/WPA2-PSK from WPS for STA " MACSTR, in wpas_wps_new_psk_cb()
1463 "Received new WPA/WPA2-PSK from WPS for STA " MACSTR in wpas_wps_new_psk_cb()
1467 wpa_hexdump_key(MSG_DEBUG, "Per-device PSK", psk, psk_len); in wpas_wps_new_psk_cb()
1483 wpa_printf(MSG_DEBUG, "WPS: PIN needed for UUID-E %s", uuid); in wpas_wps_pin_needed_cb()
1484 len = os_snprintf(txt, sizeof(txt), "WPS-EVENT-PIN-NEEDED %s " MACSTR in wpas_wps_pin_needed_cb()
1486 uuid, MAC2STR(dev->mac_addr), dev->device_name, in wpas_wps_pin_needed_cb()
1487 dev->manufacturer, dev->model_name, in wpas_wps_pin_needed_cb()
1488 dev->model_number, dev->serial_number, in wpas_wps_pin_needed_cb()
1489 wps_dev_type_bin2str(dev->pri_dev_type, devtype, in wpas_wps_pin_needed_cb()
1502 if (wpa_s->wps_er == NULL) in wpas_wps_set_sel_reg_cb()
1504 wpa_printf(MSG_DEBUG, "WPS ER: SetSelectedRegistrar - sel_reg=%d " in wpas_wps_set_sel_reg_cb()
1507 wps_er_set_sel_reg(wpa_s->wps_er, sel_reg, dev_passwd_id, in wpas_wps_set_sel_reg_cb()
1540 if (is_nil_uuid(wpa_s->conf->uuid)) { in wpas_wps_set_uuid()
1542 first = wpa_s->global->ifaces; in wpas_wps_set_uuid()
1543 while (first && first->next) in wpas_wps_set_uuid()
1544 first = first->next; in wpas_wps_set_uuid()
1546 if (wps != wpa_s->global->ifaces->wps) in wpas_wps_set_uuid()
1547 os_memcpy(wps->uuid, in wpas_wps_set_uuid()
1548 wpa_s->global->ifaces->wps->uuid, in wpas_wps_set_uuid()
1551 } else if (wpa_s->conf->auto_uuid == 1) { in wpas_wps_set_uuid()
1552 uuid_random(wps->uuid); in wpas_wps_set_uuid()
1555 uuid_gen_mac_addr(wpa_s->own_addr, wps->uuid); in wpas_wps_set_uuid()
1559 os_memcpy(wps->uuid, wpa_s->conf->uuid, WPS_UUID_LEN); in wpas_wps_set_uuid()
1563 uuid_bin2str(wps->uuid, buf, sizeof(buf)); in wpas_wps_set_uuid()
1571 wpabuf_free(wps->dev.vendor_ext_m1); in wpas_wps_set_vendor_ext_m1()
1572 wps->dev.vendor_ext_m1 = NULL; in wpas_wps_set_vendor_ext_m1()
1574 if (wpa_s->conf->wps_vendor_ext_m1) { in wpas_wps_set_vendor_ext_m1()
1575 wps->dev.vendor_ext_m1 = in wpas_wps_set_vendor_ext_m1()
1576 wpabuf_dup(wpa_s->conf->wps_vendor_ext_m1); in wpas_wps_set_vendor_ext_m1()
1577 if (!wps->dev.vendor_ext_m1) { in wpas_wps_set_vendor_ext_m1()
1594 return -1; in wpas_wps_init()
1596 wps->cred_cb = wpa_supplicant_wps_cred; in wpas_wps_init()
1597 wps->event_cb = wpa_supplicant_wps_event; in wpas_wps_init()
1598 wps->rf_band_cb = wpa_supplicant_wps_rf_band; in wpas_wps_init()
1599 wps->cb_ctx = wpa_s; in wpas_wps_init()
1601 wps->dev.device_name = wpa_s->conf->device_name; in wpas_wps_init()
1602 wps->dev.manufacturer = wpa_s->conf->manufacturer; in wpas_wps_init()
1603 wps->dev.model_name = wpa_s->conf->model_name; in wpas_wps_init()
1604 wps->dev.model_number = wpa_s->conf->model_number; in wpas_wps_init()
1605 wps->dev.serial_number = wpa_s->conf->serial_number; in wpas_wps_init()
1606 wps->config_methods = in wpas_wps_init()
1607 wps_config_methods_str2bin(wpa_s->conf->config_methods); in wpas_wps_init()
1608 if ((wps->config_methods & (WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) == in wpas_wps_init()
1613 return -1; in wpas_wps_init()
1615 wps->config_methods = wps_fix_config_methods(wps->config_methods); in wpas_wps_init()
1616 wps->dev.config_methods = wps->config_methods; in wpas_wps_init()
1617 os_memcpy(wps->dev.pri_dev_type, wpa_s->conf->device_type, in wpas_wps_init()
1620 wps->dev.num_sec_dev_types = wpa_s->conf->num_sec_device_types; in wpas_wps_init()
1621 os_memcpy(wps->dev.sec_dev_type, wpa_s->conf->sec_device_type, in wpas_wps_init()
1622 WPS_DEV_TYPE_LEN * wps->dev.num_sec_dev_types); in wpas_wps_init()
1626 wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version); in wpas_wps_init()
1627 modes = wpa_s->hw.modes; in wpas_wps_init()
1629 for (m = 0; m < wpa_s->hw.num_modes; m++) { in wpas_wps_init()
1632 wps->dev.rf_bands |= WPS_RF_24GHZ; in wpas_wps_init()
1634 wps->dev.rf_bands |= WPS_RF_50GHZ; in wpas_wps_init()
1636 wps->dev.rf_bands |= WPS_RF_60GHZ; in wpas_wps_init()
1639 if (wps->dev.rf_bands == 0) { in wpas_wps_init()
1644 wps->dev.rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ; in wpas_wps_init()
1646 os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN); in wpas_wps_init()
1650 wps->auth_types = WPS_AUTH_WPA2PSK; in wpas_wps_init()
1651 wps->encr_types = WPS_ENCR_AES; in wpas_wps_init()
1653 wps->auth_types = WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK; in wpas_wps_init()
1654 wps->encr_types = WPS_ENCR_AES | WPS_ENCR_TKIP; in wpas_wps_init()
1663 wps->registrar = wps_registrar_init(wps, &rcfg); in wpas_wps_init()
1664 if (wps->registrar == NULL) { in wpas_wps_init()
1667 return -1; in wpas_wps_init()
1670 wpa_s->wps = wps; in wpas_wps_init()
1679 wps->ap_nfc_dev_pw_id = 0; in wpas_wps_nfc_clear()
1680 wpabuf_free(wps->ap_nfc_dh_pubkey); in wpas_wps_nfc_clear()
1681 wps->ap_nfc_dh_pubkey = NULL; in wpas_wps_nfc_clear()
1682 wpabuf_free(wps->ap_nfc_dh_privkey); in wpas_wps_nfc_clear()
1683 wps->ap_nfc_dh_privkey = NULL; in wpas_wps_nfc_clear()
1684 wpabuf_free(wps->ap_nfc_dev_pw); in wpas_wps_nfc_clear()
1685 wps->ap_nfc_dev_pw = NULL; in wpas_wps_nfc_clear()
1702 if (wpa_s->wps == NULL) in wpas_wps_deinit()
1706 wps_er_deinit(wpa_s->wps_er, NULL, NULL); in wpas_wps_deinit()
1707 wpa_s->wps_er = NULL; in wpas_wps_deinit()
1708 wpas_wps_nfc_clear(wpa_s->wps); in wpas_wps_deinit()
1711 wps_registrar_deinit(wpa_s->wps->registrar); in wpas_wps_deinit()
1712 wpabuf_free(wpa_s->wps->dh_pubkey); in wpas_wps_deinit()
1713 wpabuf_free(wpa_s->wps->dh_privkey); in wpas_wps_deinit()
1714 wpabuf_free(wpa_s->wps->dev.vendor_ext_m1); in wpas_wps_deinit()
1715 os_free(wpa_s->wps->network_key); in wpas_wps_deinit()
1716 os_free(wpa_s->wps); in wpas_wps_deinit()
1717 wpa_s->wps = NULL; in wpas_wps_deinit()
1726 if (!(ssid->key_mgmt & WPA_KEY_MGMT_WPS)) in wpas_wps_ssid_bss_match()
1727 return -1; in wpas_wps_ssid_bss_match()
1730 if (eap_is_wps_pbc_enrollee(&ssid->eap)) { in wpas_wps_ssid_bss_match()
1732 wpa_printf(MSG_DEBUG, " skip - non-WPS AP"); in wpas_wps_ssid_bss_match()
1737 wpa_printf(MSG_DEBUG, " skip - WPS AP " in wpas_wps_ssid_bss_match()
1750 if (eap_is_wps_pin_enrollee(&ssid->eap)) { in wpas_wps_ssid_bss_match()
1752 wpa_printf(MSG_DEBUG, " skip - non-WPS AP"); in wpas_wps_ssid_bss_match()
1763 if (!wps_is_addr_authorized(wps_ie, wpa_s->own_addr, 1)) { in wpas_wps_ssid_bss_match()
1766 os_reltime_age(&wpa_s->wps_pin_start_time, &age); in wpas_wps_ssid_bss_match()
1768 if (wpa_s->scan_runs < WPS_PIN_SCAN_IGNORE_SEL_REG || in wpas_wps_ssid_bss_match()
1771 " skip - WPS AP without active PIN Registrar (scan_runs=%d age=%d)", in wpas_wps_ssid_bss_match()
1772 wpa_s->scan_runs, (int) age.sec); in wpas_wps_ssid_bss_match()
1791 return -1; in wpas_wps_ssid_bss_match()
1802 if (eap_is_wps_pbc_enrollee(&ssid->eap)) { in wpas_wps_ssid_wildcard_ok()
1808 } else if (eap_is_wps_pin_enrollee(&ssid->eap)) { in wpas_wps_ssid_wildcard_ok()
1811 (wps_is_addr_authorized(wps_ie, wpa_s->own_addr, 1) || in wpas_wps_ssid_wildcard_ok()
1812 wpa_s->scan_runs >= WPS_PIN_SCAN_IGNORE_SEL_REG)) { in wpas_wps_ssid_wildcard_ok()
1818 if (!ret && ssid->bssid_set && in wpas_wps_ssid_wildcard_ok()
1819 ether_addr_equal(ssid->bssid, bss->bssid)) { in wpas_wps_ssid_wildcard_ok()
1826 if (wps_validate_beacon_probe_resp(wps_ie, bss->beacon_ie_len > in wpas_wps_ssid_wildcard_ok()
1827 0, bss->bssid) < 0) in wpas_wps_ssid_wildcard_ok()
1829 if (bss->beacon_ie_len) { in wpas_wps_ssid_wildcard_ok()
1857 if (!ap->pbc_active || in wpas_wps_is_pbc_overlap()
1858 ether_addr_equal(selected->bssid, ap->bssid)) in wpas_wps_is_pbc_overlap()
1861 if (!is_zero_ether_addr(ssid->bssid) && in wpas_wps_is_pbc_overlap()
1862 !ether_addr_equal(ap->bssid, ssid->bssid)) { in wpas_wps_is_pbc_overlap()
1865 MAC2STR(ap->bssid)); in wpas_wps_is_pbc_overlap()
1870 MAC2STR(ap->bssid)); in wpas_wps_is_pbc_overlap()
1872 ap->uuid, UUID_LEN); in wpas_wps_is_pbc_overlap()
1873 if (!sel_uuid || os_memcmp(sel_uuid, ap->uuid, UUID_LEN) != 0) in wpas_wps_is_pbc_overlap()
1876 /* TODO: verify that this is reasonable dual-band situation */ in wpas_wps_is_pbc_overlap()
1891 if (!eap_is_wps_pbc_enrollee(&ssid->eap)) in wpas_wps_scan_pbc_overlap()
1896 MAC2STR(selected->bssid)); in wpas_wps_scan_pbc_overlap()
1897 if (!is_zero_ether_addr(ssid->bssid)) in wpas_wps_scan_pbc_overlap()
1900 MAC2STR(ssid->bssid)); in wpas_wps_scan_pbc_overlap()
1914 for (iface = wpa_s->global->ifaces; iface; iface = iface->next) { in wpas_wps_scan_pbc_overlap()
1915 for (i = 0; i < iface->num_wps_ap; i++) { in wpas_wps_scan_pbc_overlap()
1916 struct wps_ap_info *ap = &iface->wps_ap[i]; in wpas_wps_scan_pbc_overlap()
1924 MAC2STR(selected->bssid), in wpas_wps_scan_pbc_overlap()
1925 MAC2STR(ap->bssid)); in wpas_wps_scan_pbc_overlap()
1942 if (wpa_s->disconnected || wpa_s->wpa_state >= WPA_ASSOCIATED) in wpas_wps_notify_scan_results()
1945 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { in wpas_wps_notify_scan_results()
1953 else if (wps_is_addr_authorized(ie, wpa_s->own_addr, 0)) in wpas_wps_notify_scan_results()
1977 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpas_wps_searching()
1978 if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && !ssid->disabled) in wpas_wps_searching()
2005 if (wpa_s->wps_er) { in wpas_wps_er_start()
2006 wps_er_refresh(wpa_s->wps_er); in wpas_wps_er_start()
2009 wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname, filter); in wpas_wps_er_start()
2010 if (wpa_s->wps_er == NULL) in wpas_wps_er_start()
2011 return -1; in wpas_wps_er_start()
2022 wps_er_deinit(wpa_s->wps_er, NULL, NULL); in wpas_wps_er_stop()
2023 wpa_s->wps_er = NULL; in wpas_wps_er_stop()
2040 use_uuid = wps_er_get_sta_uuid(wpa_s->wps_er, addr_buf); in wpas_wps_er_add_pin()
2042 return -1; in wpas_wps_er_add_pin()
2044 return -1; in wpas_wps_er_add_pin()
2045 return wps_registrar_add_pin(wpa_s->wps->registrar, addr, in wpas_wps_er_add_pin()
2061 return -1; in wpas_wps_er_pbc()
2062 return wps_er_pbc(wpa_s->wps_er, use_uuid, use_addr); in wpas_wps_er_pbc()
2077 return -1; in wpas_wps_er_learn()
2079 return wps_er_learn(wpa_s->wps_er, use_uuid, use_addr, (const u8 *) pin, in wpas_wps_er_learn()
2088 if (ssid->ssid_len > SSID_MAX_LEN) in wpas_wps_network_to_cred()
2089 return -1; in wpas_wps_network_to_cred()
2090 os_memcpy(cred->ssid, ssid->ssid, ssid->ssid_len); in wpas_wps_network_to_cred()
2091 cred->ssid_len = ssid->ssid_len; in wpas_wps_network_to_cred()
2092 if (ssid->key_mgmt & WPA_KEY_MGMT_PSK) { in wpas_wps_network_to_cred()
2093 cred->auth_type = (ssid->proto & WPA_PROTO_RSN) ? in wpas_wps_network_to_cred()
2095 if (ssid->pairwise_cipher & WPA_CIPHER_CCMP) in wpas_wps_network_to_cred()
2096 cred->encr_type = WPS_ENCR_AES; in wpas_wps_network_to_cred()
2098 cred->encr_type = WPS_ENCR_TKIP; in wpas_wps_network_to_cred()
2099 if (ssid->passphrase) { in wpas_wps_network_to_cred()
2100 cred->key_len = os_strlen(ssid->passphrase); in wpas_wps_network_to_cred()
2101 if (cred->key_len >= 64) in wpas_wps_network_to_cred()
2102 return -1; in wpas_wps_network_to_cred()
2103 os_memcpy(cred->key, ssid->passphrase, cred->key_len); in wpas_wps_network_to_cred()
2104 } else if (ssid->psk_set) { in wpas_wps_network_to_cred()
2105 cred->key_len = 32; in wpas_wps_network_to_cred()
2106 os_memcpy(cred->key, ssid->psk, 32); in wpas_wps_network_to_cred()
2108 return -1; in wpas_wps_network_to_cred()
2110 cred->auth_type = WPS_AUTH_OPEN; in wpas_wps_network_to_cred()
2111 cred->encr_type = WPS_ENCR_NONE; in wpas_wps_network_to_cred()
2132 return -1; in wpas_wps_er_set_config()
2133 ssid = wpa_config_get_network(wpa_s->conf, id); in wpas_wps_er_set_config()
2134 if (ssid == NULL || ssid->ssid == NULL) in wpas_wps_er_set_config()
2135 return -1; in wpas_wps_er_set_config()
2138 return -1; in wpas_wps_er_set_config()
2139 ret = wps_er_set_config(wpa_s->wps_er, use_uuid, use_addr, &cred); in wpas_wps_er_set_config()
2158 return -1; in wpas_wps_er_config()
2159 if (settings->ssid_hex == NULL || settings->auth == NULL || in wpas_wps_er_config()
2160 settings->encr == NULL || settings->key_hex == NULL) in wpas_wps_er_config()
2161 return -1; in wpas_wps_er_config()
2164 len = os_strlen(settings->ssid_hex); in wpas_wps_er_config()
2166 hexstr2bin(settings->ssid_hex, cred.ssid, len / 2)) in wpas_wps_er_config()
2167 return -1; in wpas_wps_er_config()
2170 len = os_strlen(settings->key_hex); in wpas_wps_er_config()
2172 hexstr2bin(settings->key_hex, cred.key, len / 2)) in wpas_wps_er_config()
2173 return -1; in wpas_wps_er_config()
2176 if (os_strcmp(settings->auth, "OPEN") == 0) in wpas_wps_er_config()
2178 else if (os_strcmp(settings->auth, "WPAPSK") == 0) in wpas_wps_er_config()
2180 else if (os_strcmp(settings->auth, "WPA2PSK") == 0) in wpas_wps_er_config()
2183 return -1; in wpas_wps_er_config()
2185 if (os_strcmp(settings->encr, "NONE") == 0) in wpas_wps_er_config()
2188 else if (os_strcmp(settings->encr, "WEP") == 0) in wpas_wps_er_config()
2191 else if (os_strcmp(settings->encr, "TKIP") == 0) in wpas_wps_er_config()
2193 else if (os_strcmp(settings->encr, "CCMP") == 0) in wpas_wps_er_config()
2196 return -1; in wpas_wps_er_config()
2198 return wps_er_config(wpa_s->wps_er, use_uuid, use_addr, in wpas_wps_er_config()
2211 if (!wpa_s->wps_er) in wpas_wps_er_nfc_config_token()
2221 ret = wps_er_nfc_config_token(wpa_s->wps_er, use_uuid, use_addr); in wpas_wps_er_nfc_config_token()
2241 if (--callbacks_pending <= 0) in wpas_wps_terminate_cb()
2250 if (wpa_s->wps_er) { in wpas_wps_terminate_pending()
2252 wps_er_deinit(wpa_s->wps_er, wpas_wps_terminate_cb, wpa_s); in wpas_wps_terminate_pending()
2253 wpa_s->wps_er = NULL; in wpas_wps_terminate_pending()
2263 struct wps_context *wps = wpa_s->wps; in wpas_wps_update_config()
2268 if (wpa_s->conf->changed_parameters & CFG_CHANGED_CONFIG_METHODS) { in wpas_wps_update_config()
2269 wps->config_methods = wps_config_methods_str2bin( in wpas_wps_update_config()
2270 wpa_s->conf->config_methods); in wpas_wps_update_config()
2271 if ((wps->config_methods & in wpas_wps_update_config()
2277 wps->config_methods &= ~WPS_CONFIG_LABEL; in wpas_wps_update_config()
2280 wps->config_methods = wps_fix_config_methods(wps->config_methods); in wpas_wps_update_config()
2281 wps->dev.config_methods = wps->config_methods; in wpas_wps_update_config()
2283 if (wpa_s->conf->changed_parameters & CFG_CHANGED_DEVICE_TYPE) in wpas_wps_update_config()
2284 os_memcpy(wps->dev.pri_dev_type, wpa_s->conf->device_type, in wpas_wps_update_config()
2287 if (wpa_s->conf->changed_parameters & CFG_CHANGED_SEC_DEVICE_TYPE) { in wpas_wps_update_config()
2288 wps->dev.num_sec_dev_types = wpa_s->conf->num_sec_device_types; in wpas_wps_update_config()
2289 os_memcpy(wps->dev.sec_dev_type, wpa_s->conf->sec_device_type, in wpas_wps_update_config()
2290 wps->dev.num_sec_dev_types * WPS_DEV_TYPE_LEN); in wpas_wps_update_config()
2293 if (wpa_s->conf->changed_parameters & CFG_CHANGED_VENDOR_EXTENSION) in wpas_wps_update_config()
2296 if (wpa_s->conf->changed_parameters & CFG_CHANGED_OS_VERSION) in wpas_wps_update_config()
2297 wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version); in wpas_wps_update_config()
2299 if (wpa_s->conf->changed_parameters & CFG_CHANGED_UUID) in wpas_wps_update_config()
2302 if (wpa_s->conf->changed_parameters & in wpas_wps_update_config()
2305 wps->dev.device_name = wpa_s->conf->device_name; in wpas_wps_update_config()
2306 wps->dev.manufacturer = wpa_s->conf->manufacturer; in wpas_wps_update_config()
2307 wps->dev.model_name = wpa_s->conf->model_name; in wpas_wps_update_config()
2308 wps->dev.model_number = wpa_s->conf->model_number; in wpas_wps_update_config()
2309 wps->dev.serial_number = wpa_s->conf->serial_number; in wpas_wps_update_config()
2318 wps = wpa_s->wps; in wpas_wps_update_mac_addr()
2320 os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN); in wpas_wps_update_mac_addr()
2337 ret = wps_er_config_token_from_cred(wpa_s->wps, &cred); in wpas_wps_network_config_token()
2366 ssid = wpa_config_get_network(wpa_s->conf, id); in wpas_wps_nfc_config_token()
2373 if (wpa_s->ap_iface) in wpas_wps_nfc_config_token()
2382 if (wpa_s->conf->wps_nfc_pw_from_config) { in wpas_wps_nfc_token()
2384 wpa_s->conf->wps_nfc_dev_pw_id, in wpas_wps_nfc_token()
2385 wpa_s->conf->wps_nfc_dh_pubkey, in wpas_wps_nfc_token()
2386 wpa_s->conf->wps_nfc_dev_pw); in wpas_wps_nfc_token()
2389 return wps_nfc_token_gen(ndef, &wpa_s->conf->wps_nfc_dev_pw_id, in wpas_wps_nfc_token()
2390 &wpa_s->conf->wps_nfc_dh_pubkey, in wpas_wps_nfc_token()
2391 &wpa_s->conf->wps_nfc_dh_privkey, in wpas_wps_nfc_token()
2392 &wpa_s->conf->wps_nfc_dev_pw); in wpas_wps_nfc_token()
2400 const u8 *ssid, size_t ssid_len, int freq) in wpas_wps_start_nfc() argument
2402 struct wps_context *wps = wpa_s->wps; in wpas_wps_start_nfc()
2406 dev_pw = wpa_s->conf->wps_nfc_dev_pw; in wpas_wps_start_nfc()
2407 dev_pw_id = wpa_s->conf->wps_nfc_dev_pw_id; in wpas_wps_start_nfc()
2410 if (wpa_s->conf->wps_nfc_dh_pubkey == NULL || in wpas_wps_start_nfc()
2411 wpa_s->conf->wps_nfc_dh_privkey == NULL) { in wpas_wps_start_nfc()
2412 wpa_printf(MSG_DEBUG, "WPS: Missing DH params - " in wpas_wps_start_nfc()
2413 "cannot start NFC-triggered connection"); in wpas_wps_start_nfc()
2414 return -1; in wpas_wps_start_nfc()
2418 wpa_printf(MSG_DEBUG, "WPS: Missing Device Password (id=%u) - " in wpas_wps_start_nfc()
2419 "cannot start NFC-triggered connection", dev_pw_id); in wpas_wps_start_nfc()
2420 return -1; in wpas_wps_start_nfc()
2423 dh5_free(wps->dh_ctx); in wpas_wps_start_nfc()
2424 wpabuf_free(wps->dh_pubkey); in wpas_wps_start_nfc()
2425 wpabuf_free(wps->dh_privkey); in wpas_wps_start_nfc()
2426 wps->dh_privkey = wpabuf_dup(wpa_s->conf->wps_nfc_dh_privkey); in wpas_wps_start_nfc()
2427 wps->dh_pubkey = wpabuf_dup(wpa_s->conf->wps_nfc_dh_pubkey); in wpas_wps_start_nfc()
2428 if (wps->dh_privkey == NULL || wps->dh_pubkey == NULL) { in wpas_wps_start_nfc()
2429 wps->dh_ctx = NULL; in wpas_wps_start_nfc()
2430 wpabuf_free(wps->dh_pubkey); in wpas_wps_start_nfc()
2431 wps->dh_pubkey = NULL; in wpas_wps_start_nfc()
2432 wpabuf_free(wps->dh_privkey); in wpas_wps_start_nfc()
2433 wps->dh_privkey = NULL; in wpas_wps_start_nfc()
2435 return -1; in wpas_wps_start_nfc()
2437 wps->dh_ctx = dh5_init_fixed(wps->dh_privkey, wps->dh_pubkey); in wpas_wps_start_nfc()
2438 if (wps->dh_ctx == NULL) { in wpas_wps_start_nfc()
2439 wpabuf_free(wps->dh_pubkey); in wpas_wps_start_nfc()
2440 wps->dh_pubkey = NULL; in wpas_wps_start_nfc()
2441 wpabuf_free(wps->dh_privkey); in wpas_wps_start_nfc()
2442 wps->dh_privkey = NULL; in wpas_wps_start_nfc()
2444 return -1; in wpas_wps_start_nfc()
2455 ssid, ssid_len, freq); in wpas_wps_start_nfc()
2471 if (wps_oob_use_cred(wpa_s->wps, attr) < 0) in wpas_wps_use_cred()
2472 return -1; in wpas_wps_use_cred()
2474 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpas_wps_use_cred()
2477 if (attr->ap_channel) { in wpas_wps_use_cred()
2478 u16 chan = WPA_GET_BE16(attr->ap_channel); in wpas_wps_use_cred()
2479 int freq = 0; in wpas_wps_use_cred() local
2482 freq = 2407 + 5 * chan; in wpas_wps_use_cred()
2484 freq = 2484; in wpas_wps_use_cred()
2486 freq = 5000 + 5 * chan; in wpas_wps_use_cred()
2488 if (freq) { in wpas_wps_use_cred()
2489 wpa_printf(MSG_DEBUG, "WPS: Credential container indicated AP channel %u -> %u MHz", in wpas_wps_use_cred()
2490 chan, freq); in wpas_wps_use_cred()
2491 wpa_s->after_wps = 5; in wpas_wps_use_cred()
2492 wpa_s->wps_freq = freq; in wpas_wps_use_cred()
2498 wpa_s->normal_scans = 0; in wpas_wps_use_cred()
2500 wpa_s->disconnected = 0; in wpas_wps_use_cred()
2501 wpa_s->reassociate = 1; in wpas_wps_use_cred()
2515 wpa_s->wps->registrar, attr->oob_dev_password, in wpas_wps_add_nfc_password_token()
2516 attr->oob_dev_password_len); in wpas_wps_add_nfc_password_token()
2530 return -1; in wpas_wps_nfc_tag_process()
2542 return -1; in wpas_wps_nfc_tag_process()
2554 return -1; in wpas_wps_nfc_tag_read()
2570 return -1; in wpas_wps_nfc_tag_read()
2586 if (wpa_s->conf->wps_nfc_dh_pubkey == NULL && in wpas_wps_nfc_handover_req()
2587 wps_nfc_gen_dh(&wpa_s->conf->wps_nfc_dh_pubkey, in wpas_wps_nfc_handover_req()
2588 &wpa_s->conf->wps_nfc_dh_privkey) < 0) in wpas_wps_nfc_handover_req()
2591 ret = wps_build_nfc_handover_req(wpa_s->wps, in wpas_wps_nfc_handover_req()
2592 wpa_s->conf->wps_nfc_dh_pubkey); in wpas_wps_nfc_handover_req()
2617 struct wps_context *wps = wpa_s->wps; in wpas_wps_er_nfc_handover_sel()
2631 if (wpa_s->conf->wps_nfc_dh_pubkey == NULL) { in wpas_wps_er_nfc_handover_sel()
2632 if (wps_nfc_gen_dh(&wpa_s->conf->wps_nfc_dh_pubkey, in wpas_wps_er_nfc_handover_sel()
2633 &wpa_s->conf->wps_nfc_dh_privkey) < 0) in wpas_wps_er_nfc_handover_sel()
2638 wps->ap_nfc_dev_pw_id = DEV_PW_NFC_CONNECTION_HANDOVER; in wpas_wps_er_nfc_handover_sel()
2639 wps->ap_nfc_dh_pubkey = wpabuf_dup(wpa_s->conf->wps_nfc_dh_pubkey); in wpas_wps_er_nfc_handover_sel()
2640 wps->ap_nfc_dh_privkey = wpabuf_dup(wpa_s->conf->wps_nfc_dh_privkey); in wpas_wps_er_nfc_handover_sel()
2641 if (!wps->ap_nfc_dh_pubkey || !wps->ap_nfc_dh_privkey) { in wpas_wps_er_nfc_handover_sel()
2646 ret = wps_er_nfc_handover_sel(wpa_s->wps_er, wpa_s->wps, use_uuid, in wpas_wps_er_nfc_handover_sel()
2647 use_addr, wpa_s->conf->wps_nfc_dh_pubkey); in wpas_wps_er_nfc_handover_sel()
2682 int ret = -1; in wpas_wps_nfc_rx_handover_sel()
2689 int freq = 0; in wpas_wps_nfc_rx_handover_sel() local
2693 return -1; in wpas_wps_nfc_rx_handover_sel()
2698 wpa_printf(MSG_DEBUG, "WPS: Too short Wi-Fi Handover Select " in wpas_wps_nfc_rx_handover_sel()
2704 if (wsc_len > wpabuf_len(wps) - 2) { in wpas_wps_nfc_rx_handover_sel()
2706 "in Wi-Fi Handover Select Message", wsc_len); in wpas_wps_nfc_rx_handover_sel()
2712 "WPS: WSC attributes in Wi-Fi Handover Select Message", in wpas_wps_nfc_rx_handover_sel()
2714 if (wsc_len < wpabuf_len(wps) - 2) { in wpas_wps_nfc_rx_handover_sel()
2717 pos + wsc_len, wpabuf_len(wps) - 2 - wsc_len); in wpas_wps_nfc_rx_handover_sel()
2724 "Wi-Fi Handover Select Message"); in wpas_wps_nfc_rx_handover_sel()
2730 wpa_printf(MSG_DEBUG, "WPS: No Out-of-Band Device Password " in wpas_wps_nfc_rx_handover_sel()
2731 "included in Wi-Fi Handover Select Message"); in wpas_wps_nfc_rx_handover_sel()
2732 ret = -1; in wpas_wps_nfc_rx_handover_sel()
2737 wpa_printf(MSG_DEBUG, "WPS: No SSID included in Wi-Fi Handover " in wpas_wps_nfc_rx_handover_sel()
2738 "Select Message"); in wpas_wps_nfc_rx_handover_sel()
2739 ret = -1; in wpas_wps_nfc_rx_handover_sel()
2761 freq = 2407 + 5 * chan; in wpas_wps_nfc_rx_handover_sel()
2765 freq = 2484; in wpas_wps_nfc_rx_handover_sel()
2769 freq = 5000 + 5 * chan; in wpas_wps_nfc_rx_handover_sel()
2773 freq = 56160 + 2160 * chan; in wpas_wps_nfc_rx_handover_sel()
2775 if (freq) { in wpas_wps_nfc_rx_handover_sel()
2777 "WPS: AP indicated channel %u -> %u MHz", in wpas_wps_nfc_rx_handover_sel()
2778 chan, freq); in wpas_wps_nfc_rx_handover_sel()
2782 wpa_hexdump(MSG_DEBUG, "WPS: Out-of-Band Device Password", in wpas_wps_nfc_rx_handover_sel()
2788 "%u in Wi-Fi Handover Select Message", dev_pw_id); in wpas_wps_nfc_rx_handover_sel()
2789 ret = -1; in wpas_wps_nfc_rx_handover_sel()
2797 attr.ssid, attr.ssid_len, freq); in wpas_wps_nfc_rx_handover_sel()
2811 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: Carrier record in select", sel); in wpas_wps_nfc_report_handover()
2821 int ret = -1; in wpas_er_wps_nfc_report_handover()
2834 return -1; in wpas_er_wps_nfc_report_handover()
2839 wpa_printf(MSG_DEBUG, "WPS: Too short Wi-Fi Handover Request " in wpas_er_wps_nfc_report_handover()
2845 if (wsc_len > wpabuf_len(wps) - 2) { in wpas_er_wps_nfc_report_handover()
2847 "in rt Wi-Fi Handover Request Message", wsc_len); in wpas_er_wps_nfc_report_handover()
2853 "WPS: WSC attributes in Wi-Fi Handover Request Message", in wpas_er_wps_nfc_report_handover()
2855 if (wsc_len < wpabuf_len(wps) - 2) { in wpas_er_wps_nfc_report_handover()
2858 pos + wsc_len, wpabuf_len(wps) - 2 - wsc_len); in wpas_er_wps_nfc_report_handover()
2865 "Wi-Fi Handover Request Message"); in wpas_er_wps_nfc_report_handover()
2871 wpa_printf(MSG_DEBUG, "WPS: No Out-of-Band Device Password " in wpas_er_wps_nfc_report_handover()
2872 "included in Wi-Fi Handover Request Message"); in wpas_er_wps_nfc_report_handover()
2873 ret = -1; in wpas_er_wps_nfc_report_handover()
2878 wpa_printf(MSG_DEBUG, "WPS: No UUID-E included in Wi-Fi " in wpas_er_wps_nfc_report_handover()
2880 ret = -1; in wpas_er_wps_nfc_report_handover()
2884 wpa_hexdump(MSG_DEBUG, "WPS: UUID-E", attr.uuid_e, WPS_UUID_LEN); in wpas_er_wps_nfc_report_handover()
2886 wpa_hexdump(MSG_DEBUG, "WPS: Out-of-Band Device Password", in wpas_er_wps_nfc_report_handover()
2892 "%u in Wi-Fi Handover Request Message", dev_pw_id); in wpas_er_wps_nfc_report_handover()
2893 ret = -1; in wpas_er_wps_nfc_report_handover()
2899 ret = wps_registrar_add_nfc_pw_token(wpa_s->wps->registrar, in wpas_er_wps_nfc_report_handover()
2920 if (wpa_s->wps_ap == NULL) in wpas_wps_dump_ap_info()
2925 for (i = 0; i < wpa_s->num_wps_ap; i++) { in wpas_wps_dump_ap_info()
2926 struct wps_ap_info *ap = &wpa_s->wps_ap[i]; in wpas_wps_dump_ap_info()
2928 ap->bssid); in wpas_wps_dump_ap_info()
2932 (int) i, MAC2STR(ap->bssid), ap->type, ap->tries, in wpas_wps_dump_ap_info()
2933 ap->last_attempt.sec > 0 ? in wpas_wps_dump_ap_info()
2934 (int) now.sec - (int) ap->last_attempt.sec : -1, in wpas_wps_dump_ap_info()
2935 e ? e->count : 0); in wpas_wps_dump_ap_info()
2945 if (wpa_s->wps_ap == NULL) in wpas_wps_get_ap_info()
2948 for (i = 0; i < wpa_s->num_wps_ap; i++) { in wpas_wps_get_ap_info()
2949 struct wps_ap_info *ap = &wpa_s->wps_ap[i]; in wpas_wps_get_ap_info()
2950 if (ether_addr_equal(ap->bssid, bssid)) in wpas_wps_get_ap_info()
2974 r = wps_is_addr_authorized(wps, wpa_s->own_addr, 1); in wpas_wps_update_ap_info_bss()
2985 ap = wpas_wps_get_ap_info(wpa_s, res->bssid); in wpas_wps_update_ap_info_bss()
2987 if (ap->type != type) { in wpas_wps_update_ap_info_bss()
2989 " changed type %d -> %d", in wpas_wps_update_ap_info_bss()
2990 MAC2STR(res->bssid), ap->type, type); in wpas_wps_update_ap_info_bss()
2991 ap->type = type; in wpas_wps_update_ap_info_bss()
2993 wpa_bssid_ignore_del(wpa_s, ap->bssid); in wpas_wps_update_ap_info_bss()
2995 ap->pbc_active = pbc_active; in wpas_wps_update_ap_info_bss()
2997 os_memcpy(ap->uuid, uuid, WPS_UUID_LEN); in wpas_wps_update_ap_info_bss()
3001 ap = os_realloc_array(wpa_s->wps_ap, wpa_s->num_wps_ap + 1, in wpas_wps_update_ap_info_bss()
3006 wpa_s->wps_ap = ap; in wpas_wps_update_ap_info_bss()
3007 ap = &wpa_s->wps_ap[wpa_s->num_wps_ap]; in wpas_wps_update_ap_info_bss()
3008 wpa_s->num_wps_ap++; in wpas_wps_update_ap_info_bss()
3011 os_memcpy(ap->bssid, res->bssid, ETH_ALEN); in wpas_wps_update_ap_info_bss()
3012 ap->type = type; in wpas_wps_update_ap_info_bss()
3013 ap->pbc_active = pbc_active; in wpas_wps_update_ap_info_bss()
3015 os_memcpy(ap->uuid, uuid, WPS_UUID_LEN); in wpas_wps_update_ap_info_bss()
3017 MAC2STR(ap->bssid), ap->type); in wpas_wps_update_ap_info_bss()
3029 for (i = 0; i < scan_res->num; i++) in wpas_wps_update_ap_info()
3030 wpas_wps_update_ap_info_bss(wpa_s, scan_res->res[i]); in wpas_wps_update_ap_info()
3038 struct wpa_global *global = wpa_s->global; in wpas_wps_partner_link_scan_done()
3041 for (iface = global->ifaces; iface; iface = iface->next) { in wpas_wps_partner_link_scan_done()
3045 if (!iface->supp_pbc_active) in wpas_wps_partner_link_scan_done()
3052 if (iface->wps_scan_done) in wpas_wps_partner_link_scan_done()
3064 struct wpa_global *global = wpa_s->global; in wpas_wps_partner_link_overlap_detect()
3067 for (iface = global->ifaces; iface; iface = iface->next) { in wpas_wps_partner_link_overlap_detect()
3070 if (iface->wps_overlap) in wpas_wps_partner_link_overlap_detect()
3082 wpa_s->after_wps = 0; in wpas_wps_notify_assoc()
3084 if (!wpa_s->wps_ap_iter) in wpas_wps_notify_assoc()
3089 ap->tries++; in wpas_wps_notify_assoc()
3090 os_get_reltime(&ap->last_attempt); in wpas_wps_notify_assoc()