Lines Matching refs:ssid
40 int (*parser)(const struct parse_data *data, struct wpa_ssid *ssid,
46 char * (*writer)(const struct parse_data *data, struct wpa_ssid *ssid);
63 struct wpa_ssid *ssid,
110 dst = (char **) (((u8 *) ssid) + (long) data->param1);
111 dst_len = (size_t *) (((u8 *) ssid) + (long) data->param2);
179 struct wpa_ssid *ssid)
184 src = (char **) (((u8 *) ssid) + (long) data->param1);
189 len = *((size_t *) (((u8 *) ssid) + (long) data->param2));
199 struct wpa_ssid *ssid,
205 dst = (int *) (((u8 *) ssid) + (long) data->param1);
240 struct wpa_ssid *ssid)
245 src = (int *) (((u8 *) ssid) + (long) data->param1);
355 struct wpa_ssid *ssid, int line,
360 ssid->bssid_set = 0;
364 if (hwaddr_aton(value, ssid->bssid)) {
369 ssid->bssid_set = 1;
370 wpa_hexdump(MSG_MSGDUMP, "BSSID", ssid->bssid, ETH_ALEN);
377 struct wpa_ssid *ssid)
382 if (!ssid->bssid_set)
388 res = os_snprintf(value, 20, MACSTR, MAC2STR(ssid->bssid));
400 struct wpa_ssid *ssid, int line,
404 &ssid->bssid_blacklist,
405 &ssid->num_bssid_blacklist,
412 struct wpa_ssid *ssid)
414 return wpa_config_write_addr_list(data, ssid->bssid_blacklist,
415 ssid->num_bssid_blacklist,
422 struct wpa_ssid *ssid, int line,
426 &ssid->bssid_whitelist,
427 &ssid->num_bssid_whitelist,
434 struct wpa_ssid *ssid)
436 return wpa_config_write_addr_list(data, ssid->bssid_whitelist,
437 ssid->num_bssid_whitelist,
444 struct wpa_ssid *ssid, int line,
449 str_clear_free(ssid->passphrase);
450 ssid->passphrase = NULL;
451 ssid->psk_set = 0;
452 os_free(ssid->ext_psk);
453 ssid->ext_psk = os_strdup(value + 4);
454 if (ssid->ext_psk == NULL)
457 ssid->ext_psk);
481 if (ssid->passphrase && os_strlen(ssid->passphrase) == len &&
482 os_memcmp(ssid->passphrase, value, len) == 0) {
486 ssid->psk_set = 0;
487 str_clear_free(ssid->passphrase);
488 ssid->passphrase = dup_binstr(value, len);
489 if (ssid->passphrase == NULL)
499 if (hexstr2bin(value, ssid->psk, PMK_LEN) ||
506 str_clear_free(ssid->passphrase);
507 ssid->passphrase = NULL;
509 ssid->psk_set = 1;
510 wpa_hexdump_key(MSG_MSGDUMP, "PSK", ssid->psk, PMK_LEN);
517 struct wpa_ssid *ssid)
520 if (ssid->ext_psk) {
521 size_t len = 4 + os_strlen(ssid->ext_psk) + 1;
527 res = os_snprintf(buf, len, "ext:%s", ssid->ext_psk);
536 if (ssid->passphrase)
538 (const u8 *) ssid->passphrase,
539 os_strlen(ssid->passphrase));
541 if (ssid->psk_set)
542 return wpa_config_write_string_hex(ssid->psk, PMK_LEN);
550 struct wpa_ssid *ssid, int line,
596 if (!errors && ssid->proto == val)
599 ssid->proto = val;
606 struct wpa_ssid *ssid)
616 if (ssid->proto & WPA_PROTO_WPA) {
624 if (ssid->proto & WPA_PROTO_RSN) {
632 if (ssid->proto & WPA_PROTO_OSEN) {
651 struct wpa_ssid *ssid, int line,
734 if (!errors && ssid->key_mgmt == val)
737 ssid->key_mgmt = val;
744 struct wpa_ssid *ssid)
754 if (ssid->key_mgmt & WPA_KEY_MGMT_PSK) {
764 if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X) {
774 if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
784 if (ssid->key_mgmt & WPA_KEY_MGMT_NONE) {
794 if (ssid->key_mgmt & WPA_KEY_MGMT_WPA_NONE) {
805 if (ssid->key_mgmt & WPA_KEY_MGMT_FT_PSK) {
815 if (ssid->key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X) {
827 if (ssid->key_mgmt & WPA_KEY_MGMT_PSK_SHA256) {
837 if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256) {
849 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
861 if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
871 if (ssid->key_mgmt & WPA_KEY_MGMT_FT_SAE) {
883 if (ssid->key_mgmt & WPA_KEY_MGMT_OSEN) {
895 if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B) {
907 if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B_192) {
971 struct wpa_ssid *ssid, int line,
984 if (ssid->pairwise_cipher == val)
987 ssid->pairwise_cipher = val;
994 struct wpa_ssid *ssid)
996 return wpa_config_write_cipher(ssid->pairwise_cipher);
1002 struct wpa_ssid *ssid, int line,
1022 if (ssid->group_cipher == val)
1025 ssid->group_cipher = val;
1032 struct wpa_ssid *ssid)
1034 return wpa_config_write_cipher(ssid->group_cipher);
1040 struct wpa_ssid *ssid, int line,
1085 if (!errors && ssid->auth_alg == val)
1088 ssid->auth_alg = val;
1095 struct wpa_ssid *ssid)
1105 if (ssid->auth_alg & WPA_AUTH_ALG_OPEN) {
1115 if (ssid->auth_alg & WPA_AUTH_ALG_SHARED) {
1125 if (ssid->auth_alg & WPA_AUTH_ALG_LEAP) {
1187 struct wpa_ssid *ssid, int line,
1199 os_free(ssid->scan_freq);
1200 ssid->scan_freq = freqs;
1207 struct wpa_ssid *ssid, int line,
1219 os_free(ssid->freq_list);
1220 ssid->freq_list = freqs;
1261 struct wpa_ssid *ssid)
1263 return wpa_config_write_freqs(data, ssid->scan_freq);
1268 struct wpa_ssid *ssid)
1270 return wpa_config_write_freqs(data, ssid->freq_list);
1277 struct wpa_ssid *ssid, int line,
1321 ssid->leap++;
1323 ssid->non_leap++;
1341 if (!errors && ssid->eap.eap_methods) {
1345 prev_m = ssid->eap.eap_methods;
1369 os_free(ssid->eap.eap_methods);
1370 ssid->eap.eap_methods = methods;
1377 struct wpa_ssid *ssid)
1381 const struct eap_method_type *eap_methods = ssid->eap.eap_methods;
1413 struct wpa_ssid *ssid, int line,
1419 if (!ssid->eap.password)
1422 bin_clear_free(ssid->eap.password, ssid->eap.password_len);
1423 ssid->eap.password = NULL;
1424 ssid->eap.password_len = 0;
1433 bin_clear_free(ssid->eap.password, ssid->eap.password_len);
1434 ssid->eap.password = (u8 *) name;
1435 ssid->eap.password_len = os_strlen(name);
1436 ssid->eap.flags &= ~EAP_CONFIG_FLAGS_PASSWORD_NTHASH;
1437 ssid->eap.flags |= EAP_CONFIG_FLAGS_EXT_PASSWORD;
1455 bin_clear_free(ssid->eap.password, ssid->eap.password_len);
1456 ssid->eap.password = (u8 *) tmp;
1457 ssid->eap.password_len = res_len;
1458 ssid->eap.flags &= ~EAP_CONFIG_FLAGS_PASSWORD_NTHASH;
1459 ssid->eap.flags &= ~EAP_CONFIG_FLAGS_EXT_PASSWORD;
1484 if (ssid->eap.password && ssid->eap.password_len == 16 &&
1485 os_memcmp(ssid->eap.password, hash, 16) == 0 &&
1486 (ssid->eap.flags & EAP_CONFIG_FLAGS_PASSWORD_NTHASH)) {
1490 bin_clear_free(ssid->eap.password, ssid->eap.password_len);
1491 ssid->eap.password = hash;
1492 ssid->eap.password_len = 16;
1493 ssid->eap.flags |= EAP_CONFIG_FLAGS_PASSWORD_NTHASH;
1494 ssid->eap.flags &= ~EAP_CONFIG_FLAGS_EXT_PASSWORD;
1502 struct wpa_ssid *ssid)
1506 if (ssid->eap.password == NULL)
1510 if (ssid->eap.flags & EAP_CONFIG_FLAGS_EXT_PASSWORD) {
1511 buf = os_zalloc(4 + ssid->eap.password_len + 1);
1515 os_memcpy(buf + 4, ssid->eap.password, ssid->eap.password_len);
1520 if (!(ssid->eap.flags & EAP_CONFIG_FLAGS_PASSWORD_NTHASH)) {
1522 ssid->eap.password, ssid->eap.password_len);
1530 wpa_snprintf_hex(buf + 5, 32 + 1, ssid->eap.password, 16);
1571 struct wpa_ssid *ssid, int line,
1574 return wpa_config_parse_wep_key(ssid->wep_key[0],
1575 &ssid->wep_key_len[0], line,
1581 struct wpa_ssid *ssid, int line,
1584 return wpa_config_parse_wep_key(ssid->wep_key[1],
1585 &ssid->wep_key_len[1], line,
1591 struct wpa_ssid *ssid, int line,
1594 return wpa_config_parse_wep_key(ssid->wep_key[2],
1595 &ssid->wep_key_len[2], line,
1601 struct wpa_ssid *ssid, int line,
1604 return wpa_config_parse_wep_key(ssid->wep_key[3],
1605 &ssid->wep_key_len[3], line,
1611 static char * wpa_config_write_wep_key(struct wpa_ssid *ssid, int idx)
1613 if (ssid->wep_key_len[idx] == 0)
1615 return wpa_config_write_string(ssid->wep_key[idx],
1616 ssid->wep_key_len[idx]);
1621 struct wpa_ssid *ssid)
1623 return wpa_config_write_wep_key(ssid, 0);
1628 struct wpa_ssid *ssid)
1630 return wpa_config_write_wep_key(ssid, 1);
1635 struct wpa_ssid *ssid)
1637 return wpa_config_write_wep_key(ssid, 2);
1642 struct wpa_ssid *ssid)
1644 return wpa_config_write_wep_key(ssid, 3);
1652 struct wpa_ssid *ssid, int line,
1657 os_memset(ssid->go_p2p_dev_addr, 0, ETH_ALEN);
1661 if (hwaddr_aton(value, ssid->go_p2p_dev_addr)) {
1666 ssid->bssid_set = 1;
1668 MAC2STR(ssid->go_p2p_dev_addr));
1675 struct wpa_ssid *ssid)
1680 if (is_zero_ether_addr(ssid->go_p2p_dev_addr))
1686 res = os_snprintf(value, 20, MACSTR, MAC2STR(ssid->go_p2p_dev_addr));
1698 struct wpa_ssid *ssid, int line,
1702 &ssid->p2p_client_list,
1703 &ssid->num_p2p_clients,
1710 struct wpa_ssid *ssid)
1712 return wpa_config_write_addr_list(data, ssid->p2p_client_list,
1713 ssid->num_p2p_clients,
1720 struct wpa_ssid *ssid, int line,
1758 dl_list_add(&ssid->psk_list, &p->list);
1766 struct wpa_ssid *ssid)
1778 struct wpa_ssid *ssid, int line,
1793 os_free(ssid->mesh_basic_rates);
1794 ssid->mesh_basic_rates = rates;
1803 struct wpa_ssid *ssid)
1805 return wpa_config_write_freqs(data, ssid->mesh_basic_rates);
1901 { STR_RANGE(ssid, 0, SSID_MAX_LEN) },
2076 * @ssid: Pointer to the network configuration to be added to the list
2085 struct wpa_ssid *ssid)
2096 if (prev->priority == ssid->priority) {
2099 prev->pnext = ssid;
2111 if (nlist[prio]->priority < ssid->priority) {
2119 nlist[prio] = ssid;
2138 struct wpa_ssid *ssid;
2145 ssid = config->ssid;
2146 while (ssid) {
2147 ssid->pnext = NULL;
2148 if (wpa_config_add_prio_network(config, ssid) < 0)
2150 ssid = ssid->next;
2208 * wpa_config_free_ssid - Free network/ssid configuration data
2209 * @ssid: Configuration data for the network
2214 void wpa_config_free_ssid(struct wpa_ssid *ssid)
2218 os_free(ssid->ssid);
2219 str_clear_free(ssid->passphrase);
2220 os_free(ssid->ext_psk);
2222 eap_peer_config_free(&ssid->eap);
2224 os_free(ssid->id_str);
2225 os_free(ssid->scan_freq);
2226 os_free(ssid->freq_list);
2227 os_free(ssid->bgscan);
2228 os_free(ssid->p2p_client_list);
2229 os_free(ssid->bssid_blacklist);
2230 os_free(ssid->bssid_whitelist);
2232 os_free(ssid->ht_mcs);
2235 os_free(ssid->mesh_basic_rates);
2237 while ((psk = dl_list_first(&ssid->psk_list, struct psk_list_entry,
2242 bin_clear_free(ssid, sizeof(*ssid));
2302 struct wpa_ssid *ssid, *prev = NULL;
2306 ssid = config->ssid;
2307 while (ssid) {
2308 prev = ssid;
2309 ssid = ssid->next;
2379 struct wpa_ssid *ssid, *next;
2381 ssid = config->ssid;
2382 while (ssid) {
2383 next = ssid->next;
2384 func(arg, ssid);
2385 ssid = next;
2398 struct wpa_ssid *ssid;
2400 ssid = config->ssid;
2401 while (ssid) {
2402 if (id == ssid->id)
2404 ssid = ssid->next;
2407 return ssid;
2419 struct wpa_ssid *ssid, *last = NULL;
2422 ssid = config->ssid;
2423 while (ssid) {
2424 if (ssid->id > id)
2425 id = ssid->id;
2426 last = ssid;
2427 ssid = ssid->next;
2431 ssid = os_zalloc(sizeof(*ssid));
2432 if (ssid == NULL)
2434 ssid->id = id;
2435 dl_list_init(&ssid->psk_list);
2437 last->next = ssid;
2439 config->ssid = ssid;
2443 return ssid;
2455 struct wpa_ssid *ssid, *prev = NULL;
2457 ssid = config->ssid;
2458 while (ssid) {
2459 if (id == ssid->id)
2461 prev = ssid;
2462 ssid = ssid->next;
2465 if (ssid == NULL)
2469 prev->next = ssid->next;
2471 config->ssid = ssid->next;
2474 wpa_config_free_ssid(ssid);
2481 * @ssid: Pointer to network configuration data
2483 void wpa_config_set_network_defaults(struct wpa_ssid *ssid)
2485 ssid->proto = DEFAULT_PROTO;
2486 ssid->pairwise_cipher = DEFAULT_PAIRWISE;
2487 ssid->group_cipher = DEFAULT_GROUP;
2488 ssid->key_mgmt = DEFAULT_KEY_MGMT;
2489 ssid->bg_scan_period = DEFAULT_BG_SCAN_PERIOD;
2491 ssid->eapol_flags = DEFAULT_EAPOL_FLAGS;
2492 ssid->eap_workaround = DEFAULT_EAP_WORKAROUND;
2493 ssid->eap.fragment_size = DEFAULT_FRAGMENT_SIZE;
2494 ssid->eap.sim_num = DEFAULT_USER_SELECTED_SIM;
2497 ssid->dot11MeshMaxRetries = DEFAULT_MESH_MAX_RETRIES;
2498 ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT;
2499 ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT;
2500 ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT;
2503 ssid->disable_ht = DEFAULT_DISABLE_HT;
2504 ssid->disable_ht40 = DEFAULT_DISABLE_HT40;
2505 ssid->disable_sgi = DEFAULT_DISABLE_SGI;
2506 ssid->disable_ldpc = DEFAULT_DISABLE_LDPC;
2507 ssid->disable_max_amsdu = DEFAULT_DISABLE_MAX_AMSDU;
2508 ssid->ampdu_factor = DEFAULT_AMPDU_FACTOR;
2509 ssid->ampdu_density = DEFAULT_AMPDU_DENSITY;
2512 ssid->vht_rx_mcs_nss_1 = -1;
2513 ssid->vht_rx_mcs_nss_2 = -1;
2514 ssid->vht_rx_mcs_nss_3 = -1;
2515 ssid->vht_rx_mcs_nss_4 = -1;
2516 ssid->vht_rx_mcs_nss_5 = -1;
2517 ssid->vht_rx_mcs_nss_6 = -1;
2518 ssid->vht_rx_mcs_nss_7 = -1;
2519 ssid->vht_rx_mcs_nss_8 = -1;
2520 ssid->vht_tx_mcs_nss_1 = -1;
2521 ssid->vht_tx_mcs_nss_2 = -1;
2522 ssid->vht_tx_mcs_nss_3 = -1;
2523 ssid->vht_tx_mcs_nss_4 = -1;
2524 ssid->vht_tx_mcs_nss_5 = -1;
2525 ssid->vht_tx_mcs_nss_6 = -1;
2526 ssid->vht_tx_mcs_nss_7 = -1;
2527 ssid->vht_tx_mcs_nss_8 = -1;
2529 ssid->proactive_key_caching = -1;
2531 ssid->ieee80211w = MGMT_FRAME_PROTECTION_DEFAULT;
2533 ssid->mac_addr = -1;
2539 * @ssid: Pointer to network configuration data
2540 * @var: Variable name, e.g., "ssid"
2551 int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
2557 if (ssid == NULL || var == NULL || value == NULL)
2565 ret = field->parser(field, ssid, line, value);
2587 int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var,
2602 ret = wpa_config_set(ssid, var, buf, 0);
2610 * @ssid: Pointer to network configuration data
2620 char ** wpa_config_get_all(struct wpa_ssid *ssid, int get_keys)
2631 get_keys = get_keys && ssid->export_keys;
2642 value = field->writer(field, ssid);
2677 * @ssid: Pointer to network configuration data
2678 * @var: Variable name, e.g., "ssid"
2687 char * wpa_config_get(struct wpa_ssid *ssid, const char *var)
2691 if (ssid == NULL || var == NULL)
2697 char *ret = field->writer(field, ssid);
2716 * @ssid: Pointer to network configuration data
2717 * @var: Variable name, e.g., "ssid"
2730 char * wpa_config_get_no_key(struct wpa_ssid *ssid, const char *var)
2734 if (ssid == NULL || var == NULL)
2740 char *res = field->writer(field, ssid);
2763 * wpa_config_update_psk - Update WPA PSK based on passphrase and SSID
2764 * @ssid: Pointer to network configuration data
2766 * This function must be called to update WPA PSK when either SSID or the
2769 void wpa_config_update_psk(struct wpa_ssid *ssid)
2772 pbkdf2_sha1(ssid->passphrase, ssid->ssid, ssid->ssid_len, 4096,
2773 ssid->psk, PMK_LEN);
2775 ssid->psk, PMK_LEN);
2776 ssid->psk_set = 1;
3084 os_memcpy(e->ssid, val, len);
3395 wpa_ssid_txt(e->ssid, e->ssid_len));
3665 struct wpa_ssid *ssid;
3668 ssid = config->pssid[prio];
3670 ssid->priority);
3671 while (ssid) {
3672 wpa_printf(MSG_DEBUG, " id=%d ssid='%s'",
3673 ssid->id,
3674 wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
3675 ssid = ssid->pnext;