]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/ap_config.c
SAE: Add support for using the optional Password Identifier
[thirdparty/hostap.git] / src / ap / ap_config.c
CommitLineData
6fc6879b 1/*
41d719d6 2 * hostapd / Configuration helper functions
08081ad8 3 * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
6fc6879b 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
6fc6879b
JM
7 */
8
6226e38d 9#include "utils/includes.h"
6fc6879b 10
6226e38d 11#include "utils/common.h"
03da66bd 12#include "crypto/sha1.h"
d501c27c 13#include "crypto/tls.h"
6fc6879b 14#include "radius/radius_client.h"
df84268a 15#include "common/ieee802_11_defs.h"
41d719d6 16#include "common/eapol_common.h"
91d91abf 17#include "common/dhcp.h"
03da66bd
JM
18#include "eap_common/eap_wsc_common.h"
19#include "eap_server/eap.h"
6226e38d 20#include "wpa_auth.h"
97234b50 21#include "sta_info.h"
6226e38d 22#include "ap_config.h"
6fc6879b
JM
23
24
6fc6879b
JM
25static void hostapd_config_free_vlan(struct hostapd_bss_config *bss)
26{
27 struct hostapd_vlan *vlan, *prev;
28
29 vlan = bss->vlan;
30 prev = NULL;
31 while (vlan) {
32 prev = vlan;
33 vlan = vlan->next;
34 os_free(prev);
35 }
36
37 bss->vlan = NULL;
38}
39
40
6f234c1e
JM
41#ifndef DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES
42#define DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES 0
43#endif /* DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES */
44
41d719d6 45void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
6fc6879b 46{
695dbbea
JM
47 dl_list_init(&bss->anqp_elem);
48
6fc6879b
JM
49 bss->logger_syslog_level = HOSTAPD_LEVEL_INFO;
50 bss->logger_stdout_level = HOSTAPD_LEVEL_INFO;
51 bss->logger_syslog = (unsigned int) -1;
52 bss->logger_stdout = (unsigned int) -1;
53
54 bss->auth_algs = WPA_AUTH_ALG_OPEN | WPA_AUTH_ALG_SHARED;
55
56 bss->wep_rekeying_period = 300;
57 /* use key0 in individual key and key1 in broadcast key */
58 bss->broadcast_key_idx_min = 1;
59 bss->broadcast_key_idx_max = 2;
60 bss->eap_reauth_period = 3600;
61
62 bss->wpa_group_rekey = 600;
63 bss->wpa_gmk_rekey = 86400;
41f140d3
GK
64 bss->wpa_group_update_count = 4;
65 bss->wpa_pairwise_update_count = 4;
6f234c1e
JM
66 bss->wpa_disable_eapol_key_retries =
67 DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES;
6fc6879b
JM
68 bss->wpa_key_mgmt = WPA_KEY_MGMT_PSK;
69 bss->wpa_pairwise = WPA_CIPHER_TKIP;
70 bss->wpa_group = WPA_CIPHER_TKIP;
71 bss->rsn_pairwise = 0;
72
73 bss->max_num_sta = MAX_STA_COUNT;
74
75 bss->dtim_period = 2;
76
77 bss->radius_server_auth_port = 1812;
7b0f5500 78 bss->eap_sim_db_timeout = 1;
6fc6879b
JM
79 bss->ap_max_inactivity = AP_MAX_INACTIVITY;
80 bss->eapol_version = EAPOL_VERSION;
b0194fe0
JM
81
82 bss->max_listen_interval = 65535;
5d22a1d5 83
df684d82
DH
84 bss->pwd_group = 19; /* ECC: GF(p=256) */
85
5d22a1d5 86#ifdef CONFIG_IEEE80211W
45c94154
JM
87 bss->assoc_sa_query_max_timeout = 1000;
88 bss->assoc_sa_query_retry_timeout = 201;
8dd9f9cd 89 bss->group_mgmt_cipher = WPA_CIPHER_AES_128_CMAC;
5d22a1d5 90#endif /* CONFIG_IEEE80211W */
1e5839e0 91#ifdef EAP_SERVER_FAST
378eae5e
JM
92 /* both anonymous and authenticated provisioning */
93 bss->eap_fast_prov = 3;
a11c90a6
JM
94 bss->pac_key_lifetime = 7 * 24 * 60 * 60;
95 bss->pac_key_refresh_time = 1 * 24 * 60 * 60;
1e5839e0 96#endif /* EAP_SERVER_FAST */
d2da2249
JB
97
98 /* Set to -1 as defaults depends on HT in setup */
99 bss->wmm_enabled = -1;
d7956add 100
4ec1fd8e 101#ifdef CONFIG_IEEE80211R_AP
d7956add 102 bss->ft_over_ds = 1;
3a46cf93
MB
103 bss->rkh_pos_timeout = 86400;
104 bss->rkh_neg_timeout = 60;
105 bss->rkh_pull_timeout = 1000;
106 bss->rkh_pull_retries = 4;
83fe4bd3 107 bss->r0_key_lifetime = 1209600;
4ec1fd8e 108#endif /* CONFIG_IEEE80211R_AP */
bde7ba6c
JM
109
110 bss->radius_das_time_window = 300;
d136c376
JM
111
112 bss->sae_anti_clogging_threshold = 5;
d8b841eb 113 bss->sae_sync = 5;
26bf70e3 114
2977f519
JM
115 bss->gas_frag_limit = 1400;
116
26bf70e3
JM
117#ifdef CONFIG_FILS
118 dl_list_init(&bss->fils_realms);
91d91abf
JM
119 bss->fils_hlp_wait_time = 30;
120 bss->dhcp_server_port = DHCP_SERVER_PORT;
121 bss->dhcp_relay_port = DHCP_SERVER_PORT;
26bf70e3 122#endif /* CONFIG_FILS */
57a2aaca
JM
123
124 bss->broadcast_deauth = 1;
941caed9
JM
125
126#ifdef CONFIG_MBO
127 bss->mbo_cell_data_conn_pref = -1;
128#endif /* CONFIG_MBO */
d501c27c
JM
129
130 /* Disable TLS v1.3 by default for now to avoid interoperability issue.
131 * This can be enabled by default once the implementation has been fully
132 * completed and tested with other implementations. */
133 bss->tls_flags = TLS_CONN_DISABLE_TLSv1_3;
6fc6879b
JM
134}
135
136
89111f3b 137struct hostapd_config * hostapd_config_defaults(void)
6fc6879b 138{
d2da2249
JB
139#define ecw2cw(ecw) ((1 << (ecw)) - 1)
140
6fc6879b
JM
141 struct hostapd_config *conf;
142 struct hostapd_bss_config *bss;
594cf8b9 143 const int aCWmin = 4, aCWmax = 10;
3ae0800c 144 const struct hostapd_wmm_ac_params ac_bk =
6fc6879b 145 { aCWmin, aCWmax, 7, 0, 0 }; /* background traffic */
3ae0800c 146 const struct hostapd_wmm_ac_params ac_be =
6fc6879b 147 { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
3ae0800c 148 const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
f4e3860f 149 { aCWmin - 1, aCWmin, 2, 3008 / 32, 0 };
3ae0800c 150 const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
f4e3860f 151 { aCWmin - 2, aCWmin - 1, 2, 1504 / 32, 0 };
d2da2249
JB
152 const struct hostapd_tx_queue_params txq_bk =
153 { 7, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
154 const struct hostapd_tx_queue_params txq_be =
155 { 3, ecw2cw(aCWmin), 4 * (ecw2cw(aCWmin) + 1) - 1, 0};
156 const struct hostapd_tx_queue_params txq_vi =
157 { 1, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30};
158 const struct hostapd_tx_queue_params txq_vo =
159 { 1, (ecw2cw(aCWmin) + 1) / 4 - 1,
160 (ecw2cw(aCWmin) + 1) / 2 - 1, 15};
161
162#undef ecw2cw
6fc6879b
JM
163
164 conf = os_zalloc(sizeof(*conf));
165 bss = os_zalloc(sizeof(*bss));
166 if (conf == NULL || bss == NULL) {
10656fc2
JM
167 wpa_printf(MSG_ERROR, "Failed to allocate memory for "
168 "configuration data.");
6fc6879b
JM
169 os_free(conf);
170 os_free(bss);
171 return NULL;
172 }
ebd79f07
JM
173 conf->bss = os_calloc(1, sizeof(struct hostapd_bss_config *));
174 if (conf->bss == NULL) {
175 os_free(conf);
176 os_free(bss);
177 return NULL;
178 }
179 conf->bss[0] = bss;
6fc6879b 180
6fc6879b
JM
181 bss->radius = os_zalloc(sizeof(*bss->radius));
182 if (bss->radius == NULL) {
04c366cb 183 os_free(conf->bss);
6fc6879b
JM
184 os_free(conf);
185 os_free(bss);
186 return NULL;
187 }
188
189 hostapd_config_defaults_bss(bss);
190
191 conf->num_bss = 1;
6fc6879b
JM
192
193 conf->beacon_int = 100;
194 conf->rts_threshold = -1; /* use driver default: 2347 */
195 conf->fragm_threshold = -1; /* user driver default: 2346 */
196 conf->send_probe_response = 1;
e0392f82
S
197 /* Set to invalid value means do not add Power Constraint IE */
198 conf->local_pwr_constraint = -1;
6fc6879b 199
3ae0800c
JM
200 conf->wmm_ac_params[0] = ac_be;
201 conf->wmm_ac_params[1] = ac_bk;
202 conf->wmm_ac_params[2] = ac_vi;
203 conf->wmm_ac_params[3] = ac_vo;
6fc6879b 204
d2da2249
JB
205 conf->tx_queue[0] = txq_vo;
206 conf->tx_queue[1] = txq_vi;
207 conf->tx_queue[2] = txq_be;
208 conf->tx_queue[3] = txq_bk;
209
fc14f567 210 conf->ht_capab = HT_CAP_INFO_SMPS_DISABLED;
de9289c8 211
f1b44874
SE
212 conf->ap_table_max_size = 255;
213 conf->ap_table_expiration_time = 60;
a65a9b8d 214 conf->track_sta_max_age = 180;
f1b44874 215
c2aff6b1 216#ifdef CONFIG_TESTING_OPTIONS
06df2aa6
JM
217 conf->ignore_probe_probability = 0.0;
218 conf->ignore_auth_probability = 0.0;
219 conf->ignore_assoc_probability = 0.0;
220 conf->ignore_reassoc_probability = 0.0;
221 conf->corrupt_gtk_rekey_mic_probability = 0.0;
2b6e1216 222 conf->ecsa_ie_only = 0;
c2aff6b1
JB
223#endif /* CONFIG_TESTING_OPTIONS */
224
857d9422
MM
225 conf->acs = 0;
226 conf->acs_ch_list.num = 0;
50f4f2a0
MK
227#ifdef CONFIG_ACS
228 conf->acs_num_scans = 5;
229#endif /* CONFIG_ACS */
230
ff936bc7
JM
231 /* The third octet of the country string uses an ASCII space character
232 * by default to indicate that the regulations encompass all
233 * environments for the current frequency band in the country. */
234 conf->country[2] = ' ';
235
6fc6879b
JM
236 return conf;
237}
238
239
240int hostapd_mac_comp(const void *a, const void *b)
241{
242 return os_memcmp(a, b, sizeof(macaddr));
243}
244
245
6fc6879b
JM
246static int hostapd_config_read_wpa_psk(const char *fname,
247 struct hostapd_ssid *ssid)
248{
249 FILE *f;
250 char buf[128], *pos;
251 int line = 0, ret = 0, len, ok;
252 u8 addr[ETH_ALEN];
253 struct hostapd_wpa_psk *psk;
254
255 if (!fname)
256 return 0;
257
258 f = fopen(fname, "r");
259 if (!f) {
10656fc2 260 wpa_printf(MSG_ERROR, "WPA PSK file '%s' not found.", fname);
6fc6879b
JM
261 return -1;
262 }
263
264 while (fgets(buf, sizeof(buf), f)) {
265 line++;
266
267 if (buf[0] == '#')
268 continue;
269 pos = buf;
270 while (*pos != '\0') {
271 if (*pos == '\n') {
272 *pos = '\0';
273 break;
274 }
275 pos++;
276 }
277 if (buf[0] == '\0')
278 continue;
279
280 if (hwaddr_aton(buf, addr)) {
10656fc2
JM
281 wpa_printf(MSG_ERROR, "Invalid MAC address '%s' on "
282 "line %d in '%s'", buf, line, fname);
6fc6879b
JM
283 ret = -1;
284 break;
285 }
286
287 psk = os_zalloc(sizeof(*psk));
288 if (psk == NULL) {
10656fc2 289 wpa_printf(MSG_ERROR, "WPA PSK allocation failed");
6fc6879b
JM
290 ret = -1;
291 break;
292 }
a8e16edc 293 if (is_zero_ether_addr(addr))
6fc6879b
JM
294 psk->group = 1;
295 else
296 os_memcpy(psk->addr, addr, ETH_ALEN);
297
298 pos = buf + 17;
5306f43f 299 if (*pos == '\0') {
10656fc2
JM
300 wpa_printf(MSG_ERROR, "No PSK on line %d in '%s'",
301 line, fname);
6fc6879b
JM
302 os_free(psk);
303 ret = -1;
304 break;
305 }
306 pos++;
307
308 ok = 0;
309 len = os_strlen(pos);
310 if (len == 64 && hexstr2bin(pos, psk->psk, PMK_LEN) == 0)
311 ok = 1;
312 else if (len >= 8 && len < 64) {
313 pbkdf2_sha1(pos, ssid->ssid, ssid->ssid_len,
314 4096, psk->psk, PMK_LEN);
315 ok = 1;
316 }
317 if (!ok) {
10656fc2
JM
318 wpa_printf(MSG_ERROR, "Invalid PSK '%s' on line %d in "
319 "'%s'", pos, line, fname);
6fc6879b
JM
320 os_free(psk);
321 ret = -1;
322 break;
323 }
324
325 psk->next = ssid->wpa_psk;
326 ssid->wpa_psk = psk;
327 }
328
329 fclose(f);
330
331 return ret;
332}
333
334
0ae687bd
JM
335static int hostapd_derive_psk(struct hostapd_ssid *ssid)
336{
337 ssid->wpa_psk = os_zalloc(sizeof(struct hostapd_wpa_psk));
338 if (ssid->wpa_psk == NULL) {
339 wpa_printf(MSG_ERROR, "Unable to alloc space for PSK");
340 return -1;
341 }
342 wpa_hexdump_ascii(MSG_DEBUG, "SSID",
343 (u8 *) ssid->ssid, ssid->ssid_len);
344 wpa_hexdump_ascii_key(MSG_DEBUG, "PSK (ASCII passphrase)",
345 (u8 *) ssid->wpa_passphrase,
346 os_strlen(ssid->wpa_passphrase));
347 pbkdf2_sha1(ssid->wpa_passphrase,
348 ssid->ssid, ssid->ssid_len,
349 4096, ssid->wpa_psk->psk, PMK_LEN);
350 wpa_hexdump_key(MSG_DEBUG, "PSK (from passphrase)",
351 ssid->wpa_psk->psk, PMK_LEN);
352 return 0;
353}
354
355
6fc6879b
JM
356int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf)
357{
358 struct hostapd_ssid *ssid = &conf->ssid;
359
360 if (ssid->wpa_passphrase != NULL) {
361 if (ssid->wpa_psk != NULL) {
0ae687bd
JM
362 wpa_printf(MSG_DEBUG, "Using pre-configured WPA PSK "
363 "instead of passphrase");
364 } else {
365 wpa_printf(MSG_DEBUG, "Deriving WPA PSK based on "
366 "passphrase");
367 if (hostapd_derive_psk(ssid) < 0)
368 return -1;
6fc6879b 369 }
6fc6879b 370 ssid->wpa_psk->group = 1;
6fc6879b
JM
371 }
372
34e29dfd 373 return hostapd_config_read_wpa_psk(ssid->wpa_psk_file, &conf->ssid);
6fc6879b
JM
374}
375
376
6fc6879b
JM
377static void hostapd_config_free_radius(struct hostapd_radius_server *servers,
378 int num_servers)
379{
380 int i;
381
382 for (i = 0; i < num_servers; i++) {
383 os_free(servers[i].shared_secret);
384 }
385 os_free(servers);
386}
387
388
af35e7af
JM
389struct hostapd_radius_attr *
390hostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type)
391{
392 for (; attr; attr = attr->next) {
393 if (attr->type == type)
394 return attr;
395 }
396 return NULL;
397}
398
399
400static void hostapd_config_free_radius_attr(struct hostapd_radius_attr *attr)
401{
402 struct hostapd_radius_attr *prev;
403
404 while (attr) {
405 prev = attr;
406 attr = attr->next;
407 wpabuf_free(prev->val);
408 os_free(prev);
409 }
410}
411
412
d0ee16ed 413void hostapd_config_free_eap_user(struct hostapd_eap_user *user)
6fc6879b 414{
d0ee16ed 415 hostapd_config_free_radius_attr(user->accept_attr);
6fc6879b 416 os_free(user->identity);
b7175b4d 417 bin_clear_free(user->password, user->password_len);
6fc6879b
JM
418 os_free(user);
419}
420
421
78022c83
JM
422void hostapd_config_free_eap_users(struct hostapd_eap_user *user)
423{
424 struct hostapd_eap_user *prev_user;
425
426 while (user) {
427 prev_user = user;
428 user = user->next;
429 hostapd_config_free_eap_user(prev_user);
430 }
431}
432
433
6fc6879b
JM
434static void hostapd_config_free_wep(struct hostapd_wep_keys *keys)
435{
436 int i;
437 for (i = 0; i < NUM_WEP_KEYS; i++) {
b7175b4d 438 bin_clear_free(keys->key[i], keys->len[i]);
6fc6879b
JM
439 keys->key[i] = NULL;
440 }
441}
442
443
891dfb33
ST
444void hostapd_config_clear_wpa_psk(struct hostapd_wpa_psk **l)
445{
446 struct hostapd_wpa_psk *psk, *tmp;
447
448 for (psk = *l; psk;) {
449 tmp = psk;
450 psk = psk->next;
451 bin_clear_free(tmp, sizeof(*tmp));
452 }
453 *l = NULL;
454}
455
456
695dbbea
JM
457static void hostapd_config_free_anqp_elem(struct hostapd_bss_config *conf)
458{
459 struct anqp_element *elem;
460
461 while ((elem = dl_list_first(&conf->anqp_elem, struct anqp_element,
462 list))) {
463 dl_list_del(&elem->list);
464 wpabuf_free(elem->payload);
465 os_free(elem);
466 }
467}
468
469
26bf70e3
JM
470static void hostapd_config_free_fils_realms(struct hostapd_bss_config *conf)
471{
472#ifdef CONFIG_FILS
473 struct fils_realm *realm;
474
475 while ((realm = dl_list_first(&conf->fils_realms, struct fils_realm,
476 list))) {
477 dl_list_del(&realm->list);
478 os_free(realm);
479 }
480#endif /* CONFIG_FILS */
481}
482
483
9be19d0b
JM
484static void hostapd_config_free_sae_passwords(struct hostapd_bss_config *conf)
485{
486 struct sae_password_entry *pw, *tmp;
487
488 pw = conf->sae_passwords;
489 conf->sae_passwords = NULL;
490 while (pw) {
491 tmp = pw;
492 pw = pw->next;
493 str_clear_free(tmp->password);
494 os_free(tmp->identifier);
495 os_free(tmp);
496 }
497}
498
499
55920658 500void hostapd_config_free_bss(struct hostapd_bss_config *conf)
6fc6879b 501{
6fc6879b
JM
502 if (conf == NULL)
503 return;
504
891dfb33 505 hostapd_config_clear_wpa_psk(&conf->ssid.wpa_psk);
6fc6879b 506
b7175b4d 507 str_clear_free(conf->ssid.wpa_passphrase);
6fc6879b 508 os_free(conf->ssid.wpa_psk_file);
43dd46b3 509 hostapd_config_free_wep(&conf->ssid.wep);
6fc6879b
JM
510#ifdef CONFIG_FULL_DYNAMIC_VLAN
511 os_free(conf->ssid.vlan_tagged_interface);
512#endif /* CONFIG_FULL_DYNAMIC_VLAN */
513
78022c83 514 hostapd_config_free_eap_users(conf->eap_user);
ee431d77 515 os_free(conf->eap_user_sqlite);
6fc6879b 516
6fc6879b 517 os_free(conf->eap_req_id_text);
2a5156a6 518 os_free(conf->erp_domain);
6fc6879b
JM
519 os_free(conf->accept_mac);
520 os_free(conf->deny_mac);
521 os_free(conf->nas_identifier);
5afaa067
JM
522 if (conf->radius) {
523 hostapd_config_free_radius(conf->radius->auth_servers,
524 conf->radius->num_auth_servers);
525 hostapd_config_free_radius(conf->radius->acct_servers,
526 conf->radius->num_acct_servers);
527 }
af35e7af
JM
528 hostapd_config_free_radius_attr(conf->radius_auth_req_attr);
529 hostapd_config_free_radius_attr(conf->radius_acct_req_attr);
6fc6879b
JM
530 os_free(conf->rsn_preauth_interfaces);
531 os_free(conf->ctrl_interface);
532 os_free(conf->ca_cert);
533 os_free(conf->server_cert);
534 os_free(conf->private_key);
535 os_free(conf->private_key_passwd);
080585c0 536 os_free(conf->ocsp_stapling_response);
5addb0df 537 os_free(conf->ocsp_stapling_response_multi);
6fc6879b 538 os_free(conf->dh_file);
f8995f8f 539 os_free(conf->openssl_ciphers);
6fc6879b
JM
540 os_free(conf->pac_opaque_encr_key);
541 os_free(conf->eap_fast_a_id);
2d867244 542 os_free(conf->eap_fast_a_id_info);
6fc6879b
JM
543 os_free(conf->eap_sim_db);
544 os_free(conf->radius_server_clients);
6fc6879b 545 os_free(conf->radius);
b031338c 546 os_free(conf->radius_das_shared_secret);
6fc6879b 547 hostapd_config_free_vlan(conf);
39b97072
JM
548 os_free(conf->time_zone);
549
4ec1fd8e 550#ifdef CONFIG_IEEE80211R_AP
6fc6879b
JM
551 {
552 struct ft_remote_r0kh *r0kh, *r0kh_prev;
553 struct ft_remote_r1kh *r1kh, *r1kh_prev;
554
555 r0kh = conf->r0kh_list;
556 conf->r0kh_list = NULL;
557 while (r0kh) {
558 r0kh_prev = r0kh;
559 r0kh = r0kh->next;
560 os_free(r0kh_prev);
561 }
562
563 r1kh = conf->r1kh_list;
564 conf->r1kh_list = NULL;
565 while (r1kh) {
566 r1kh_prev = r1kh;
567 r1kh = r1kh->next;
568 os_free(r1kh_prev);
569 }
570 }
4ec1fd8e 571#endif /* CONFIG_IEEE80211R_AP */
ad08c363
JM
572
573#ifdef CONFIG_WPS
574 os_free(conf->wps_pin_requests);
575 os_free(conf->device_name);
576 os_free(conf->manufacturer);
577 os_free(conf->model_name);
578 os_free(conf->model_number);
579 os_free(conf->serial_number);
ad08c363
JM
580 os_free(conf->config_methods);
581 os_free(conf->ap_pin);
62966253 582 os_free(conf->extra_cred);
4c29cae9 583 os_free(conf->ap_settings);
f620268f
JM
584 os_free(conf->upnp_iface);
585 os_free(conf->friendly_name);
586 os_free(conf->manufacturer_url);
587 os_free(conf->model_description);
588 os_free(conf->model_url);
589 os_free(conf->upc);
8509fb5c
JM
590 {
591 unsigned int i;
592
593 for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
594 wpabuf_free(conf->wps_vendor_ext[i]);
595 }
ffdaa05a
JM
596 wpabuf_free(conf->wps_nfc_dh_pubkey);
597 wpabuf_free(conf->wps_nfc_dh_privkey);
598 wpabuf_free(conf->wps_nfc_dev_pw);
ad08c363 599#endif /* CONFIG_WPS */
4b2a77ab
JM
600
601 os_free(conf->roaming_consortium);
648cc711 602 os_free(conf->venue_name);
7e1d3ee9 603 os_free(conf->venue_url);
8047b186 604 os_free(conf->nai_realm_data);
550a3958 605 os_free(conf->network_auth_type);
7515adb2 606 os_free(conf->anqp_3gpp_cell_net);
26fac8b6 607 os_free(conf->domain_name);
695dbbea 608 hostapd_config_free_anqp_elem(conf);
505a3694
JM
609
610#ifdef CONFIG_RADIUS_TEST
611 os_free(conf->dump_msk_file);
612#endif /* CONFIG_RADIUS_TEST */
df5934f1
JK
613
614#ifdef CONFIG_HS20
a9277e85 615 os_free(conf->hs20_oper_friendly_name);
4065a309 616 os_free(conf->hs20_wan_metrics);
5ccc54aa 617 os_free(conf->hs20_connection_capability);
df5934f1 618 os_free(conf->hs20_operating_class);
f7bd7a01 619 os_free(conf->hs20_icons);
ae6d15c7
JM
620 if (conf->hs20_osu_providers) {
621 size_t i;
622 for (i = 0; i < conf->hs20_osu_providers_count; i++) {
623 struct hs20_osu_provider *p;
624 size_t j;
625 p = &conf->hs20_osu_providers[i];
626 os_free(p->friendly_name);
627 os_free(p->server_uri);
628 os_free(p->method_list);
629 for (j = 0; j < p->icons_count; j++)
630 os_free(p->icons[j]);
631 os_free(p->icons);
632 os_free(p->osu_nai);
633 os_free(p->service_desc);
634 }
635 os_free(conf->hs20_osu_providers);
636 }
0e450db2
JM
637 if (conf->hs20_operator_icon) {
638 size_t i;
639
640 for (i = 0; i < conf->hs20_operator_icon_count; i++)
641 os_free(conf->hs20_operator_icon[i]);
642 os_free(conf->hs20_operator_icon);
643 }
8d2a9921 644 os_free(conf->subscr_remediation_url);
6cb8f4f3 645 os_free(conf->t_c_filename);
8760b984 646 os_free(conf->t_c_server_url);
df5934f1 647#endif /* CONFIG_HS20 */
b52f084c
JM
648
649 wpabuf_free(conf->vendor_elements);
a9112270 650 wpabuf_free(conf->assocresp_elements);
625f202a
JM
651
652 os_free(conf->sae_groups);
91cc34bf
JM
653#ifdef CONFIG_OWE
654 os_free(conf->owe_groups);
655#endif /* CONFIG_OWE */
67fe933d 656
88cb27c7
DS
657 os_free(conf->wowlan_triggers);
658
67fe933d 659 os_free(conf->server_id);
ebd79f07 660
bc02843e
JM
661#ifdef CONFIG_TESTING_OPTIONS
662 wpabuf_free(conf->own_ie_override);
3648d8a1 663 wpabuf_free(conf->sae_commit_override);
bc02843e
JM
664#endif /* CONFIG_TESTING_OPTIONS */
665
964f64e2 666 os_free(conf->no_probe_resp_if_seen_on);
0e2412d0 667 os_free(conf->no_auth_if_seen_on);
964f64e2 668
26bf70e3
JM
669 hostapd_config_free_fils_realms(conf);
670
56c75495
JM
671#ifdef CONFIG_DPP
672 os_free(conf->dpp_connector);
673 wpabuf_free(conf->dpp_netaccesskey);
674 wpabuf_free(conf->dpp_csign);
675#endif /* CONFIG_DPP */
676
9be19d0b 677 hostapd_config_free_sae_passwords(conf);
2377c1ca 678
ebd79f07 679 os_free(conf);
6fc6879b
JM
680}
681
682
1c6e69cc
JM
683/**
684 * hostapd_config_free - Free hostapd configuration
685 * @conf: Configuration data from hostapd_config_read().
686 */
6fc6879b
JM
687void hostapd_config_free(struct hostapd_config *conf)
688{
689 size_t i;
690
691 if (conf == NULL)
692 return;
693
694 for (i = 0; i < conf->num_bss; i++)
ebd79f07 695 hostapd_config_free_bss(conf->bss[i]);
6fc6879b 696 os_free(conf->bss);
79d6c85f
JM
697 os_free(conf->supported_rates);
698 os_free(conf->basic_rates);
857d9422 699 os_free(conf->acs_ch_list.range);
0ecff8d7 700 os_free(conf->driver_params);
68fa00c3
JM
701#ifdef CONFIG_ACS
702 os_free(conf->acs_chan_bias);
703#endif /* CONFIG_ACS */
74e982d8
DS
704 wpabuf_free(conf->lci);
705 wpabuf_free(conf->civic);
6fc6879b
JM
706
707 os_free(conf);
708}
709
710
1c6e69cc
JM
711/**
712 * hostapd_maclist_found - Find a MAC address from a list
713 * @list: MAC address list
714 * @num_entries: Number of addresses in the list
715 * @addr: Address to search for
716 * @vlan_id: Buffer for returning VLAN ID or %NULL if not needed
717 * Returns: 1 if address is in the list or 0 if not.
718 *
719 * Perform a binary search for given MAC address from a pre-sorted list.
720 */
271d2830 721int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
1889af2e 722 const u8 *addr, struct vlan_description *vlan_id)
6fc6879b
JM
723{
724 int start, end, middle, res;
725
726 start = 0;
727 end = num_entries - 1;
728
729 while (start <= end) {
730 middle = (start + end) / 2;
271d2830
JM
731 res = os_memcmp(list[middle].addr, addr, ETH_ALEN);
732 if (res == 0) {
733 if (vlan_id)
734 *vlan_id = list[middle].vlan_id;
6fc6879b 735 return 1;
271d2830 736 }
6fc6879b
JM
737 if (res < 0)
738 start = middle + 1;
739 else
740 end = middle - 1;
741 }
742
743 return 0;
744}
745
746
747int hostapd_rate_found(int *list, int rate)
748{
749 int i;
750
751 if (list == NULL)
752 return 0;
753
754 for (i = 0; list[i] >= 0; i++)
755 if (list[i] == rate)
756 return 1;
757
758 return 0;
759}
760
761
1889af2e
MB
762int hostapd_vlan_valid(struct hostapd_vlan *vlan,
763 struct vlan_description *vlan_desc)
6fc6879b
JM
764{
765 struct hostapd_vlan *v = vlan;
8e44c192 766 int i;
1889af2e 767
8e44c192 768 if (!vlan_desc->notempty || vlan_desc->untagged < 0 ||
1889af2e
MB
769 vlan_desc->untagged > MAX_VLAN_ID)
770 return 0;
8e44c192
MB
771 for (i = 0; i < MAX_NUM_TAGGED_VLAN; i++) {
772 if (vlan_desc->tagged[i] < 0 ||
773 vlan_desc->tagged[i] > MAX_VLAN_ID)
774 return 0;
775 }
776 if (!vlan_desc->untagged && !vlan_desc->tagged[0])
777 return 0;
1889af2e 778
6fc6879b 779 while (v) {
1889af2e
MB
780 if (!vlan_compare(&v->vlan_desc, vlan_desc) ||
781 v->vlan_id == VLAN_ID_WILDCARD)
80ebfd95
MB
782 return 1;
783 v = v->next;
784 }
785 return 0;
786}
787
788
789const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan, int vlan_id)
790{
791 struct hostapd_vlan *v = vlan;
792 while (v) {
793 if (v->vlan_id == vlan_id)
6fc6879b
JM
794 return v->ifname;
795 v = v->next;
796 }
797 return NULL;
798}
799
800
801const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
759fd76b
JM
802 const u8 *addr, const u8 *p2p_dev_addr,
803 const u8 *prev_psk)
6fc6879b
JM
804{
805 struct hostapd_wpa_psk *psk;
806 int next_ok = prev_psk == NULL;
807
dc87541e 808 if (p2p_dev_addr && !is_zero_ether_addr(p2p_dev_addr)) {
759fd76b
JM
809 wpa_printf(MSG_DEBUG, "Searching a PSK for " MACSTR
810 " p2p_dev_addr=" MACSTR " prev_psk=%p",
811 MAC2STR(addr), MAC2STR(p2p_dev_addr), prev_psk);
dc87541e 812 addr = NULL; /* Use P2P Device Address for matching */
759fd76b
JM
813 } else {
814 wpa_printf(MSG_DEBUG, "Searching a PSK for " MACSTR
815 " prev_psk=%p",
816 MAC2STR(addr), prev_psk);
817 }
818
6fc6879b
JM
819 for (psk = conf->ssid.wpa_psk; psk != NULL; psk = psk->next) {
820 if (next_ok &&
759fd76b
JM
821 (psk->group ||
822 (addr && os_memcmp(psk->addr, addr, ETH_ALEN) == 0) ||
823 (!addr && p2p_dev_addr &&
824 os_memcmp(psk->p2p_dev_addr, p2p_dev_addr, ETH_ALEN) ==
825 0)))
6fc6879b
JM
826 return psk->psk;
827
828 if (psk->psk == prev_psk)
829 next_ok = 1;
830 }
831
832 return NULL;
833}
eff0fd1e
JM
834
835
836static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
08081ad8
JM
837 struct hostapd_config *conf,
838 int full_config)
eff0fd1e 839{
08081ad8 840 if (full_config && bss->ieee802_1x && !bss->eap_server &&
eff0fd1e
JM
841 !bss->radius->auth_servers) {
842 wpa_printf(MSG_ERROR, "Invalid IEEE 802.1X configuration (no "
843 "EAP authenticator configured).");
844 return -1;
845 }
846
847 if (bss->wpa) {
848 int wep, i;
849
850 wep = bss->default_wep_key_len > 0 ||
851 bss->individual_wep_key_len > 0;
852 for (i = 0; i < NUM_WEP_KEYS; i++) {
853 if (bss->ssid.wep.keys_set) {
854 wep = 1;
855 break;
856 }
857 }
858
859 if (wep) {
860 wpa_printf(MSG_ERROR, "WEP configuration in a WPA network is not supported");
861 return -1;
862 }
863 }
864
08081ad8
JM
865 if (full_config && bss->wpa &&
866 bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
eff0fd1e
JM
867 bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
868 wpa_printf(MSG_ERROR, "WPA-PSK using RADIUS enabled, but no "
869 "RADIUS checking (macaddr_acl=2) enabled.");
870 return -1;
871 }
872
08081ad8 873 if (full_config && bss->wpa && (bss->wpa_key_mgmt & WPA_KEY_MGMT_PSK) &&
eff0fd1e
JM
874 bss->ssid.wpa_psk == NULL && bss->ssid.wpa_passphrase == NULL &&
875 bss->ssid.wpa_psk_file == NULL &&
876 (bss->wpa_psk_radius != PSK_RADIUS_REQUIRED ||
877 bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH)) {
878 wpa_printf(MSG_ERROR, "WPA-PSK enabled, but PSK or passphrase "
879 "is not configured.");
880 return -1;
881 }
882
902c07a7 883 if (full_config && !is_zero_ether_addr(bss->bssid)) {
eff0fd1e
JM
884 size_t i;
885
886 for (i = 0; i < conf->num_bss; i++) {
887 if (conf->bss[i] != bss &&
888 (hostapd_mac_comp(conf->bss[i]->bssid,
889 bss->bssid) == 0)) {
890 wpa_printf(MSG_ERROR, "Duplicate BSSID " MACSTR
891 " on interface '%s' and '%s'.",
892 MAC2STR(bss->bssid),
893 conf->bss[i]->iface, bss->iface);
894 return -1;
895 }
896 }
897 }
898
4ec1fd8e 899#ifdef CONFIG_IEEE80211R_AP
08081ad8 900 if (full_config && wpa_key_mgmt_ft(bss->wpa_key_mgmt) &&
eff0fd1e
JM
901 (bss->nas_identifier == NULL ||
902 os_strlen(bss->nas_identifier) < 1 ||
903 os_strlen(bss->nas_identifier) > FT_R0KH_ID_MAX_LEN)) {
904 wpa_printf(MSG_ERROR, "FT (IEEE 802.11r) requires "
905 "nas_identifier to be configured as a 1..48 octet "
906 "string");
907 return -1;
908 }
4ec1fd8e 909#endif /* CONFIG_IEEE80211R_AP */
eff0fd1e
JM
910
911#ifdef CONFIG_IEEE80211N
08081ad8
JM
912 if (full_config && conf->ieee80211n &&
913 conf->hw_mode == HOSTAPD_MODE_IEEE80211B) {
eff0fd1e
JM
914 bss->disable_11n = 1;
915 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) in 11b mode is not "
8c6f4a5a 916 "allowed, disabling HT capabilities");
eff0fd1e
JM
917 }
918
08081ad8 919 if (full_config && conf->ieee80211n &&
eff0fd1e
JM
920 bss->ssid.security_policy == SECURITY_STATIC_WEP) {
921 bss->disable_11n = 1;
922 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) with WEP is not "
923 "allowed, disabling HT capabilities");
924 }
925
08081ad8 926 if (full_config && conf->ieee80211n && bss->wpa &&
eff0fd1e 927 !(bss->wpa_pairwise & WPA_CIPHER_CCMP) &&
30675c34
JM
928 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
929 WPA_CIPHER_CCMP_256 | WPA_CIPHER_GCMP_256)))
930 {
eff0fd1e
JM
931 bss->disable_11n = 1;
932 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) with WPA/WPA2 "
933 "requires CCMP/GCMP to be enabled, disabling HT "
934 "capabilities");
935 }
936#endif /* CONFIG_IEEE80211N */
937
551817a5
WG
938#ifdef CONFIG_IEEE80211AC
939 if (full_config && conf->ieee80211ac &&
940 bss->ssid.security_policy == SECURITY_STATIC_WEP) {
941 bss->disable_11ac = 1;
942 wpa_printf(MSG_ERROR,
943 "VHT (IEEE 802.11ac) with WEP is not allowed, disabling VHT capabilities");
944 }
59d7cff7
FM
945
946 if (full_config && conf->ieee80211ac && bss->wpa &&
947 !(bss->wpa_pairwise & WPA_CIPHER_CCMP) &&
948 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
949 WPA_CIPHER_CCMP_256 | WPA_CIPHER_GCMP_256)))
950 {
951 bss->disable_11ac = 1;
952 wpa_printf(MSG_ERROR,
953 "VHT (IEEE 802.11ac) with WPA/WPA2 requires CCMP/GCMP to be enabled, disabling VHT capabilities");
954 }
551817a5
WG
955#endif /* CONFIG_IEEE80211AC */
956
c201f93a 957#ifdef CONFIG_WPS
08081ad8 958 if (full_config && bss->wps_state && bss->ignore_broadcast_ssid) {
eff0fd1e
JM
959 wpa_printf(MSG_INFO, "WPS: ignore_broadcast_ssid "
960 "configuration forced WPS to be disabled");
961 bss->wps_state = 0;
962 }
963
08081ad8
JM
964 if (full_config && bss->wps_state &&
965 bss->ssid.wep.keys_set && bss->wpa == 0) {
eff0fd1e
JM
966 wpa_printf(MSG_INFO, "WPS: WEP configuration forced WPS to be "
967 "disabled");
968 bss->wps_state = 0;
969 }
970
08081ad8 971 if (full_config && bss->wps_state && bss->wpa &&
eff0fd1e 972 (!(bss->wpa & 2) ||
a2660890
SSG
973 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
974 WPA_CIPHER_CCMP_256 |
975 WPA_CIPHER_GCMP_256)))) {
eff0fd1e 976 wpa_printf(MSG_INFO, "WPS: WPA/TKIP configuration without "
01a02593 977 "WPA2/CCMP/GCMP forced WPS to be disabled");
eff0fd1e
JM
978 bss->wps_state = 0;
979 }
c201f93a 980#endif /* CONFIG_WPS */
eff0fd1e
JM
981
982#ifdef CONFIG_HS20
08081ad8 983 if (full_config && bss->hs20 &&
eff0fd1e 984 (!(bss->wpa & 2) ||
30675c34
JM
985 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
986 WPA_CIPHER_CCMP_256 |
987 WPA_CIPHER_GCMP_256)))) {
eff0fd1e
JM
988 wpa_printf(MSG_ERROR, "HS 2.0: WPA2-Enterprise/CCMP "
989 "configuration is required for Hotspot 2.0 "
990 "functionality");
991 return -1;
992 }
993#endif /* CONFIG_HS20 */
994
4c572281
JM
995#ifdef CONFIG_MBO
996 if (full_config && bss->mbo_enabled && (bss->wpa & 2) &&
997 bss->ieee80211w == NO_MGMT_FRAME_PROTECTION) {
998 wpa_printf(MSG_ERROR,
999 "MBO: PMF needs to be enabled whenever using WPA2 with MBO");
1000 return -1;
1001 }
1002#endif /* CONFIG_MBO */
1003
eff0fd1e
JM
1004 return 0;
1005}
1006
1007
8884ce03
MM
1008static int hostapd_config_check_cw(struct hostapd_config *conf, int queue)
1009{
1010 int tx_cwmin = conf->tx_queue[queue].cwmin;
1011 int tx_cwmax = conf->tx_queue[queue].cwmax;
1012 int ac_cwmin = conf->wmm_ac_params[queue].cwmin;
1013 int ac_cwmax = conf->wmm_ac_params[queue].cwmax;
1014
1015 if (tx_cwmin > tx_cwmax) {
1016 wpa_printf(MSG_ERROR,
1017 "Invalid TX queue cwMin/cwMax values. cwMin(%d) greater than cwMax(%d)",
1018 tx_cwmin, tx_cwmax);
1019 return -1;
1020 }
1021 if (ac_cwmin > ac_cwmax) {
1022 wpa_printf(MSG_ERROR,
1023 "Invalid WMM AC cwMin/cwMax values. cwMin(%d) greater than cwMax(%d)",
1024 ac_cwmin, ac_cwmax);
1025 return -1;
1026 }
1027 return 0;
1028}
1029
1030
08081ad8 1031int hostapd_config_check(struct hostapd_config *conf, int full_config)
eff0fd1e
JM
1032{
1033 size_t i;
1034
08081ad8
JM
1035 if (full_config && conf->ieee80211d &&
1036 (!conf->country[0] || !conf->country[1])) {
eff0fd1e
JM
1037 wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11d without "
1038 "setting the country_code");
1039 return -1;
1040 }
1041
08081ad8 1042 if (full_config && conf->ieee80211h && !conf->ieee80211d) {
eff0fd1e
JM
1043 wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11h without "
1044 "IEEE 802.11d enabled");
1045 return -1;
1046 }
1047
e0392f82
S
1048 if (full_config && conf->local_pwr_constraint != -1 &&
1049 !conf->ieee80211d) {
1050 wpa_printf(MSG_ERROR, "Cannot add Power Constraint element without Country element");
1051 return -1;
1052 }
1053
3d7ad2f6
C
1054 if (full_config && conf->spectrum_mgmt_required &&
1055 conf->local_pwr_constraint == -1) {
1056 wpa_printf(MSG_ERROR, "Cannot set Spectrum Management bit without Country and Power Constraint elements");
1057 return -1;
1058 }
1059
8884ce03
MM
1060 for (i = 0; i < NUM_TX_QUEUES; i++) {
1061 if (hostapd_config_check_cw(conf, i))
1062 return -1;
1063 }
1064
eff0fd1e 1065 for (i = 0; i < conf->num_bss; i++) {
08081ad8 1066 if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
eff0fd1e
JM
1067 return -1;
1068 }
1069
1070 return 0;
1071}
1072
1073
5d67bf15
JM
1074void hostapd_set_security_params(struct hostapd_bss_config *bss,
1075 int full_config)
eff0fd1e
JM
1076{
1077 if (bss->individual_wep_key_len == 0) {
1078 /* individual keys are not use; can use key idx0 for
1079 * broadcast keys */
1080 bss->broadcast_key_idx_min = 0;
1081 }
1082
1083 if ((bss->wpa & 2) && bss->rsn_pairwise == 0)
1084 bss->rsn_pairwise = bss->wpa_pairwise;
27781c0a
JM
1085 if (bss->group_cipher)
1086 bss->wpa_group = bss->group_cipher;
1087 else
1088 bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
1089 bss->wpa_pairwise,
1090 bss->rsn_pairwise);
90f837b0
JM
1091 if (!bss->wpa_group_rekey_set)
1092 bss->wpa_group_rekey = bss->wpa_group == WPA_CIPHER_TKIP ?
1093 600 : 86400;
eff0fd1e 1094
5d67bf15
JM
1095 if (full_config) {
1096 bss->radius->auth_server = bss->radius->auth_servers;
1097 bss->radius->acct_server = bss->radius->acct_servers;
1098 }
eff0fd1e
JM
1099
1100 if (bss->wpa && bss->ieee802_1x) {
1101 bss->ssid.security_policy = SECURITY_WPA;
1102 } else if (bss->wpa) {
1103 bss->ssid.security_policy = SECURITY_WPA_PSK;
1104 } else if (bss->ieee802_1x) {
1105 int cipher = WPA_CIPHER_NONE;
1106 bss->ssid.security_policy = SECURITY_IEEE_802_1X;
1107 bss->ssid.wep.default_len = bss->default_wep_key_len;
13a3a20d 1108 if (full_config && bss->default_wep_key_len) {
eff0fd1e
JM
1109 cipher = bss->default_wep_key_len >= 13 ?
1110 WPA_CIPHER_WEP104 : WPA_CIPHER_WEP40;
13a3a20d
JM
1111 } else if (full_config && bss->ssid.wep.keys_set) {
1112 if (bss->ssid.wep.len[0] >= 13)
1113 cipher = WPA_CIPHER_WEP104;
1114 else
1115 cipher = WPA_CIPHER_WEP40;
1116 }
eff0fd1e
JM
1117 bss->wpa_group = cipher;
1118 bss->wpa_pairwise = cipher;
1119 bss->rsn_pairwise = cipher;
13a3a20d
JM
1120 if (full_config)
1121 bss->wpa_key_mgmt = WPA_KEY_MGMT_IEEE8021X_NO_WPA;
eff0fd1e
JM
1122 } else if (bss->ssid.wep.keys_set) {
1123 int cipher = WPA_CIPHER_WEP40;
1124 if (bss->ssid.wep.len[0] >= 13)
1125 cipher = WPA_CIPHER_WEP104;
1126 bss->ssid.security_policy = SECURITY_STATIC_WEP;
1127 bss->wpa_group = cipher;
1128 bss->wpa_pairwise = cipher;
1129 bss->rsn_pairwise = cipher;
13a3a20d
JM
1130 if (full_config)
1131 bss->wpa_key_mgmt = WPA_KEY_MGMT_NONE;
a14896e8
JM
1132 } else if (bss->osen) {
1133 bss->ssid.security_policy = SECURITY_OSEN;
1134 bss->wpa_group = WPA_CIPHER_CCMP;
1135 bss->wpa_pairwise = 0;
1136 bss->rsn_pairwise = WPA_CIPHER_CCMP;
eff0fd1e
JM
1137 } else {
1138 bss->ssid.security_policy = SECURITY_PLAINTEXT;
29767152
JM
1139 if (full_config) {
1140 bss->wpa_group = WPA_CIPHER_NONE;
1141 bss->wpa_pairwise = WPA_CIPHER_NONE;
1142 bss->rsn_pairwise = WPA_CIPHER_NONE;
13a3a20d 1143 bss->wpa_key_mgmt = WPA_KEY_MGMT_NONE;
29767152 1144 }
eff0fd1e
JM
1145 }
1146}