Lines Matching refs:ssid
118 struct wpa_ssid *ssid = NULL;
139 bss = wpa_supplicant_pick_network(wpa_s, &ssid);
183 struct wpa_ssid *ssid,
203 if (ssid->ssid == NULL)
205 bss = wpa_bss_get(wpa_s, cred->mac_addr, ssid->ssid, ssid->ssid_len);
226 if (ie == NULL && (ssid->proto & WPA_PROTO_WPA) &&
227 (ssid->pairwise_cipher & WPA_CIPHER_TKIP)) {
239 if (ccmp && !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) &&
240 (ssid->pairwise_cipher & WPA_CIPHER_TKIP) &&
245 ssid->pairwise_cipher |= WPA_CIPHER_CCMP;
247 ssid->pairwise_cipher = WPA_CIPHER_CCMP;
250 if (wpa2 && !(ssid->proto & WPA_PROTO_RSN) &&
251 (ssid->proto & WPA_PROTO_WPA) &&
256 ssid->proto |= WPA_PROTO_RSN;
258 ssid->proto = WPA_PROTO_RSN;
266 struct wpa_ssid *ssid, *next;
268 for (ssid = wpa_s->conf->ssid, next = ssid ? ssid->next : NULL; ssid;
269 ssid = next, next = ssid ? ssid->next : NULL) {
274 if (ssid == new_ssid)
277 if (ssid->bssid_set || new_ssid->bssid_set) {
278 if (ssid->bssid_set != new_ssid->bssid_set)
280 if (os_memcmp(ssid->bssid, new_ssid->bssid, ETH_ALEN) !=
285 /* compare SSID */
286 if (ssid->ssid_len == 0 || ssid->ssid_len != new_ssid->ssid_len)
289 if (ssid->ssid && new_ssid->ssid) {
290 if (os_memcmp(ssid->ssid, new_ssid->ssid,
291 ssid->ssid_len) != 0)
293 } else if (ssid->ssid || new_ssid->ssid)
297 if (ssid->auth_alg != new_ssid->auth_alg ||
298 ssid->key_mgmt != new_ssid->key_mgmt ||
299 (ssid->group_cipher != new_ssid->group_cipher &&
300 !(ssid->group_cipher & new_ssid->group_cipher &
310 if (ssid->wps_run && ssid->wps_run == new_ssid->wps_run &&
311 wpa_key_mgmt_wpa_psk(ssid->key_mgmt)) {
312 if (new_ssid->passphrase && ssid->passphrase &&
313 os_strcmp(new_ssid->passphrase, ssid->passphrase) !=
321 (!ssid->psk_set ||
322 os_memcmp(new_ssid->psk, ssid->psk, 32) != 0)) {
328 if ((new_ssid->passphrase && !ssid->passphrase) ||
329 (!new_ssid->passphrase && ssid->passphrase)) {
337 new_ssid->proto |= ssid->proto;
338 new_ssid->pairwise_cipher |= ssid->pairwise_cipher;
344 if (ssid->proto != new_ssid->proto ||
345 ssid->pairwise_cipher != new_ssid->pairwise_cipher)
350 wpa_printf(MSG_DEBUG, "Remove duplicate network %d", ssid->id);
351 wpas_notify_network_removed(wpa_s, ssid);
352 if (wpa_s->current_ssid == ssid)
354 wpa_config_remove_network(wpa_s->conf, ssid->id);
363 struct wpa_ssid *ssid = wpa_s->current_ssid;
391 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", cred->ssid, cred->ssid_len);
426 if (ssid && (ssid->key_mgmt & WPA_KEY_MGMT_WPS)) {
430 if (ssid->eap.identity &&
431 ssid->eap.identity_len == WSC_ID_REGISTRAR_LEN &&
432 os_memcmp(ssid->eap.identity, WSC_ID_REGISTRAR,
436 os_free(ssid->eap.identity);
437 ssid->eap.identity = NULL;
438 ssid->eap.identity_len = 0;
439 os_free(ssid->eap.phase1);
440 ssid->eap.phase1 = NULL;
441 os_free(ssid->eap.eap_methods);
442 ssid->eap.eap_methods = NULL;
443 if (!ssid->p2p_group) {
444 ssid->temporary = 0;
445 ssid->bssid_set = 0;
447 ssid->disabled_until.sec = 0;
448 ssid->disabled_until.usec = 0;
449 ssid->auth_failures = 0;
453 ssid = wpa_config_add_network(wpa_s->conf);
454 if (ssid == NULL)
464 ssid->p2p_group = wpa_s->current_ssid->p2p_group;
465 ssid->temporary = wpa_s->current_ssid->temporary;
467 wpas_notify_network_added(wpa_s, ssid);
470 wpa_config_set_network_defaults(ssid);
471 ssid->wps_run = wpa_s->wps_run;
473 os_free(ssid->ssid);
474 ssid->ssid = os_malloc(cred->ssid_len);
475 if (ssid->ssid) {
476 os_memcpy(ssid->ssid, cred->ssid, cred->ssid_len);
477 ssid->ssid_len = cred->ssid_len;
484 ssid->pairwise_cipher = WPA_CIPHER_TKIP;
487 ssid->pairwise_cipher = WPA_CIPHER_CCMP;
490 ssid->pairwise_cipher |= WPA_CIPHER_GCMP;
491 ssid->group_cipher |= WPA_CIPHER_GCMP;
498 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
499 ssid->key_mgmt = WPA_KEY_MGMT_NONE;
500 ssid->proto = 0;
507 ssid->id, ssid->id);
508 ssid->disabled = 1;
513 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
514 ssid->key_mgmt = WPA_KEY_MGMT_PSK;
515 ssid->proto = WPA_PROTO_WPA;
518 ssid->auth_alg = WPA_AUTH_ALG_OPEN;
519 ssid->key_mgmt = WPA_KEY_MGMT_PSK;
520 ssid->proto = WPA_PROTO_RSN;
524 if (ssid->key_mgmt == WPA_KEY_MGMT_PSK) {
526 if (hexstr2bin((const char *) cred->key, ssid->psk,
532 ssid->psk_set = 1;
533 ssid->export_keys = 1;
535 os_free(ssid->passphrase);
536 ssid->passphrase = os_malloc(cred->key_len + 1);
537 if (ssid->passphrase == NULL)
539 os_memcpy(ssid->passphrase, cred->key, cred->key_len);
540 ssid->passphrase[cred->key_len] = '\0';
541 wpa_config_update_psk(ssid);
542 ssid->export_keys = 1;
550 ssid->priority = wpa_s->conf->wps_priority;
552 ssid, cred);
554 wpas_wps_remove_dup_network(wpa_s, ssid);
564 if (ssid->priority)
652 struct wpa_ssid *ssid;
657 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
658 if (ssid->disabled_for_connect && ssid->disabled) {
659 ssid->disabled_for_connect = 0;
660 ssid->disabled = 0;
661 wpas_notify_network_enabled_changed(wpa_s, ssid);
803 "uuid=%s ssid=%s auth_type=0x%04x encr_type=0x%04x "
805 uuid_str, wpa_ssid_txt(cred->ssid, cred->ssid_len),
907 enum wps_request_type wpas_wps_get_req_type(struct wpa_ssid *ssid)
909 if (eap_is_wps_pbc_enrollee(&ssid->eap) ||
910 eap_is_wps_pin_enrollee(&ssid->eap))
920 struct wpa_ssid *ssid, *remove_ssid = NULL, *prev_current;
934 ssid = wpa_s->conf->ssid;
935 while (ssid) {
936 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
937 if (ssid == wpa_s->current_ssid) {
942 id = ssid->id;
943 remove_ssid = ssid;
946 ssid = ssid->next;
987 struct wpa_ssid *ssid;
989 ssid = wpa_config_add_network(wpa_s->conf);
990 if (ssid == NULL)
992 wpas_notify_network_added(wpa_s, ssid);
993 wpa_config_set_network_defaults(ssid);
994 ssid->temporary = 1;
995 if (wpa_config_set(ssid, "key_mgmt", "WPS", 0) < 0 ||
996 wpa_config_set(ssid, "eap", "WSC", 0) < 0 ||
997 wpa_config_set(ssid, "identity", registrar ?
1000 wpas_notify_network_removed(wpa_s, ssid);
1001 wpa_config_remove_network(wpa_s->conf, ssid->id);
1007 os_memcpy(ssid->go_p2p_dev_addr, dev_addr, ETH_ALEN);
1016 os_memcpy(ssid->bssid, bssid, ETH_ALEN);
1017 ssid->bssid_set = 1;
1020 * Note: With P2P, the SSID may change at the time the WPS
1022 * on the current SSID in the scan results.
1029 os_free(ssid->ssid);
1030 ssid->ssid = os_malloc(bss->ssid_len);
1031 if (ssid->ssid == NULL)
1033 os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
1034 ssid->ssid_len = bss->ssid_len;
1035 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Picked SSID from "
1037 ssid->ssid, ssid->ssid_len);
1042 wpa_printf(MSG_DEBUG, "WPS: More than one SSID found "
1044 os_free(ssid->ssid);
1045 ssid->ssid = NULL;
1046 ssid->ssid_len = 0;
1051 return ssid;
1058 struct wpa_ssid *ssid;
1067 ssid = wpa_s->conf->ssid;
1068 while (ssid) {
1069 int was_disabled = ssid->disabled;
1070 ssid->disabled_for_connect = 0;
1078 ssid->disabled = ssid != selected;
1079 if (was_disabled != ssid->disabled) {
1080 if (ssid->disabled)
1081 ssid->disabled_for_connect = 1;
1083 ssid);
1086 ssid = ssid->next;
1130 struct wpa_ssid *ssid;
1140 ssid = wpas_wps_add_network(wpa_s, 0, NULL, bssid);
1141 if (ssid == NULL)
1143 ssid->temporary = 1;
1144 ssid->p2p_group = p2p_group;
1147 ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
1148 if (ssid->ssid) {
1149 ssid->ssid_len = wpa_s->go_params->ssid_len;
1150 os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
1151 ssid->ssid_len);
1154 ssid->pbss = 1;
1157 "SSID", ssid->ssid, ssid->ssid_len);
1161 if (wpa_config_set(ssid, "phase1", "\"pbc=1\"", 0) < 0)
1164 ssid->eap.fragment_size = wpa_s->wps_fragment_size;
1167 wpas_wps_reassoc(wpa_s, ssid, bssid, 0);
1178 struct wpa_ssid *ssid;
1193 ssid = wpas_wps_add_network(wpa_s, 0, dev_addr, bssid);
1194 if (ssid == NULL) {
1198 ssid->temporary = 1;
1199 ssid->p2p_group = p2p_group;
1201 ssid->ssid = os_malloc(ssid_len);
1202 if (ssid->ssid) {
1203 os_memcpy(ssid->ssid, ssid_val, ssid_len);
1204 ssid->ssid_len = ssid_len;
1217 os_free(ssid->ssid);
1218 ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
1219 if (ssid->ssid) {
1220 ssid->ssid_len = wpa_s->go_params->ssid_len;
1221 os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
1222 ssid->ssid_len);
1225 ssid->pbss = 1;
1228 "SSID", ssid->ssid, ssid->ssid_len);
1246 if (wpa_config_set(ssid, "phase1", val, 0) < 0) {
1251 ssid->eap.fragment_size = wpa_s->wps_fragment_size;
1255 wpas_wps_reassoc(wpa_s, ssid, bssid, freq);
1324 struct wpa_ssid *ssid;
1339 ssid = wpas_wps_add_network(wpa_s, 1, NULL, bssid);
1340 if (ssid == NULL)
1342 ssid->temporary = 1;
1361 if (wpa_config_set(ssid, "phase1", val, 0) < 0)
1364 ssid->eap.fragment_size = wpa_s->wps_fragment_size;
1367 wpas_wps_reassoc(wpa_s, ssid, bssid, 0);
1633 struct wpa_ssid *ssid, struct wpa_bss *bss)
1637 if (!(ssid->key_mgmt & WPA_KEY_MGMT_WPS))
1641 if (eap_is_wps_pbc_enrollee(&ssid->eap)) {
1661 if (eap_is_wps_pin_enrollee(&ssid->eap)) {
1707 struct wpa_ssid *ssid,
1713 if (eap_is_wps_pbc_enrollee(&ssid->eap)) {
1716 /* allow wildcard SSID for WPS PBC */
1719 } else if (eap_is_wps_pin_enrollee(&ssid->eap)) {
1724 /* allow wildcard SSID for WPS PIN */
1729 if (!ret && ssid->bssid_set &&
1730 os_memcmp(ssid->bssid, bss->bssid, ETH_ALEN) == 0) {
1731 /* allow wildcard SSID due to hardcoded BSSID match */
1764 struct wpa_bss *selected, struct wpa_ssid *ssid)
1771 if (!eap_is_wps_pbc_enrollee(&ssid->eap))
1857 struct wpa_ssid *ssid;
1859 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
1860 if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && !ssid->disabled)
1966 static int wpas_wps_network_to_cred(struct wpa_ssid *ssid,
1970 if (ssid->ssid_len > SSID_MAX_LEN)
1972 os_memcpy(cred->ssid, ssid->ssid, ssid->ssid_len);
1973 cred->ssid_len = ssid->ssid_len;
1974 if (ssid->key_mgmt & WPA_KEY_MGMT_PSK) {
1975 cred->auth_type = (ssid->proto & WPA_PROTO_RSN) ?
1977 if (ssid->pairwise_cipher & WPA_CIPHER_CCMP)
1981 if (ssid->passphrase) {
1982 cred->key_len = os_strlen(ssid->passphrase);
1985 os_memcpy(cred->key, ssid->passphrase, cred->key_len);
1986 } else if (ssid->psk_set) {
1988 os_memcpy(cred->key, ssid->psk, 32);
2005 struct wpa_ssid *ssid;
2015 ssid = wpa_config_get_network(wpa_s->conf, id);
2016 if (ssid == NULL || ssid->ssid == NULL)
2019 if (wpas_wps_network_to_cred(ssid, &cred) < 0)
2047 if ((len & 1) || len > 2 * sizeof(cred.ssid) ||
2048 hexstr2bin(settings->ssid_hex, cred.ssid, len / 2))
2201 struct wpa_ssid *ssid)
2206 if (wpas_wps_network_to_cred(ssid, &cred) < 0)
2232 struct wpa_ssid *ssid;
2238 ssid = wpa_config_get_network(wpa_s->conf, id);
2239 if (ssid == NULL)
2241 return wpas_wps_network_config_token(wpa_s, ndef, ssid);
2272 const u8 *ssid, size_t ssid_len, int freq)
2327 ssid, ssid_len, freq);
2608 if (attr.ssid == NULL) {
2609 wpa_printf(MSG_DEBUG, "WPS: No SSID included in Wi-Fi Handover "
2615 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", attr.ssid, attr.ssid_len);
2669 attr.ssid, attr.ssid_len, freq);