2 * wpa_supplicant / WPS integration
3 * Copyright (c) 2008-2010, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
20 #include "crypto/dh_group5.h"
21 #include "common/ieee802_11_defs.h"
22 #include "common/ieee802_11_common.h"
23 #include "common/wpa_common.h"
24 #include "common/wpa_ctrl.h"
25 #include "eap_common/eap_wsc_common.h"
26 #include "eap_peer/eap.h"
27 #include "rsn_supp/wpa.h"
29 #include "wpa_supplicant_i.h"
32 #include "blacklist.h"
36 #include "p2p_supplicant.h"
37 #include "wps_supplicant.h"
40 #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG
41 #define WPS_PIN_SCAN_IGNORE_SEL_REG 3
42 #endif /* WPS_PIN_SCAN_IGNORE_SEL_REG */
44 static void wpas_wps_timeout(void *eloop_ctx, void *timeout_ctx);
45 static void wpas_clear_wps(struct wpa_supplicant *wpa_s);
48 int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
50 if (!wpa_s->wps_success &&
51 wpa_s->current_ssid &&
52 eap_is_wps_pin_enrollee(&wpa_s->current_ssid->eap)) {
53 const u8 *bssid = wpa_s->bssid;
54 if (is_zero_ether_addr(bssid))
55 bssid = wpa_s->pending_bssid;
57 wpa_printf(MSG_DEBUG, "WPS: PIN registration with " MACSTR
58 " did not succeed - continue trying to find "
59 "suitable AP", MAC2STR(bssid));
60 wpa_blacklist_add(wpa_s, bssid);
62 wpa_supplicant_deauthenticate(wpa_s,
63 WLAN_REASON_DEAUTH_LEAVING);
64 wpa_s->reassociate = 1;
65 wpa_supplicant_req_scan(wpa_s,
66 wpa_s->blacklist_cleared ? 5 : 0, 0);
67 wpa_s->blacklist_cleared = 0;
71 eloop_cancel_timeout(wpas_wps_timeout, wpa_s, NULL);
73 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPS && wpa_s->current_ssid &&
74 !(wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_WPS)) {
75 wpa_printf(MSG_DEBUG, "WPS: Network configuration replaced - "
76 "try to associate with the received credential");
77 wpa_supplicant_deauthenticate(wpa_s,
78 WLAN_REASON_DEAUTH_LEAVING);
80 wpa_s->wps_freq = wpa_s->assoc_freq;
81 wpa_s->reassociate = 1;
82 wpa_supplicant_req_scan(wpa_s, 0, 0);
86 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPS && wpa_s->current_ssid) {
87 wpa_printf(MSG_DEBUG, "WPS: Registration completed - waiting "
88 "for external credential processing");
89 wpas_clear_wps(wpa_s);
90 wpa_supplicant_deauthenticate(wpa_s,
91 WLAN_REASON_DEAUTH_LEAVING);
99 static void wpas_wps_security_workaround(struct wpa_supplicant *wpa_s,
100 struct wpa_ssid *ssid,
101 const struct wps_credential *cred)
103 struct wpa_driver_capa capa;
106 struct wpa_ie_data adv;
107 int wpa2 = 0, ccmp = 0;
110 * Many existing WPS APs do not know how to negotiate WPA2 or CCMP in
111 * case they are configured for mixed mode operation (WPA+WPA2 and
112 * TKIP+CCMP). Try to use scan results to figure out whether the AP
113 * actually supports stronger security and select that if the client
114 * has support for it, too.
117 if (wpa_drv_get_capa(wpa_s, &capa))
118 return; /* Unknown what driver supports */
120 bss = wpa_bss_get(wpa_s, cred->mac_addr, ssid->ssid, ssid->ssid_len);
122 wpa_printf(MSG_DEBUG, "WPS: The AP was not found from BSS "
123 "table - use credential as-is");
127 wpa_printf(MSG_DEBUG, "WPS: AP found from BSS table");
129 ie = wpa_bss_get_ie(bss, WLAN_EID_RSN);
130 if (ie && wpa_parse_wpa_ie(ie, 2 + ie[1], &adv) == 0) {
132 if (adv.pairwise_cipher & WPA_CIPHER_CCMP)
135 ie = wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
136 if (ie && wpa_parse_wpa_ie(ie, 2 + ie[1], &adv) == 0 &&
137 adv.pairwise_cipher & WPA_CIPHER_CCMP)
141 if (ie == NULL && (ssid->proto & WPA_PROTO_WPA) &&
142 (ssid->pairwise_cipher & WPA_CIPHER_TKIP)) {
144 * TODO: This could be the initial AP configuration and the
145 * Beacon contents could change shortly. Should request a new
146 * scan and delay addition of the network until the updated
147 * scan results are available.
149 wpa_printf(MSG_DEBUG, "WPS: The AP did not yet advertise WPA "
150 "support - use credential as-is");
154 if (ccmp && !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) &&
155 (ssid->pairwise_cipher & WPA_CIPHER_TKIP) &&
156 (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
157 wpa_printf(MSG_DEBUG, "WPS: Add CCMP into the credential "
158 "based on scan results");
159 if (wpa_s->conf->ap_scan == 1)
160 ssid->pairwise_cipher |= WPA_CIPHER_CCMP;
162 ssid->pairwise_cipher = WPA_CIPHER_CCMP;
165 if (wpa2 && !(ssid->proto & WPA_PROTO_RSN) &&
166 (ssid->proto & WPA_PROTO_WPA) &&
167 (capa.enc & WPA_DRIVER_CAPA_ENC_CCMP)) {
168 wpa_printf(MSG_DEBUG, "WPS: Add WPA2 into the credential "
169 "based on scan results");
170 if (wpa_s->conf->ap_scan == 1)
171 ssid->proto |= WPA_PROTO_RSN;
173 ssid->proto = WPA_PROTO_RSN;
178 static int wpa_supplicant_wps_cred(void *ctx,
179 const struct wps_credential *cred)
181 struct wpa_supplicant *wpa_s = ctx;
182 struct wpa_ssid *ssid = wpa_s->current_ssid;
186 if ((wpa_s->conf->wps_cred_processing == 1 ||
187 wpa_s->conf->wps_cred_processing == 2) && cred->cred_attr) {
188 size_t blen = cred->cred_attr_len * 2 + 1;
189 char *buf = os_malloc(blen);
191 wpa_snprintf_hex(buf, blen,
192 cred->cred_attr, cred->cred_attr_len);
193 wpa_msg(wpa_s, MSG_INFO, "%s%s",
194 WPS_EVENT_CRED_RECEIVED, buf);
198 wpas_notify_wps_credential(wpa_s, cred);
200 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_CRED_RECEIVED);
202 wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute",
203 cred->cred_attr, cred->cred_attr_len);
205 if (wpa_s->conf->wps_cred_processing == 1)
208 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", cred->ssid, cred->ssid_len);
209 wpa_printf(MSG_DEBUG, "WPS: Authentication Type 0x%x",
211 wpa_printf(MSG_DEBUG, "WPS: Encryption Type 0x%x", cred->encr_type);
212 wpa_printf(MSG_DEBUG, "WPS: Network Key Index %d", cred->key_idx);
213 wpa_hexdump_key(MSG_DEBUG, "WPS: Network Key",
214 cred->key, cred->key_len);
215 wpa_printf(MSG_DEBUG, "WPS: MAC Address " MACSTR,
216 MAC2STR(cred->mac_addr));
218 auth_type = cred->auth_type;
219 if (auth_type == (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK)) {
220 wpa_printf(MSG_DEBUG, "WPS: Workaround - convert mixed-mode "
221 "auth_type into WPA2PSK");
222 auth_type = WPS_AUTH_WPA2PSK;
225 if (auth_type != WPS_AUTH_OPEN &&
226 auth_type != WPS_AUTH_SHARED &&
227 auth_type != WPS_AUTH_WPAPSK &&
228 auth_type != WPS_AUTH_WPA2PSK) {
229 wpa_printf(MSG_DEBUG, "WPS: Ignored credentials for "
230 "unsupported authentication type 0x%x",
235 if (ssid && (ssid->key_mgmt & WPA_KEY_MGMT_WPS)) {
236 wpa_printf(MSG_DEBUG, "WPS: Replace WPS network block based "
237 "on the received credential");
238 os_free(ssid->eap.identity);
239 ssid->eap.identity = NULL;
240 ssid->eap.identity_len = 0;
241 os_free(ssid->eap.phase1);
242 ssid->eap.phase1 = NULL;
243 os_free(ssid->eap.eap_methods);
244 ssid->eap.eap_methods = NULL;
245 if (!ssid->p2p_group)
248 wpa_printf(MSG_DEBUG, "WPS: Create a new network based on the "
249 "received credential");
250 ssid = wpa_config_add_network(wpa_s->conf);
253 wpas_notify_network_added(wpa_s, ssid);
256 wpa_config_set_network_defaults(ssid);
259 ssid->ssid = os_malloc(cred->ssid_len);
261 os_memcpy(ssid->ssid, cred->ssid, cred->ssid_len);
262 ssid->ssid_len = cred->ssid_len;
265 switch (cred->encr_type) {
269 if (cred->key_len <= 0)
271 if (cred->key_len != 5 && cred->key_len != 13 &&
272 cred->key_len != 10 && cred->key_len != 26) {
273 wpa_printf(MSG_ERROR, "WPS: Invalid WEP Key length "
274 "%lu", (unsigned long) cred->key_len);
277 if (cred->key_idx > NUM_WEP_KEYS) {
278 wpa_printf(MSG_ERROR, "WPS: Invalid WEP Key index %d",
283 key_idx = cred->key_idx - 1;
284 if (cred->key_len == 10 || cred->key_len == 26) {
285 if (hexstr2bin((char *) cred->key,
286 ssid->wep_key[key_idx],
287 cred->key_len / 2) < 0) {
288 wpa_printf(MSG_ERROR, "WPS: Invalid WEP Key "
292 ssid->wep_key_len[key_idx] = cred->key_len / 2;
294 os_memcpy(ssid->wep_key[key_idx], cred->key,
296 ssid->wep_key_len[key_idx] = cred->key_len;
298 ssid->wep_tx_keyidx = key_idx;
301 ssid->pairwise_cipher = WPA_CIPHER_TKIP;
304 ssid->pairwise_cipher = WPA_CIPHER_CCMP;
310 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
311 ssid->key_mgmt = WPA_KEY_MGMT_NONE;
314 case WPS_AUTH_SHARED:
315 ssid->auth_alg = WPA_AUTH_ALG_SHARED;
316 ssid->key_mgmt = WPA_KEY_MGMT_NONE;
319 case WPS_AUTH_WPAPSK:
320 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
321 ssid->key_mgmt = WPA_KEY_MGMT_PSK;
322 ssid->proto = WPA_PROTO_WPA;
325 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
326 ssid->key_mgmt = WPA_KEY_MGMT_IEEE8021X;
327 ssid->proto = WPA_PROTO_WPA;
330 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
331 ssid->key_mgmt = WPA_KEY_MGMT_IEEE8021X;
332 ssid->proto = WPA_PROTO_RSN;
334 case WPS_AUTH_WPA2PSK:
335 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
336 ssid->key_mgmt = WPA_KEY_MGMT_PSK;
337 ssid->proto = WPA_PROTO_RSN;
341 if (ssid->key_mgmt == WPA_KEY_MGMT_PSK) {
342 if (cred->key_len == 2 * PMK_LEN) {
343 if (hexstr2bin((const char *) cred->key, ssid->psk,
345 wpa_printf(MSG_ERROR, "WPS: Invalid Network "
350 } else if (cred->key_len >= 8 && cred->key_len < 2 * PMK_LEN) {
351 os_free(ssid->passphrase);
352 ssid->passphrase = os_malloc(cred->key_len + 1);
353 if (ssid->passphrase == NULL)
355 os_memcpy(ssid->passphrase, cred->key, cred->key_len);
356 ssid->passphrase[cred->key_len] = '\0';
357 wpa_config_update_psk(ssid);
359 wpa_printf(MSG_ERROR, "WPS: Invalid Network Key "
361 (unsigned long) cred->key_len);
366 wpas_wps_security_workaround(wpa_s, ssid, cred);
368 #ifndef CONFIG_NO_CONFIG_WRITE
369 if (wpa_s->conf->update_config &&
370 wpa_config_write(wpa_s->confname, wpa_s->conf)) {
371 wpa_printf(MSG_DEBUG, "WPS: Failed to update configuration");
374 #endif /* CONFIG_NO_CONFIG_WRITE */
380 static void wpa_supplicant_wps_event_m2d(struct wpa_supplicant *wpa_s,
381 struct wps_event_m2d *m2d)
383 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_M2D
384 "dev_password_id=%d config_error=%d",
385 m2d->dev_password_id, m2d->config_error);
386 wpas_notify_wps_event_m2d(wpa_s, m2d);
390 static void wpa_supplicant_wps_event_fail(struct wpa_supplicant *wpa_s,
391 struct wps_event_fail *fail)
393 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_FAIL "msg=%d", fail->msg);
394 wpas_clear_wps(wpa_s);
395 wpas_notify_wps_event_fail(wpa_s, fail);
399 static void wpa_supplicant_wps_event_success(struct wpa_supplicant *wpa_s)
401 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_SUCCESS);
402 wpa_s->wps_success = 1;
403 wpas_notify_wps_event_success(wpa_s);
405 wpas_p2p_wps_success(wpa_s, wpa_s->bssid, 0);
406 #endif /* CONFIG_P2P */
410 static void wpa_supplicant_wps_event_er_ap_add(struct wpa_supplicant *wpa_s,
411 struct wps_event_er_ap *ap)
414 char dev_type[WPS_DEV_TYPE_BUFSIZE];
416 uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str));
417 if (ap->pri_dev_type)
418 wps_dev_type_bin2str(ap->pri_dev_type, dev_type,
423 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_AP_ADD "%s " MACSTR
424 " pri_dev_type=%s wps_state=%d |%s|%s|%s|%s|%s|%s|",
425 uuid_str, MAC2STR(ap->mac_addr), dev_type, ap->wps_state,
426 ap->friendly_name ? ap->friendly_name : "",
427 ap->manufacturer ? ap->manufacturer : "",
428 ap->model_description ? ap->model_description : "",
429 ap->model_name ? ap->model_name : "",
430 ap->manufacturer_url ? ap->manufacturer_url : "",
431 ap->model_url ? ap->model_url : "");
435 static void wpa_supplicant_wps_event_er_ap_remove(struct wpa_supplicant *wpa_s,
436 struct wps_event_er_ap *ap)
439 uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str));
440 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_AP_REMOVE "%s", uuid_str);
444 static void wpa_supplicant_wps_event_er_enrollee_add(
445 struct wpa_supplicant *wpa_s, struct wps_event_er_enrollee *enrollee)
448 char dev_type[WPS_DEV_TYPE_BUFSIZE];
450 uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str));
451 if (enrollee->pri_dev_type)
452 wps_dev_type_bin2str(enrollee->pri_dev_type, dev_type,
457 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_ENROLLEE_ADD "%s " MACSTR
458 " M1=%d config_methods=0x%x dev_passwd_id=%d pri_dev_type=%s "
460 uuid_str, MAC2STR(enrollee->mac_addr), enrollee->m1_received,
461 enrollee->config_methods, enrollee->dev_passwd_id, dev_type,
462 enrollee->dev_name ? enrollee->dev_name : "",
463 enrollee->manufacturer ? enrollee->manufacturer : "",
464 enrollee->model_name ? enrollee->model_name : "",
465 enrollee->model_number ? enrollee->model_number : "",
466 enrollee->serial_number ? enrollee->serial_number : "");
470 static void wpa_supplicant_wps_event_er_enrollee_remove(
471 struct wpa_supplicant *wpa_s, struct wps_event_er_enrollee *enrollee)
474 uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str));
475 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_ENROLLEE_REMOVE "%s " MACSTR,
476 uuid_str, MAC2STR(enrollee->mac_addr));
480 static void wpa_supplicant_wps_event_er_ap_settings(
481 struct wpa_supplicant *wpa_s,
482 struct wps_event_er_ap_settings *ap_settings)
486 const struct wps_credential *cred = ap_settings->cred;
489 if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK)) {
490 if (cred->key_len >= 8 && cred->key_len <= 64) {
491 os_memcpy(key_str, cred->key, cred->key_len);
492 key_str[cred->key_len] = '\0';
496 uuid_bin2str(ap_settings->uuid, uuid_str, sizeof(uuid_str));
497 /* Use wpa_msg_ctrl to avoid showing the key in debug log */
498 wpa_msg_ctrl(wpa_s, MSG_INFO, WPS_EVENT_ER_AP_SETTINGS
499 "uuid=%s ssid=%s auth_type=0x%04x encr_type=0x%04x "
501 uuid_str, wpa_ssid_txt(cred->ssid, cred->ssid_len),
502 cred->auth_type, cred->encr_type, key_str);
506 static void wpa_supplicant_wps_event(void *ctx, enum wps_event event,
507 union wps_event_data *data)
509 struct wpa_supplicant *wpa_s = ctx;
512 wpa_supplicant_wps_event_m2d(wpa_s, &data->m2d);
515 wpa_supplicant_wps_event_fail(wpa_s, &data->fail);
518 wpa_supplicant_wps_event_success(wpa_s);
520 case WPS_EV_PWD_AUTH_FAIL:
522 case WPS_EV_PBC_OVERLAP:
524 case WPS_EV_PBC_TIMEOUT:
526 case WPS_EV_ER_AP_ADD:
527 wpa_supplicant_wps_event_er_ap_add(wpa_s, &data->ap);
529 case WPS_EV_ER_AP_REMOVE:
530 wpa_supplicant_wps_event_er_ap_remove(wpa_s, &data->ap);
532 case WPS_EV_ER_ENROLLEE_ADD:
533 wpa_supplicant_wps_event_er_enrollee_add(wpa_s,
536 case WPS_EV_ER_ENROLLEE_REMOVE:
537 wpa_supplicant_wps_event_er_enrollee_remove(wpa_s,
540 case WPS_EV_ER_AP_SETTINGS:
541 wpa_supplicant_wps_event_er_ap_settings(wpa_s,
548 enum wps_request_type wpas_wps_get_req_type(struct wpa_ssid *ssid)
550 if (eap_is_wps_pbc_enrollee(&ssid->eap) ||
551 eap_is_wps_pin_enrollee(&ssid->eap))
552 return WPS_REQ_ENROLLEE;
554 return WPS_REQ_REGISTRAR;
558 static void wpas_clear_wps(struct wpa_supplicant *wpa_s)
561 struct wpa_ssid *ssid, *remove_ssid = NULL;
563 eloop_cancel_timeout(wpas_wps_timeout, wpa_s, NULL);
565 /* Remove any existing WPS network from configuration */
566 ssid = wpa_s->conf->ssid;
568 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
569 if (ssid == wpa_s->current_ssid) {
570 wpa_s->current_ssid = NULL;
572 wpas_notify_network_changed(wpa_s);
580 wpas_notify_network_removed(wpa_s, remove_ssid);
581 wpa_config_remove_network(wpa_s->conf, id);
587 static void wpas_wps_timeout(void *eloop_ctx, void *timeout_ctx)
589 struct wpa_supplicant *wpa_s = eloop_ctx;
590 wpa_printf(MSG_INFO, WPS_EVENT_TIMEOUT "Requested operation timed "
592 wpas_clear_wps(wpa_s);
596 static struct wpa_ssid * wpas_wps_add_network(struct wpa_supplicant *wpa_s,
597 int registrar, const u8 *bssid)
599 struct wpa_ssid *ssid;
601 ssid = wpa_config_add_network(wpa_s->conf);
604 wpas_notify_network_added(wpa_s, ssid);
605 wpa_config_set_network_defaults(ssid);
607 if (wpa_config_set(ssid, "key_mgmt", "WPS", 0) < 0 ||
608 wpa_config_set(ssid, "eap", "WSC", 0) < 0 ||
609 wpa_config_set(ssid, "identity", registrar ?
610 "\"" WSC_ID_REGISTRAR "\"" :
611 "\"" WSC_ID_ENROLLEE "\"", 0) < 0) {
612 wpas_notify_network_removed(wpa_s, ssid);
613 wpa_config_remove_network(wpa_s->conf, ssid->id);
621 #endif /* CONFIG_P2P */
623 os_memcpy(ssid->bssid, bssid, ETH_ALEN);
627 * Note: With P2P, the SSID may change at the time the WPS
628 * provisioning is started, so better not filter the AP based
629 * on the current SSID in the scan results.
632 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
633 if (os_memcmp(bssid, bss->bssid, ETH_ALEN) != 0)
637 ssid->ssid = os_malloc(bss->ssid_len);
638 if (ssid->ssid == NULL)
640 os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
641 ssid->ssid_len = bss->ssid_len;
642 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Picked SSID from "
644 ssid->ssid, ssid->ssid_len);
649 wpa_printf(MSG_DEBUG, "WPS: More than one SSID found "
650 "for the AP; use wildcard");
655 #endif /* CONFIG_P2P */
662 static void wpas_wps_reassoc(struct wpa_supplicant *wpa_s,
663 struct wpa_ssid *selected)
665 struct wpa_ssid *ssid;
667 /* Mark all other networks disabled and trigger reassociation */
668 ssid = wpa_s->conf->ssid;
670 int was_disabled = ssid->disabled;
671 ssid->disabled = ssid != selected;
672 if (was_disabled != ssid->disabled)
673 wpas_notify_network_enabled_changed(wpa_s, ssid);
676 wpa_s->disconnected = 0;
677 wpa_s->reassociate = 1;
678 wpa_s->scan_runs = 0;
679 wpa_s->wps_success = 0;
680 wpa_s->blacklist_cleared = 0;
681 wpa_supplicant_req_scan(wpa_s, 0, 0);
685 int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
688 struct wpa_ssid *ssid;
689 wpas_clear_wps(wpa_s);
690 ssid = wpas_wps_add_network(wpa_s, 0, bssid);
694 ssid->p2p_group = p2p_group;
696 if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
697 ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
699 ssid->ssid_len = wpa_s->go_params->ssid_len;
700 os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
702 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Use specific AP "
703 "SSID", ssid->ssid, ssid->ssid_len);
706 #endif /* CONFIG_P2P */
707 wpa_config_set(ssid, "phase1", "\"pbc=1\"", 0);
708 if (wpa_s->wps_fragment_size)
709 ssid->eap.fragment_size = wpa_s->wps_fragment_size;
710 eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wpas_wps_timeout,
712 wpas_wps_reassoc(wpa_s, ssid);
717 int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
718 const char *pin, int p2p_group, u16 dev_pw_id)
720 struct wpa_ssid *ssid;
722 unsigned int rpin = 0;
724 wpas_clear_wps(wpa_s);
725 ssid = wpas_wps_add_network(wpa_s, 0, bssid);
729 ssid->p2p_group = p2p_group;
731 if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
732 ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
734 ssid->ssid_len = wpa_s->go_params->ssid_len;
735 os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
737 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Use specific AP "
738 "SSID", ssid->ssid, ssid->ssid_len);
741 #endif /* CONFIG_P2P */
743 os_snprintf(val, sizeof(val), "\"pin=%s dev_pw_id=%u\"",
746 rpin = wps_generate_pin();
747 os_snprintf(val, sizeof(val), "\"pin=%08d dev_pw_id=%u\"",
750 wpa_config_set(ssid, "phase1", val, 0);
751 if (wpa_s->wps_fragment_size)
752 ssid->eap.fragment_size = wpa_s->wps_fragment_size;
753 eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wpas_wps_timeout,
755 wpas_wps_reassoc(wpa_s, ssid);
760 #ifdef CONFIG_WPS_OOB
761 int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
762 char *path, char *method, char *name)
764 struct wps_context *wps = wpa_s->wps;
765 struct oob_device_data *oob_dev;
767 oob_dev = wps_get_oob_device(device_type);
770 oob_dev->device_path = path;
771 oob_dev->device_name = name;
772 wps->oob_conf.oob_method = wps_get_oob_method(method);
774 if (wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_E) {
776 * Use pre-configured DH keys in order to be able to write the
777 * key hash into the OOB file.
779 wpabuf_free(wps->dh_pubkey);
780 wpabuf_free(wps->dh_privkey);
781 wps->dh_privkey = NULL;
782 wps->dh_pubkey = NULL;
783 dh5_free(wps->dh_ctx);
784 wps->dh_ctx = dh5_init(&wps->dh_privkey, &wps->dh_pubkey);
785 wps->dh_pubkey = wpabuf_zeropad(wps->dh_pubkey, 192);
786 if (wps->dh_ctx == NULL || wps->dh_pubkey == NULL) {
787 wpa_printf(MSG_ERROR, "WPS: Failed to initialize "
788 "Diffie-Hellman handshake");
793 if (wps->oob_conf.oob_method == OOB_METHOD_CRED)
794 wpas_clear_wps(wpa_s);
796 if (wps_process_oob(wps, oob_dev, 0) < 0)
799 if ((wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_E ||
800 wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_R) &&
801 wpas_wps_start_pin(wpa_s, NULL,
802 wpabuf_head(wps->oob_conf.dev_password), 0) < 0)
807 #endif /* CONFIG_WPS_OOB */
810 int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
811 const char *pin, struct wps_new_ap_settings *settings)
813 struct wpa_ssid *ssid;
820 wpas_clear_wps(wpa_s);
821 ssid = wpas_wps_add_network(wpa_s, 1, bssid);
826 end = pos + sizeof(val);
827 res = os_snprintf(pos, end - pos, "\"pin=%s", pin);
828 if (res < 0 || res >= end - pos)
832 res = os_snprintf(pos, end - pos, " new_ssid=%s new_auth=%s "
833 "new_encr=%s new_key=%s",
834 settings->ssid_hex, settings->auth,
835 settings->encr, settings->key_hex);
836 if (res < 0 || res >= end - pos)
840 res = os_snprintf(pos, end - pos, "\"");
841 if (res < 0 || res >= end - pos)
843 wpa_config_set(ssid, "phase1", val, 0);
844 if (wpa_s->wps_fragment_size)
845 ssid->eap.fragment_size = wpa_s->wps_fragment_size;
846 eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wpas_wps_timeout,
848 wpas_wps_reassoc(wpa_s, ssid);
853 static int wpas_wps_new_psk_cb(void *ctx, const u8 *mac_addr, const u8 *psk,
856 wpa_printf(MSG_DEBUG, "WPS: Received new WPA/WPA2-PSK from WPS for "
857 "STA " MACSTR, MAC2STR(mac_addr));
858 wpa_hexdump_key(MSG_DEBUG, "Per-device PSK", psk, psk_len);
866 static void wpas_wps_pin_needed_cb(void *ctx, const u8 *uuid_e,
867 const struct wps_device_data *dev)
869 char uuid[40], txt[400];
871 char devtype[WPS_DEV_TYPE_BUFSIZE];
872 if (uuid_bin2str(uuid_e, uuid, sizeof(uuid)))
874 wpa_printf(MSG_DEBUG, "WPS: PIN needed for UUID-E %s", uuid);
875 len = os_snprintf(txt, sizeof(txt), "WPS-EVENT-PIN-NEEDED %s " MACSTR
876 " [%s|%s|%s|%s|%s|%s]",
877 uuid, MAC2STR(dev->mac_addr), dev->device_name,
878 dev->manufacturer, dev->model_name,
879 dev->model_number, dev->serial_number,
880 wps_dev_type_bin2str(dev->pri_dev_type, devtype,
882 if (len > 0 && len < (int) sizeof(txt))
883 wpa_printf(MSG_INFO, "%s", txt);
887 static void wpas_wps_set_sel_reg_cb(void *ctx, int sel_reg, u16 dev_passwd_id,
888 u16 sel_reg_config_methods)
891 struct wpa_supplicant *wpa_s = ctx;
893 if (wpa_s->wps_er == NULL)
895 wpa_printf(MSG_DEBUG, "WPS ER: SetSelectedRegistrar - sel_reg=%d "
896 "dev_password_id=%u sel_reg_config_methods=0x%x",
897 sel_reg, dev_passwd_id, sel_reg_config_methods);
898 wps_er_set_sel_reg(wpa_s->wps_er, sel_reg, dev_passwd_id,
899 sel_reg_config_methods);
900 #endif /* CONFIG_WPS_ER */
904 int wpas_wps_init(struct wpa_supplicant *wpa_s)
906 struct wps_context *wps;
907 struct wps_registrar_config rcfg;
909 wps = os_zalloc(sizeof(*wps));
913 wps->cred_cb = wpa_supplicant_wps_cred;
914 wps->event_cb = wpa_supplicant_wps_event;
917 wps->dev.device_name = wpa_s->conf->device_name;
918 wps->dev.manufacturer = wpa_s->conf->manufacturer;
919 wps->dev.model_name = wpa_s->conf->model_name;
920 wps->dev.model_number = wpa_s->conf->model_number;
921 wps->dev.serial_number = wpa_s->conf->serial_number;
922 wps->config_methods =
923 wps_config_methods_str2bin(wpa_s->conf->config_methods);
924 if ((wps->config_methods & (WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) ==
925 (WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) {
926 wpa_printf(MSG_ERROR, "WPS: Both Label and Display config "
927 "methods are not allowed at the same time");
931 if (wpa_s->conf->device_type &&
932 wps_dev_type_str2bin(wpa_s->conf->device_type,
933 wps->dev.pri_dev_type) < 0) {
934 wpa_printf(MSG_ERROR, "WPS: Invalid device_type");
938 wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
939 wps->dev.rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ; /* TODO: config */
940 os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
941 if (is_nil_uuid(wpa_s->conf->uuid)) {
942 uuid_gen_mac_addr(wpa_s->own_addr, wps->uuid);
943 wpa_hexdump(MSG_DEBUG, "WPS: UUID based on MAC address",
944 wps->uuid, WPS_UUID_LEN);
946 os_memcpy(wps->uuid, wpa_s->conf->uuid, WPS_UUID_LEN);
948 wps->auth_types = WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK;
949 wps->encr_types = WPS_ENCR_AES | WPS_ENCR_TKIP;
951 os_memset(&rcfg, 0, sizeof(rcfg));
952 rcfg.new_psk_cb = wpas_wps_new_psk_cb;
953 rcfg.pin_needed_cb = wpas_wps_pin_needed_cb;
954 rcfg.set_sel_reg_cb = wpas_wps_set_sel_reg_cb;
957 wps->registrar = wps_registrar_init(wps, &rcfg);
958 if (wps->registrar == NULL) {
959 wpa_printf(MSG_DEBUG, "Failed to initialize WPS Registrar");
970 void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
972 eloop_cancel_timeout(wpas_wps_timeout, wpa_s, NULL);
974 if (wpa_s->wps == NULL)
978 wps_er_deinit(wpa_s->wps_er, NULL, NULL);
979 wpa_s->wps_er = NULL;
980 #endif /* CONFIG_WPS_ER */
982 wps_registrar_deinit(wpa_s->wps->registrar);
983 wpabuf_free(wpa_s->wps->dh_pubkey);
984 wpabuf_free(wpa_s->wps->dh_privkey);
985 wpabuf_free(wpa_s->wps->oob_conf.pubkey_hash);
986 wpabuf_free(wpa_s->wps->oob_conf.dev_password);
987 os_free(wpa_s->wps->network_key);
993 int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
994 struct wpa_ssid *ssid, struct wpa_scan_res *bss)
996 struct wpabuf *wps_ie;
998 if (!(ssid->key_mgmt & WPA_KEY_MGMT_WPS))
1001 wps_ie = wpa_scan_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
1002 if (eap_is_wps_pbc_enrollee(&ssid->eap)) {
1004 wpa_printf(MSG_DEBUG, " skip - non-WPS AP");
1008 if (!wps_is_selected_pbc_registrar(wps_ie)) {
1009 wpa_printf(MSG_DEBUG, " skip - WPS AP "
1010 "without active PBC Registrar");
1011 wpabuf_free(wps_ie);
1015 /* TODO: overlap detection */
1016 wpa_printf(MSG_DEBUG, " selected based on WPS IE "
1018 wpabuf_free(wps_ie);
1022 if (eap_is_wps_pin_enrollee(&ssid->eap)) {
1024 wpa_printf(MSG_DEBUG, " skip - non-WPS AP");
1029 * Start with WPS APs that advertise our address as an
1030 * authorized MAC (v2.0) or active PIN Registrar (v1.0) and
1031 * allow any WPS AP after couple of scans since some APs do not
1032 * set Selected Registrar attribute properly when using
1033 * external Registrar.
1035 if (!wps_is_addr_authorized(wps_ie, wpa_s->own_addr, 1)) {
1036 if (wpa_s->scan_runs < WPS_PIN_SCAN_IGNORE_SEL_REG) {
1037 wpa_printf(MSG_DEBUG, " skip - WPS AP "
1038 "without active PIN Registrar");
1039 wpabuf_free(wps_ie);
1042 wpa_printf(MSG_DEBUG, " selected based on WPS IE");
1044 wpa_printf(MSG_DEBUG, " selected based on WPS IE "
1045 "(Authorized MAC or Active PIN)");
1047 wpabuf_free(wps_ie);
1052 wpa_printf(MSG_DEBUG, " selected based on WPS IE");
1053 wpabuf_free(wps_ie);
1061 int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
1062 struct wpa_ssid *ssid,
1063 struct wpa_scan_res *bss)
1065 struct wpabuf *wps_ie = NULL;
1068 if (eap_is_wps_pbc_enrollee(&ssid->eap)) {
1069 wps_ie = wpa_scan_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
1070 if (wps_ie && wps_is_selected_pbc_registrar(wps_ie)) {
1071 /* allow wildcard SSID for WPS PBC */
1074 } else if (eap_is_wps_pin_enrollee(&ssid->eap)) {
1075 wps_ie = wpa_scan_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
1077 (wps_is_addr_authorized(wps_ie, wpa_s->own_addr, 1) ||
1078 wpa_s->scan_runs >= WPS_PIN_SCAN_IGNORE_SEL_REG)) {
1079 /* allow wildcard SSID for WPS PIN */
1084 if (!ret && ssid->bssid_set &&
1085 os_memcmp(ssid->bssid, bss->bssid, ETH_ALEN) == 0) {
1086 /* allow wildcard SSID due to hardcoded BSSID match */
1090 #ifdef CONFIG_WPS_STRICT
1092 if (wps_validate_beacon_probe_resp(wps_ie, bss->beacon_ie_len >
1095 if (bss->beacon_ie_len) {
1096 struct wpabuf *bcn_wps;
1097 bcn_wps = wpa_scan_get_vendor_ie_multi_beacon(
1098 bss, WPS_IE_VENDOR_TYPE);
1099 if (bcn_wps == NULL) {
1100 wpa_printf(MSG_DEBUG, "WPS: Mandatory WPS IE "
1101 "missing from AP Beacon");
1104 if (wps_validate_beacon(wps_ie) < 0)
1106 wpabuf_free(bcn_wps);
1110 #endif /* CONFIG_WPS_STRICT */
1112 wpabuf_free(wps_ie);
1118 int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
1119 struct wpa_bss *selected, struct wpa_ssid *ssid)
1121 const u8 *sel_uuid, *uuid;
1122 struct wpabuf *wps_ie;
1124 struct wpa_bss *bss;
1126 if (!eap_is_wps_pbc_enrollee(&ssid->eap))
1129 /* Make sure that only one AP is in active PBC mode */
1130 wps_ie = wpa_bss_get_vendor_ie_multi(selected, WPS_IE_VENDOR_TYPE);
1132 sel_uuid = wps_get_uuid_e(wps_ie);
1136 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
1138 if (bss == selected)
1140 ie = wpa_bss_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
1143 if (!wps_is_selected_pbc_registrar(ie)) {
1147 uuid = wps_get_uuid_e(ie);
1148 if (sel_uuid == NULL || uuid == NULL ||
1149 os_memcmp(sel_uuid, uuid, 16) != 0) {
1150 ret = 1; /* PBC overlap */
1155 /* TODO: verify that this is reasonable dual-band situation */
1160 wpabuf_free(wps_ie);
1166 void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
1168 struct wpa_bss *bss;
1170 if (wpa_s->disconnected || wpa_s->wpa_state >= WPA_ASSOCIATED)
1173 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
1175 ie = wpa_bss_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
1178 if (wps_is_selected_pbc_registrar(ie))
1179 wpa_msg_ctrl(wpa_s, MSG_INFO,
1180 WPS_EVENT_AP_AVAILABLE_PBC);
1181 else if (wps_is_addr_authorized(ie, wpa_s->own_addr, 0))
1182 wpa_msg_ctrl(wpa_s, MSG_INFO,
1183 WPS_EVENT_AP_AVAILABLE_AUTH);
1184 else if (wps_is_selected_pin_registrar(ie))
1185 wpa_msg_ctrl(wpa_s, MSG_INFO,
1186 WPS_EVENT_AP_AVAILABLE_PIN);
1188 wpa_msg_ctrl(wpa_s, MSG_INFO,
1189 WPS_EVENT_AP_AVAILABLE);
1196 int wpas_wps_searching(struct wpa_supplicant *wpa_s)
1198 struct wpa_ssid *ssid;
1200 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
1201 if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && !ssid->disabled)
1209 int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
1212 struct wpabuf *wps_ie;
1215 wps_ie = ieee802_11_vendor_ie_concat(ies, ies_len, WPS_DEV_OUI_WFA);
1219 ret = wps_attr_text(wps_ie, buf, end);
1220 wpabuf_free(wps_ie);
1225 int wpas_wps_er_start(struct wpa_supplicant *wpa_s, const char *filter)
1227 #ifdef CONFIG_WPS_ER
1228 if (wpa_s->wps_er) {
1229 wps_er_refresh(wpa_s->wps_er);
1232 wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname, filter);
1233 if (wpa_s->wps_er == NULL)
1236 #else /* CONFIG_WPS_ER */
1238 #endif /* CONFIG_WPS_ER */
1242 int wpas_wps_er_stop(struct wpa_supplicant *wpa_s)
1244 #ifdef CONFIG_WPS_ER
1245 wps_er_deinit(wpa_s->wps_er, NULL, NULL);
1246 wpa_s->wps_er = NULL;
1247 #endif /* CONFIG_WPS_ER */
1252 #ifdef CONFIG_WPS_ER
1253 int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const u8 *addr,
1254 const char *uuid, const char *pin)
1259 if (os_strcmp(uuid, "any") == 0)
1261 else if (uuid_str2bin(uuid, u))
1263 return wps_registrar_add_pin(wpa_s->wps->registrar, addr,
1265 (const u8 *) pin, os_strlen(pin), 300);
1269 int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid)
1273 if (uuid_str2bin(uuid, u))
1275 return wps_er_pbc(wpa_s->wps_er, u);
1279 int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
1284 if (uuid_str2bin(uuid, u))
1286 return wps_er_learn(wpa_s->wps_er, u, (const u8 *) pin,
1291 int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
1292 const char *pin, struct wps_new_ap_settings *settings)
1295 struct wps_credential cred;
1298 if (uuid_str2bin(uuid, u))
1300 if (settings->ssid_hex == NULL || settings->auth == NULL ||
1301 settings->encr == NULL || settings->key_hex == NULL)
1304 os_memset(&cred, 0, sizeof(cred));
1305 len = os_strlen(settings->ssid_hex);
1306 if ((len & 1) || len > 2 * sizeof(cred.ssid) ||
1307 hexstr2bin(settings->ssid_hex, cred.ssid, len / 2))
1309 cred.ssid_len = len / 2;
1311 len = os_strlen(settings->key_hex);
1312 if ((len & 1) || len > 2 * sizeof(cred.key) ||
1313 hexstr2bin(settings->key_hex, cred.key, len / 2))
1315 cred.key_len = len / 2;
1317 if (os_strcmp(settings->auth, "OPEN") == 0)
1318 cred.auth_type = WPS_AUTH_OPEN;
1319 else if (os_strcmp(settings->auth, "WPAPSK") == 0)
1320 cred.auth_type = WPS_AUTH_WPAPSK;
1321 else if (os_strcmp(settings->auth, "WPA2PSK") == 0)
1322 cred.auth_type = WPS_AUTH_WPA2PSK;
1326 if (os_strcmp(settings->encr, "NONE") == 0)
1327 cred.encr_type = WPS_ENCR_NONE;
1328 else if (os_strcmp(settings->encr, "WEP") == 0)
1329 cred.encr_type = WPS_ENCR_WEP;
1330 else if (os_strcmp(settings->encr, "TKIP") == 0)
1331 cred.encr_type = WPS_ENCR_TKIP;
1332 else if (os_strcmp(settings->encr, "CCMP") == 0)
1333 cred.encr_type = WPS_ENCR_AES;
1337 return wps_er_config(wpa_s->wps_er, u, (const u8 *) pin,
1338 os_strlen(pin), &cred);
1342 static void wpas_wps_terminate_cb(void *ctx)
1344 wpa_printf(MSG_DEBUG, "WPS ER: Terminated");
1347 #endif /* CONFIG_WPS_ER */
1350 int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s)
1352 #ifdef CONFIG_WPS_ER
1353 if (wpa_s->wps_er) {
1354 wps_er_deinit(wpa_s->wps_er, wpas_wps_terminate_cb, wpa_s);
1355 wpa_s->wps_er = NULL;
1358 #endif /* CONFIG_WPS_ER */
1363 int wpas_wps_in_progress(struct wpa_supplicant *wpa_s)
1365 struct wpa_ssid *ssid;
1367 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
1368 if (!ssid->disabled && ssid->key_mgmt == WPA_KEY_MGMT_WPS)
1376 void wpas_wps_update_config(struct wpa_supplicant *wpa_s)
1378 struct wps_context *wps = wpa_s->wps;
1383 if (wpa_s->conf->changed_parameters & CFG_CHANGED_CONFIG_METHODS) {
1384 wps->config_methods = wps_config_methods_str2bin(
1385 wpa_s->conf->config_methods);
1386 if ((wps->config_methods &
1387 (WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) ==
1388 (WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) {
1389 wpa_printf(MSG_ERROR, "WPS: Both Label and Display "
1390 "config methods are not allowed at the "
1392 wps->config_methods &= ~WPS_CONFIG_LABEL;
1396 if (wpa_s->conf->changed_parameters & CFG_CHANGED_DEVICE_TYPE) {
1397 if (wpa_s->conf->device_type &&
1398 wps_dev_type_str2bin(wpa_s->conf->device_type,
1399 wps->dev.pri_dev_type) < 0)
1400 wpa_printf(MSG_ERROR, "WPS: Invalid device_type");
1403 if (wpa_s->conf->changed_parameters & CFG_CHANGED_OS_VERSION)
1404 wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
1406 if (wpa_s->conf->changed_parameters & CFG_CHANGED_UUID) {
1407 if (is_nil_uuid(wpa_s->conf->uuid)) {
1408 uuid_gen_mac_addr(wpa_s->own_addr, wps->uuid);
1409 wpa_hexdump(MSG_DEBUG, "WPS: UUID based on MAC "
1410 "address", wps->uuid, WPS_UUID_LEN);
1412 os_memcpy(wps->uuid, wpa_s->conf->uuid, WPS_UUID_LEN);
1415 if (wpa_s->conf->changed_parameters &
1416 (CFG_CHANGED_DEVICE_NAME | CFG_CHANGED_WPS_STRING)) {
1417 /* Update pointers to make sure they refer current values */
1418 wps->dev.device_name = wpa_s->conf->device_name;
1419 wps->dev.manufacturer = wpa_s->conf->manufacturer;
1420 wps->dev.model_name = wpa_s->conf->model_name;
1421 wps->dev.model_number = wpa_s->conf->model_number;
1422 wps->dev.serial_number = wpa_s->conf->serial_number;