2 * hostapd / Configuration file parser
3 * Copyright (c) 2003-2009, 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.
15 #include "utils/includes.h"
16 #ifndef CONFIG_NATIVE_WINDOWS
18 #endif /* CONFIG_NATIVE_WINDOWS */
20 #include "utils/common.h"
21 #include "utils/uuid.h"
22 #include "common/ieee802_11_defs.h"
23 #include "drivers/driver.h"
24 #include "eap_server/eap.h"
25 #include "radius/radius_client.h"
26 #include "ap/wpa_auth.h"
27 #include "ap/ap_config.h"
28 #include "config_file.h"
31 extern struct wpa_driver_ops
*wpa_drivers
[];
34 #ifndef CONFIG_NO_VLAN
35 static int hostapd_config_read_vlan_file(struct hostapd_bss_config
*bss
,
39 char buf
[128], *pos
, *pos2
;
40 int line
= 0, vlan_id
;
41 struct hostapd_vlan
*vlan
;
43 f
= fopen(fname
, "r");
45 wpa_printf(MSG_ERROR
, "VLAN file '%s' not readable.", fname
);
49 while (fgets(buf
, sizeof(buf
), f
)) {
55 while (*pos
!= '\0') {
66 vlan_id
= VLAN_ID_WILDCARD
;
69 vlan_id
= strtol(buf
, &pos
, 10);
70 if (buf
== pos
|| vlan_id
< 1 ||
71 vlan_id
> MAX_VLAN_ID
) {
72 wpa_printf(MSG_ERROR
, "Invalid VLAN ID at "
73 "line %d in '%s'", line
, fname
);
79 while (*pos
== ' ' || *pos
== '\t')
82 while (*pos2
!= ' ' && *pos2
!= '\t' && *pos2
!= '\0')
85 if (*pos
== '\0' || os_strlen(pos
) > IFNAMSIZ
) {
86 wpa_printf(MSG_ERROR
, "Invalid VLAN ifname at line %d "
87 "in '%s'", line
, fname
);
92 vlan
= os_malloc(sizeof(*vlan
));
94 wpa_printf(MSG_ERROR
, "Out of memory while reading "
95 "VLAN interfaces from '%s'", fname
);
100 os_memset(vlan
, 0, sizeof(*vlan
));
101 vlan
->vlan_id
= vlan_id
;
102 os_strlcpy(vlan
->ifname
, pos
, sizeof(vlan
->ifname
));
104 bss
->vlan_tail
->next
= vlan
;
107 bss
->vlan_tail
= vlan
;
114 #endif /* CONFIG_NO_VLAN */
117 static int hostapd_acl_comp(const void *a
, const void *b
)
119 const struct mac_acl_entry
*aa
= a
;
120 const struct mac_acl_entry
*bb
= b
;
121 return os_memcmp(aa
->addr
, bb
->addr
, sizeof(macaddr
));
125 static int hostapd_config_read_maclist(const char *fname
,
126 struct mac_acl_entry
**acl
, int *num
)
132 struct mac_acl_entry
*newacl
;
138 f
= fopen(fname
, "r");
140 wpa_printf(MSG_ERROR
, "MAC list file '%s' not found.", fname
);
144 while (fgets(buf
, sizeof(buf
), f
)) {
150 while (*pos
!= '\0') {
160 if (hwaddr_aton(buf
, addr
)) {
161 wpa_printf(MSG_ERROR
, "Invalid MAC address '%s' at "
162 "line %d in '%s'", buf
, line
, fname
);
169 while (*pos
!= '\0' && *pos
!= ' ' && *pos
!= '\t')
171 while (*pos
== ' ' || *pos
== '\t')
176 newacl
= os_realloc(*acl
, (*num
+ 1) * sizeof(**acl
));
177 if (newacl
== NULL
) {
178 wpa_printf(MSG_ERROR
, "MAC list reallocation failed");
184 os_memcpy((*acl
)[*num
].addr
, addr
, ETH_ALEN
);
185 (*acl
)[*num
].vlan_id
= vlan_id
;
191 qsort(*acl
, *num
, sizeof(**acl
), hostapd_acl_comp
);
198 static int hostapd_config_read_eap_user(const char *fname
,
199 struct hostapd_bss_config
*conf
)
202 char buf
[512], *pos
, *start
, *pos2
;
203 int line
= 0, ret
= 0, num_methods
;
204 struct hostapd_eap_user
*user
, *tail
= NULL
;
209 f
= fopen(fname
, "r");
211 wpa_printf(MSG_ERROR
, "EAP user file '%s' not found.", fname
);
215 /* Lines: "user" METHOD,METHOD2 "password" (password optional) */
216 while (fgets(buf
, sizeof(buf
), f
)) {
222 while (*pos
!= '\0') {
234 if (buf
[0] != '"' && buf
[0] != '*') {
235 wpa_printf(MSG_ERROR
, "Invalid EAP identity (no \" in "
236 "start) on line %d in '%s'", line
, fname
);
240 user
= os_zalloc(sizeof(*user
));
242 wpa_printf(MSG_ERROR
, "EAP user allocation failed");
245 user
->force_version
= -1;
252 while (*pos
!= '"' && *pos
!= '\0')
255 wpa_printf(MSG_ERROR
, "Invalid EAP identity "
256 "(no \" in end) on line %d in '%s'",
261 user
->identity
= os_malloc(pos
- start
);
262 if (user
->identity
== NULL
) {
263 wpa_printf(MSG_ERROR
, "Failed to allocate "
264 "memory for EAP identity");
267 os_memcpy(user
->identity
, start
, pos
- start
);
268 user
->identity_len
= pos
- start
;
270 if (pos
[0] == '"' && pos
[1] == '*') {
271 user
->wildcard_prefix
= 1;
276 while (*pos
== ' ' || *pos
== '\t')
280 wpa_printf(MSG_ERROR
, "No EAP method on line %d in "
281 "'%s'", line
, fname
);
286 while (*pos
!= ' ' && *pos
!= '\t' && *pos
!= '\0')
296 char *pos3
= os_strchr(start
, ',');
300 user
->methods
[num_methods
].method
=
303 &user
->methods
[num_methods
].vendor
);
304 if (user
->methods
[num_methods
].vendor
==
306 user
->methods
[num_methods
].method
== EAP_TYPE_NONE
)
308 if (os_strcmp(start
, "TTLS-PAP") == 0) {
309 user
->ttls_auth
|= EAP_TTLS_AUTH_PAP
;
312 if (os_strcmp(start
, "TTLS-CHAP") == 0) {
313 user
->ttls_auth
|= EAP_TTLS_AUTH_CHAP
;
316 if (os_strcmp(start
, "TTLS-MSCHAP") == 0) {
318 EAP_TTLS_AUTH_MSCHAP
;
321 if (os_strcmp(start
, "TTLS-MSCHAPV2") == 0) {
323 EAP_TTLS_AUTH_MSCHAPV2
;
326 wpa_printf(MSG_ERROR
, "Unsupported EAP type "
327 "'%s' on line %d in '%s'",
333 if (num_methods
>= EAP_USER_MAX_METHODS
)
340 if (num_methods
== 0 && user
->ttls_auth
== 0) {
341 wpa_printf(MSG_ERROR
, "No EAP types configured on "
342 "line %d in '%s'", line
, fname
);
349 while (*pos
== ' ' || *pos
== '\t')
354 if (os_strncmp(pos
, "[ver=0]", 7) == 0) {
355 user
->force_version
= 0;
359 if (os_strncmp(pos
, "[ver=1]", 7) == 0) {
360 user
->force_version
= 1;
364 if (os_strncmp(pos
, "[2]", 3) == 0) {
372 while (*pos
!= '"' && *pos
!= '\0')
375 wpa_printf(MSG_ERROR
, "Invalid EAP password "
376 "(no \" in end) on line %d in '%s'",
381 user
->password
= os_malloc(pos
- start
);
382 if (user
->password
== NULL
) {
383 wpa_printf(MSG_ERROR
, "Failed to allocate "
384 "memory for EAP password");
387 os_memcpy(user
->password
, start
, pos
- start
);
388 user
->password_len
= pos
- start
;
391 } else if (os_strncmp(pos
, "hash:", 5) == 0) {
394 while (*pos2
!= '\0' && *pos2
!= ' ' &&
395 *pos2
!= '\t' && *pos2
!= '#')
397 if (pos2
- pos
!= 32) {
398 wpa_printf(MSG_ERROR
, "Invalid password hash "
399 "on line %d in '%s'", line
, fname
);
402 user
->password
= os_malloc(16);
403 if (user
->password
== NULL
) {
404 wpa_printf(MSG_ERROR
, "Failed to allocate "
405 "memory for EAP password hash");
408 if (hexstr2bin(pos
, user
->password
, 16) < 0) {
409 wpa_printf(MSG_ERROR
, "Invalid hash password "
410 "on line %d in '%s'", line
, fname
);
413 user
->password_len
= 16;
414 user
->password_hash
= 1;
418 while (*pos2
!= '\0' && *pos2
!= ' ' &&
419 *pos2
!= '\t' && *pos2
!= '#')
421 if ((pos2
- pos
) & 1) {
422 wpa_printf(MSG_ERROR
, "Invalid hex password "
423 "on line %d in '%s'", line
, fname
);
426 user
->password
= os_malloc((pos2
- pos
) / 2);
427 if (user
->password
== NULL
) {
428 wpa_printf(MSG_ERROR
, "Failed to allocate "
429 "memory for EAP password");
432 if (hexstr2bin(pos
, user
->password
,
433 (pos2
- pos
) / 2) < 0) {
434 wpa_printf(MSG_ERROR
, "Invalid hex password "
435 "on line %d in '%s'", line
, fname
);
438 user
->password_len
= (pos2
- pos
) / 2;
442 while (*pos
== ' ' || *pos
== '\t')
444 if (os_strncmp(pos
, "[2]", 3) == 0) {
450 tail
= conf
->eap_user
= user
;
459 os_free(user
->password
);
460 os_free(user
->identity
);
471 #endif /* EAP_SERVER */
474 #ifndef CONFIG_NO_RADIUS
476 hostapd_config_read_radius_addr(struct hostapd_radius_server
**server
,
477 int *num_server
, const char *val
, int def_port
,
478 struct hostapd_radius_server
**curr_serv
)
480 struct hostapd_radius_server
*nserv
;
482 static int server_index
= 1;
484 nserv
= os_realloc(*server
, (*num_server
+ 1) * sizeof(*nserv
));
489 nserv
= &nserv
[*num_server
];
491 (*curr_serv
) = nserv
;
493 os_memset(nserv
, 0, sizeof(*nserv
));
494 nserv
->port
= def_port
;
495 ret
= hostapd_parse_ip_addr(val
, &nserv
->addr
);
496 nserv
->index
= server_index
++;
500 #endif /* CONFIG_NO_RADIUS */
503 static int hostapd_config_parse_key_mgmt(int line
, const char *value
)
506 char *start
, *end
, *buf
;
508 buf
= os_strdup(value
);
513 while (*start
!= '\0') {
514 while (*start
== ' ' || *start
== '\t')
519 while (*end
!= ' ' && *end
!= '\t' && *end
!= '\0')
523 if (os_strcmp(start
, "WPA-PSK") == 0)
524 val
|= WPA_KEY_MGMT_PSK
;
525 else if (os_strcmp(start
, "WPA-EAP") == 0)
526 val
|= WPA_KEY_MGMT_IEEE8021X
;
527 #ifdef CONFIG_IEEE80211R
528 else if (os_strcmp(start
, "FT-PSK") == 0)
529 val
|= WPA_KEY_MGMT_FT_PSK
;
530 else if (os_strcmp(start
, "FT-EAP") == 0)
531 val
|= WPA_KEY_MGMT_FT_IEEE8021X
;
532 #endif /* CONFIG_IEEE80211R */
533 #ifdef CONFIG_IEEE80211W
534 else if (os_strcmp(start
, "WPA-PSK-SHA256") == 0)
535 val
|= WPA_KEY_MGMT_PSK_SHA256
;
536 else if (os_strcmp(start
, "WPA-EAP-SHA256") == 0)
537 val
|= WPA_KEY_MGMT_IEEE8021X_SHA256
;
538 #endif /* CONFIG_IEEE80211W */
540 wpa_printf(MSG_ERROR
, "Line %d: invalid key_mgmt '%s'",
553 wpa_printf(MSG_ERROR
, "Line %d: no key_mgmt values "
554 "configured.", line
);
562 static int hostapd_config_parse_cipher(int line
, const char *value
)
565 char *start
, *end
, *buf
;
567 buf
= os_strdup(value
);
572 while (*start
!= '\0') {
573 while (*start
== ' ' || *start
== '\t')
578 while (*end
!= ' ' && *end
!= '\t' && *end
!= '\0')
582 if (os_strcmp(start
, "CCMP") == 0)
583 val
|= WPA_CIPHER_CCMP
;
584 else if (os_strcmp(start
, "TKIP") == 0)
585 val
|= WPA_CIPHER_TKIP
;
586 else if (os_strcmp(start
, "WEP104") == 0)
587 val
|= WPA_CIPHER_WEP104
;
588 else if (os_strcmp(start
, "WEP40") == 0)
589 val
|= WPA_CIPHER_WEP40
;
590 else if (os_strcmp(start
, "NONE") == 0)
591 val
|= WPA_CIPHER_NONE
;
593 wpa_printf(MSG_ERROR
, "Line %d: invalid cipher '%s'.",
606 wpa_printf(MSG_ERROR
, "Line %d: no cipher values configured.",
614 static int hostapd_config_read_wep(struct hostapd_wep_keys
*wep
, int keyidx
,
617 size_t len
= os_strlen(val
);
619 if (keyidx
< 0 || keyidx
> 3 || wep
->key
[keyidx
] != NULL
)
623 if (len
< 2 || val
[len
- 1] != '"')
626 wep
->key
[keyidx
] = os_malloc(len
);
627 if (wep
->key
[keyidx
] == NULL
)
629 os_memcpy(wep
->key
[keyidx
], val
+ 1, len
);
630 wep
->len
[keyidx
] = len
;
635 wep
->key
[keyidx
] = os_malloc(len
);
636 if (wep
->key
[keyidx
] == NULL
)
638 wep
->len
[keyidx
] = len
;
639 if (hexstr2bin(val
, wep
->key
[keyidx
], len
) < 0)
649 static int hostapd_parse_rates(int **rate_list
, char *val
)
660 while (*pos
!= '\0') {
666 list
= os_malloc(sizeof(int) * (count
+ 2));
671 while (*pos
!= '\0') {
672 end
= os_strchr(pos
, ' ');
676 list
[count
++] = atoi(pos
);
688 static int hostapd_config_bss(struct hostapd_config
*conf
, const char *ifname
)
690 struct hostapd_bss_config
*bss
;
695 bss
= os_realloc(conf
->bss
, (conf
->num_bss
+ 1) *
696 sizeof(struct hostapd_bss_config
));
698 wpa_printf(MSG_ERROR
, "Failed to allocate memory for "
704 bss
= &(conf
->bss
[conf
->num_bss
]);
705 os_memset(bss
, 0, sizeof(*bss
));
706 bss
->radius
= os_zalloc(sizeof(*bss
->radius
));
707 if (bss
->radius
== NULL
) {
708 wpa_printf(MSG_ERROR
, "Failed to allocate memory for "
709 "multi-BSS RADIUS data");
714 conf
->last_bss
= bss
;
716 hostapd_config_defaults_bss(bss
);
717 os_strlcpy(bss
->iface
, ifname
, sizeof(bss
->iface
));
718 os_memcpy(bss
->ssid
.vlan
, bss
->iface
, IFNAMSIZ
+ 1);
724 /* convert floats with one decimal place to value*10 int, i.e.,
725 * "1.5" will return 15 */
726 static int hostapd_config_read_int10(const char *value
)
732 pos
= os_strchr(value
, '.');
736 if (*pos
>= '0' && *pos
<= '9')
744 static int valid_cw(int cw
)
746 return (cw
== 1 || cw
== 3 || cw
== 7 || cw
== 15 || cw
== 31 ||
747 cw
== 63 || cw
== 127 || cw
== 255 || cw
== 511 || cw
== 1023);
752 IEEE80211_TX_QUEUE_DATA0
= 0, /* used for EDCA AC_VO data */
753 IEEE80211_TX_QUEUE_DATA1
= 1, /* used for EDCA AC_VI data */
754 IEEE80211_TX_QUEUE_DATA2
= 2, /* used for EDCA AC_BE data */
755 IEEE80211_TX_QUEUE_DATA3
= 3 /* used for EDCA AC_BK data */
758 static int hostapd_config_tx_queue(struct hostapd_config
*conf
, char *name
,
763 struct hostapd_tx_queue_params
*queue
;
765 /* skip 'tx_queue_' prefix */
767 if (os_strncmp(pos
, "data", 4) == 0 &&
768 pos
[4] >= '0' && pos
[4] <= '9' && pos
[5] == '_') {
771 } else if (os_strncmp(pos
, "after_beacon_", 13) == 0 ||
772 os_strncmp(pos
, "beacon_", 7) == 0) {
773 wpa_printf(MSG_INFO
, "DEPRECATED: '%s' not used", name
);
776 wpa_printf(MSG_ERROR
, "Unknown tx_queue name '%s'", pos
);
780 if (num
>= NUM_TX_QUEUES
) {
781 /* for backwards compatibility, do not trigger failure */
782 wpa_printf(MSG_INFO
, "DEPRECATED: '%s' not used", name
);
786 queue
= &conf
->tx_queue
[num
];
788 if (os_strcmp(pos
, "aifs") == 0) {
789 queue
->aifs
= atoi(val
);
790 if (queue
->aifs
< 0 || queue
->aifs
> 255) {
791 wpa_printf(MSG_ERROR
, "Invalid AIFS value %d",
795 } else if (os_strcmp(pos
, "cwmin") == 0) {
796 queue
->cwmin
= atoi(val
);
797 if (!valid_cw(queue
->cwmin
)) {
798 wpa_printf(MSG_ERROR
, "Invalid cwMin value %d",
802 } else if (os_strcmp(pos
, "cwmax") == 0) {
803 queue
->cwmax
= atoi(val
);
804 if (!valid_cw(queue
->cwmax
)) {
805 wpa_printf(MSG_ERROR
, "Invalid cwMax value %d",
809 } else if (os_strcmp(pos
, "burst") == 0) {
810 queue
->burst
= hostapd_config_read_int10(val
);
812 wpa_printf(MSG_ERROR
, "Unknown tx_queue field '%s'", pos
);
820 static int hostapd_config_wmm_ac(struct hostapd_config
*conf
, char *name
,
825 struct hostapd_wmm_ac_params
*ac
;
827 /* skip 'wme_ac_' or 'wmm_ac_' prefix */
829 if (os_strncmp(pos
, "be_", 3) == 0) {
832 } else if (os_strncmp(pos
, "bk_", 3) == 0) {
835 } else if (os_strncmp(pos
, "vi_", 3) == 0) {
838 } else if (os_strncmp(pos
, "vo_", 3) == 0) {
842 wpa_printf(MSG_ERROR
, "Unknown WMM name '%s'", pos
);
846 ac
= &conf
->wmm_ac_params
[num
];
848 if (os_strcmp(pos
, "aifs") == 0) {
850 if (v
< 1 || v
> 255) {
851 wpa_printf(MSG_ERROR
, "Invalid AIFS value %d", v
);
855 } else if (os_strcmp(pos
, "cwmin") == 0) {
857 if (v
< 0 || v
> 12) {
858 wpa_printf(MSG_ERROR
, "Invalid cwMin value %d", v
);
862 } else if (os_strcmp(pos
, "cwmax") == 0) {
864 if (v
< 0 || v
> 12) {
865 wpa_printf(MSG_ERROR
, "Invalid cwMax value %d", v
);
869 } else if (os_strcmp(pos
, "txop_limit") == 0) {
871 if (v
< 0 || v
> 0xffff) {
872 wpa_printf(MSG_ERROR
, "Invalid txop value %d", v
);
876 } else if (os_strcmp(pos
, "acm") == 0) {
878 if (v
< 0 || v
> 1) {
879 wpa_printf(MSG_ERROR
, "Invalid acm value %d", v
);
882 ac
->admission_control_mandatory
= v
;
884 wpa_printf(MSG_ERROR
, "Unknown wmm_ac_ field '%s'", pos
);
892 #ifdef CONFIG_IEEE80211R
893 static int add_r0kh(struct hostapd_bss_config
*bss
, char *value
)
895 struct ft_remote_r0kh
*r0kh
;
898 r0kh
= os_zalloc(sizeof(*r0kh
));
902 /* 02:01:02:03:04:05 a.example.com 000102030405060708090a0b0c0d0e0f */
904 next
= os_strchr(pos
, ' ');
907 if (next
== NULL
|| hwaddr_aton(pos
, r0kh
->addr
)) {
908 wpa_printf(MSG_ERROR
, "Invalid R0KH MAC address: '%s'", pos
);
914 next
= os_strchr(pos
, ' ');
917 if (next
== NULL
|| next
- pos
> FT_R0KH_ID_MAX_LEN
) {
918 wpa_printf(MSG_ERROR
, "Invalid R0KH-ID: '%s'", pos
);
922 r0kh
->id_len
= next
- pos
- 1;
923 os_memcpy(r0kh
->id
, pos
, r0kh
->id_len
);
926 if (hexstr2bin(pos
, r0kh
->key
, sizeof(r0kh
->key
))) {
927 wpa_printf(MSG_ERROR
, "Invalid R0KH key: '%s'", pos
);
932 r0kh
->next
= bss
->r0kh_list
;
933 bss
->r0kh_list
= r0kh
;
939 static int add_r1kh(struct hostapd_bss_config
*bss
, char *value
)
941 struct ft_remote_r1kh
*r1kh
;
944 r1kh
= os_zalloc(sizeof(*r1kh
));
948 /* 02:01:02:03:04:05 02:01:02:03:04:05
949 * 000102030405060708090a0b0c0d0e0f */
951 next
= os_strchr(pos
, ' ');
954 if (next
== NULL
|| hwaddr_aton(pos
, r1kh
->addr
)) {
955 wpa_printf(MSG_ERROR
, "Invalid R1KH MAC address: '%s'", pos
);
961 next
= os_strchr(pos
, ' ');
964 if (next
== NULL
|| hwaddr_aton(pos
, r1kh
->id
)) {
965 wpa_printf(MSG_ERROR
, "Invalid R1KH-ID: '%s'", pos
);
971 if (hexstr2bin(pos
, r1kh
->key
, sizeof(r1kh
->key
))) {
972 wpa_printf(MSG_ERROR
, "Invalid R1KH key: '%s'", pos
);
977 r1kh
->next
= bss
->r1kh_list
;
978 bss
->r1kh_list
= r1kh
;
982 #endif /* CONFIG_IEEE80211R */
985 #ifdef CONFIG_IEEE80211N
986 static int hostapd_config_ht_capab(struct hostapd_config
*conf
,
989 if (os_strstr(capab
, "[LDPC]"))
990 conf
->ht_capab
|= HT_CAP_INFO_LDPC_CODING_CAP
;
991 if (os_strstr(capab
, "[HT40-]")) {
992 conf
->ht_capab
|= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET
;
993 conf
->secondary_channel
= -1;
995 if (os_strstr(capab
, "[HT40+]")) {
996 conf
->ht_capab
|= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET
;
997 conf
->secondary_channel
= 1;
999 if (os_strstr(capab
, "[SMPS-STATIC]")) {
1000 conf
->ht_capab
&= ~HT_CAP_INFO_SMPS_MASK
;
1001 conf
->ht_capab
|= HT_CAP_INFO_SMPS_STATIC
;
1003 if (os_strstr(capab
, "[SMPS-DYNAMIC]")) {
1004 conf
->ht_capab
&= ~HT_CAP_INFO_SMPS_MASK
;
1005 conf
->ht_capab
|= HT_CAP_INFO_SMPS_DYNAMIC
;
1007 if (os_strstr(capab
, "[GF]"))
1008 conf
->ht_capab
|= HT_CAP_INFO_GREEN_FIELD
;
1009 if (os_strstr(capab
, "[SHORT-GI-20]"))
1010 conf
->ht_capab
|= HT_CAP_INFO_SHORT_GI20MHZ
;
1011 if (os_strstr(capab
, "[SHORT-GI-40]"))
1012 conf
->ht_capab
|= HT_CAP_INFO_SHORT_GI40MHZ
;
1013 if (os_strstr(capab
, "[TX-STBC]"))
1014 conf
->ht_capab
|= HT_CAP_INFO_TX_STBC
;
1015 if (os_strstr(capab
, "[RX-STBC1]")) {
1016 conf
->ht_capab
&= ~HT_CAP_INFO_RX_STBC_MASK
;
1017 conf
->ht_capab
|= HT_CAP_INFO_RX_STBC_1
;
1019 if (os_strstr(capab
, "[RX-STBC12]")) {
1020 conf
->ht_capab
&= ~HT_CAP_INFO_RX_STBC_MASK
;
1021 conf
->ht_capab
|= HT_CAP_INFO_RX_STBC_12
;
1023 if (os_strstr(capab
, "[RX-STBC123]")) {
1024 conf
->ht_capab
&= ~HT_CAP_INFO_RX_STBC_MASK
;
1025 conf
->ht_capab
|= HT_CAP_INFO_RX_STBC_123
;
1027 if (os_strstr(capab
, "[DELAYED-BA]"))
1028 conf
->ht_capab
|= HT_CAP_INFO_DELAYED_BA
;
1029 if (os_strstr(capab
, "[MAX-AMSDU-7935]"))
1030 conf
->ht_capab
|= HT_CAP_INFO_MAX_AMSDU_SIZE
;
1031 if (os_strstr(capab
, "[DSSS_CCK-40]"))
1032 conf
->ht_capab
|= HT_CAP_INFO_DSSS_CCK40MHZ
;
1033 if (os_strstr(capab
, "[PSMP]"))
1034 conf
->ht_capab
|= HT_CAP_INFO_PSMP_SUPP
;
1035 if (os_strstr(capab
, "[LSIG-TXOP-PROT]"))
1036 conf
->ht_capab
|= HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT
;
1040 #endif /* CONFIG_IEEE80211N */
1043 static int hostapd_config_check_bss(struct hostapd_bss_config
*bss
,
1044 struct hostapd_config
*conf
)
1046 if (bss
->ieee802_1x
&& !bss
->eap_server
&&
1047 !bss
->radius
->auth_servers
) {
1048 wpa_printf(MSG_ERROR
, "Invalid IEEE 802.1X configuration (no "
1049 "EAP authenticator configured).");
1053 if (bss
->wpa
&& (bss
->wpa_key_mgmt
& WPA_KEY_MGMT_PSK
) &&
1054 bss
->ssid
.wpa_psk
== NULL
&& bss
->ssid
.wpa_passphrase
== NULL
&&
1055 bss
->ssid
.wpa_psk_file
== NULL
) {
1056 wpa_printf(MSG_ERROR
, "WPA-PSK enabled, but PSK or passphrase "
1057 "is not configured.");
1061 if (hostapd_mac_comp_empty(bss
->bssid
) != 0) {
1064 for (i
= 0; i
< conf
->num_bss
; i
++) {
1065 if ((&conf
->bss
[i
] != bss
) &&
1066 (hostapd_mac_comp(conf
->bss
[i
].bssid
,
1067 bss
->bssid
) == 0)) {
1068 wpa_printf(MSG_ERROR
, "Duplicate BSSID " MACSTR
1069 " on interface '%s' and '%s'.",
1070 MAC2STR(bss
->bssid
),
1071 conf
->bss
[i
].iface
, bss
->iface
);
1077 #ifdef CONFIG_IEEE80211R
1078 if ((bss
->wpa_key_mgmt
&
1079 (WPA_KEY_MGMT_FT_PSK
| WPA_KEY_MGMT_FT_IEEE8021X
)) &&
1080 (bss
->nas_identifier
== NULL
||
1081 os_strlen(bss
->nas_identifier
) < 1 ||
1082 os_strlen(bss
->nas_identifier
) > FT_R0KH_ID_MAX_LEN
)) {
1083 wpa_printf(MSG_ERROR
, "FT (IEEE 802.11r) requires "
1084 "nas_identifier to be configured as a 1..48 octet "
1088 #endif /* CONFIG_IEEE80211R */
1090 #ifdef CONFIG_IEEE80211N
1091 if (conf
->ieee80211n
&&
1092 bss
->ssid
.security_policy
== SECURITY_STATIC_WEP
) {
1093 wpa_printf(MSG_ERROR
, "HT (IEEE 802.11n) with WEP is not "
1098 if (conf
->ieee80211n
&& bss
->wpa
&&
1099 !(bss
->wpa_pairwise
& WPA_CIPHER_CCMP
) &&
1100 !(bss
->rsn_pairwise
& WPA_CIPHER_CCMP
)) {
1101 wpa_printf(MSG_ERROR
, "HT (IEEE 802.11n) with WPA/WPA2 "
1102 "requires CCMP to be enabled");
1105 #endif /* CONFIG_IEEE80211N */
1108 if (bss
->wps_state
&& bss
->ignore_broadcast_ssid
) {
1109 wpa_printf(MSG_INFO
, "WPS: ignore_broadcast_ssid "
1110 "configuration forced WPS to be disabled");
1114 if (bss
->wps_state
&& bss
->ssid
.wep
.keys_set
&& bss
->wpa
== 0) {
1115 wpa_printf(MSG_INFO
, "WPS: WEP configuration forced WPS to be "
1119 #endif /* CONFIG_WPS2 */
1125 static int hostapd_config_check(struct hostapd_config
*conf
)
1129 if (conf
->ieee80211d
&& (!conf
->country
[0] || !conf
->country
[1])) {
1130 wpa_printf(MSG_ERROR
, "Cannot enable IEEE 802.11d without "
1131 "setting the country_code");
1135 for (i
= 0; i
< conf
->num_bss
; i
++) {
1136 if (hostapd_config_check_bss(&conf
->bss
[i
], conf
))
1145 * hostapd_config_read - Read and parse a configuration file
1146 * @fname: Configuration file name (including path, if needed)
1147 * Returns: Allocated configuration data structure
1149 struct hostapd_config
* hostapd_config_read(const char *fname
)
1151 struct hostapd_config
*conf
;
1152 struct hostapd_bss_config
*bss
;
1154 char buf
[256], *pos
;
1160 f
= fopen(fname
, "r");
1162 wpa_printf(MSG_ERROR
, "Could not open configuration file '%s' "
1163 "for reading.", fname
);
1167 conf
= hostapd_config_defaults();
1173 /* set default driver based on configuration */
1174 conf
->driver
= wpa_drivers
[0];
1175 if (conf
->driver
== NULL
) {
1176 wpa_printf(MSG_ERROR
, "No driver wrappers registered!");
1177 hostapd_config_free(conf
);
1182 bss
= conf
->last_bss
= conf
->bss
;
1184 while (fgets(buf
, sizeof(buf
), f
)) {
1185 bss
= conf
->last_bss
;
1191 while (*pos
!= '\0') {
1201 pos
= os_strchr(buf
, '=');
1203 wpa_printf(MSG_ERROR
, "Line %d: invalid line '%s'",
1211 if (os_strcmp(buf
, "interface") == 0) {
1212 os_strlcpy(conf
->bss
[0].iface
, pos
,
1213 sizeof(conf
->bss
[0].iface
));
1214 } else if (os_strcmp(buf
, "bridge") == 0) {
1215 os_strlcpy(bss
->bridge
, pos
, sizeof(bss
->bridge
));
1216 } else if (os_strcmp(buf
, "wds_bridge") == 0) {
1217 os_strlcpy(bss
->wds_bridge
, pos
,
1218 sizeof(bss
->wds_bridge
));
1219 } else if (os_strcmp(buf
, "driver") == 0) {
1221 /* clear to get error below if setting is invalid */
1222 conf
->driver
= NULL
;
1223 for (j
= 0; wpa_drivers
[j
]; j
++) {
1224 if (os_strcmp(pos
, wpa_drivers
[j
]->name
) == 0)
1226 conf
->driver
= wpa_drivers
[j
];
1230 if (conf
->driver
== NULL
) {
1231 wpa_printf(MSG_ERROR
, "Line %d: invalid/"
1232 "unknown driver '%s'", line
, pos
);
1235 } else if (os_strcmp(buf
, "debug") == 0) {
1236 wpa_printf(MSG_DEBUG
, "Line %d: DEPRECATED: 'debug' "
1237 "configuration variable is not used "
1239 } else if (os_strcmp(buf
, "logger_syslog_level") == 0) {
1240 bss
->logger_syslog_level
= atoi(pos
);
1241 } else if (os_strcmp(buf
, "logger_stdout_level") == 0) {
1242 bss
->logger_stdout_level
= atoi(pos
);
1243 } else if (os_strcmp(buf
, "logger_syslog") == 0) {
1244 bss
->logger_syslog
= atoi(pos
);
1245 } else if (os_strcmp(buf
, "logger_stdout") == 0) {
1246 bss
->logger_stdout
= atoi(pos
);
1247 } else if (os_strcmp(buf
, "dump_file") == 0) {
1248 bss
->dump_log_name
= os_strdup(pos
);
1249 } else if (os_strcmp(buf
, "ssid") == 0) {
1250 bss
->ssid
.ssid_len
= os_strlen(pos
);
1251 if (bss
->ssid
.ssid_len
> HOSTAPD_MAX_SSID_LEN
||
1252 bss
->ssid
.ssid_len
< 1) {
1253 wpa_printf(MSG_ERROR
, "Line %d: invalid SSID "
1257 os_memcpy(bss
->ssid
.ssid
, pos
,
1258 bss
->ssid
.ssid_len
);
1259 bss
->ssid
.ssid
[bss
->ssid
.ssid_len
] = '\0';
1260 bss
->ssid
.ssid_set
= 1;
1262 } else if (os_strcmp(buf
, "macaddr_acl") == 0) {
1263 bss
->macaddr_acl
= atoi(pos
);
1264 if (bss
->macaddr_acl
!= ACCEPT_UNLESS_DENIED
&&
1265 bss
->macaddr_acl
!= DENY_UNLESS_ACCEPTED
&&
1266 bss
->macaddr_acl
!= USE_EXTERNAL_RADIUS_AUTH
) {
1267 wpa_printf(MSG_ERROR
, "Line %d: unknown "
1269 line
, bss
->macaddr_acl
);
1271 } else if (os_strcmp(buf
, "accept_mac_file") == 0) {
1272 if (hostapd_config_read_maclist(pos
, &bss
->accept_mac
,
1273 &bss
->num_accept_mac
))
1275 wpa_printf(MSG_ERROR
, "Line %d: Failed to "
1276 "read accept_mac_file '%s'",
1280 } else if (os_strcmp(buf
, "deny_mac_file") == 0) {
1281 if (hostapd_config_read_maclist(pos
, &bss
->deny_mac
,
1282 &bss
->num_deny_mac
)) {
1283 wpa_printf(MSG_ERROR
, "Line %d: Failed to "
1284 "read deny_mac_file '%s'",
1288 } else if (os_strcmp(buf
, "wds_sta") == 0) {
1289 bss
->wds_sta
= atoi(pos
);
1290 } else if (os_strcmp(buf
, "ap_isolate") == 0) {
1291 bss
->isolate
= atoi(pos
);
1292 } else if (os_strcmp(buf
, "ap_max_inactivity") == 0) {
1293 bss
->ap_max_inactivity
= atoi(pos
);
1294 } else if (os_strcmp(buf
, "country_code") == 0) {
1295 os_memcpy(conf
->country
, pos
, 2);
1296 /* FIX: make this configurable */
1297 conf
->country
[2] = ' ';
1298 } else if (os_strcmp(buf
, "ieee80211d") == 0) {
1299 conf
->ieee80211d
= atoi(pos
);
1300 } else if (os_strcmp(buf
, "ieee8021x") == 0) {
1301 bss
->ieee802_1x
= atoi(pos
);
1302 } else if (os_strcmp(buf
, "eapol_version") == 0) {
1303 bss
->eapol_version
= atoi(pos
);
1304 if (bss
->eapol_version
< 1 ||
1305 bss
->eapol_version
> 2) {
1306 wpa_printf(MSG_ERROR
, "Line %d: invalid EAPOL "
1307 "version (%d): '%s'.",
1308 line
, bss
->eapol_version
, pos
);
1311 wpa_printf(MSG_DEBUG
, "eapol_version=%d",
1312 bss
->eapol_version
);
1314 } else if (os_strcmp(buf
, "eap_authenticator") == 0) {
1315 bss
->eap_server
= atoi(pos
);
1316 wpa_printf(MSG_ERROR
, "Line %d: obsolete "
1317 "eap_authenticator used; this has been "
1318 "renamed to eap_server", line
);
1319 } else if (os_strcmp(buf
, "eap_server") == 0) {
1320 bss
->eap_server
= atoi(pos
);
1321 } else if (os_strcmp(buf
, "eap_user_file") == 0) {
1322 if (hostapd_config_read_eap_user(pos
, bss
))
1324 } else if (os_strcmp(buf
, "ca_cert") == 0) {
1325 os_free(bss
->ca_cert
);
1326 bss
->ca_cert
= os_strdup(pos
);
1327 } else if (os_strcmp(buf
, "server_cert") == 0) {
1328 os_free(bss
->server_cert
);
1329 bss
->server_cert
= os_strdup(pos
);
1330 } else if (os_strcmp(buf
, "private_key") == 0) {
1331 os_free(bss
->private_key
);
1332 bss
->private_key
= os_strdup(pos
);
1333 } else if (os_strcmp(buf
, "private_key_passwd") == 0) {
1334 os_free(bss
->private_key_passwd
);
1335 bss
->private_key_passwd
= os_strdup(pos
);
1336 } else if (os_strcmp(buf
, "check_crl") == 0) {
1337 bss
->check_crl
= atoi(pos
);
1338 } else if (os_strcmp(buf
, "dh_file") == 0) {
1339 os_free(bss
->dh_file
);
1340 bss
->dh_file
= os_strdup(pos
);
1341 } else if (os_strcmp(buf
, "fragment_size") == 0) {
1342 bss
->fragment_size
= atoi(pos
);
1343 #ifdef EAP_SERVER_FAST
1344 } else if (os_strcmp(buf
, "pac_opaque_encr_key") == 0) {
1345 os_free(bss
->pac_opaque_encr_key
);
1346 bss
->pac_opaque_encr_key
= os_malloc(16);
1347 if (bss
->pac_opaque_encr_key
== NULL
) {
1348 wpa_printf(MSG_ERROR
, "Line %d: No memory for "
1349 "pac_opaque_encr_key", line
);
1351 } else if (hexstr2bin(pos
, bss
->pac_opaque_encr_key
,
1353 wpa_printf(MSG_ERROR
, "Line %d: Invalid "
1354 "pac_opaque_encr_key", line
);
1357 } else if (os_strcmp(buf
, "eap_fast_a_id") == 0) {
1358 size_t idlen
= os_strlen(pos
);
1360 wpa_printf(MSG_ERROR
, "Line %d: Invalid "
1361 "eap_fast_a_id", line
);
1364 os_free(bss
->eap_fast_a_id
);
1365 bss
->eap_fast_a_id
= os_malloc(idlen
/ 2);
1366 if (bss
->eap_fast_a_id
== NULL
||
1367 hexstr2bin(pos
, bss
->eap_fast_a_id
,
1369 wpa_printf(MSG_ERROR
, "Line %d: "
1371 "eap_fast_a_id", line
);
1374 bss
->eap_fast_a_id_len
= idlen
/ 2;
1376 } else if (os_strcmp(buf
, "eap_fast_a_id_info") == 0) {
1377 os_free(bss
->eap_fast_a_id_info
);
1378 bss
->eap_fast_a_id_info
= os_strdup(pos
);
1379 } else if (os_strcmp(buf
, "eap_fast_prov") == 0) {
1380 bss
->eap_fast_prov
= atoi(pos
);
1381 } else if (os_strcmp(buf
, "pac_key_lifetime") == 0) {
1382 bss
->pac_key_lifetime
= atoi(pos
);
1383 } else if (os_strcmp(buf
, "pac_key_refresh_time") == 0) {
1384 bss
->pac_key_refresh_time
= atoi(pos
);
1385 #endif /* EAP_SERVER_FAST */
1386 #ifdef EAP_SERVER_SIM
1387 } else if (os_strcmp(buf
, "eap_sim_db") == 0) {
1388 os_free(bss
->eap_sim_db
);
1389 bss
->eap_sim_db
= os_strdup(pos
);
1390 } else if (os_strcmp(buf
, "eap_sim_aka_result_ind") == 0) {
1391 bss
->eap_sim_aka_result_ind
= atoi(pos
);
1392 #endif /* EAP_SERVER_SIM */
1393 #ifdef EAP_SERVER_TNC
1394 } else if (os_strcmp(buf
, "tnc") == 0) {
1395 bss
->tnc
= atoi(pos
);
1396 #endif /* EAP_SERVER_TNC */
1397 #ifdef EAP_SERVER_PWD
1398 } else if (os_strcmp(buf
, "pwd_group") == 0) {
1399 bss
->pwd_group
= atoi(pos
);
1400 #endif /* EAP_SERVER_PWD */
1401 #endif /* EAP_SERVER */
1402 } else if (os_strcmp(buf
, "eap_message") == 0) {
1404 bss
->eap_req_id_text
= os_strdup(pos
);
1405 if (bss
->eap_req_id_text
== NULL
) {
1406 wpa_printf(MSG_ERROR
, "Line %d: Failed to "
1407 "allocate memory for "
1408 "eap_req_id_text", line
);
1412 bss
->eap_req_id_text_len
=
1413 os_strlen(bss
->eap_req_id_text
);
1414 term
= os_strstr(bss
->eap_req_id_text
, "\\0");
1417 os_memmove(term
, term
+ 1,
1418 bss
->eap_req_id_text_len
-
1419 (term
- bss
->eap_req_id_text
) - 1);
1420 bss
->eap_req_id_text_len
--;
1422 } else if (os_strcmp(buf
, "wep_key_len_broadcast") == 0) {
1423 bss
->default_wep_key_len
= atoi(pos
);
1424 if (bss
->default_wep_key_len
> 13) {
1425 wpa_printf(MSG_ERROR
, "Line %d: invalid WEP "
1426 "key len %lu (= %lu bits)", line
,
1428 bss
->default_wep_key_len
,
1430 bss
->default_wep_key_len
* 8);
1433 } else if (os_strcmp(buf
, "wep_key_len_unicast") == 0) {
1434 bss
->individual_wep_key_len
= atoi(pos
);
1435 if (bss
->individual_wep_key_len
< 0 ||
1436 bss
->individual_wep_key_len
> 13) {
1437 wpa_printf(MSG_ERROR
, "Line %d: invalid WEP "
1438 "key len %d (= %d bits)", line
,
1439 bss
->individual_wep_key_len
,
1440 bss
->individual_wep_key_len
* 8);
1443 } else if (os_strcmp(buf
, "wep_rekey_period") == 0) {
1444 bss
->wep_rekeying_period
= atoi(pos
);
1445 if (bss
->wep_rekeying_period
< 0) {
1446 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1448 line
, bss
->wep_rekeying_period
);
1451 } else if (os_strcmp(buf
, "eap_reauth_period") == 0) {
1452 bss
->eap_reauth_period
= atoi(pos
);
1453 if (bss
->eap_reauth_period
< 0) {
1454 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1456 line
, bss
->eap_reauth_period
);
1459 } else if (os_strcmp(buf
, "eapol_key_index_workaround") == 0) {
1460 bss
->eapol_key_index_workaround
= atoi(pos
);
1462 } else if (os_strcmp(buf
, "iapp_interface") == 0) {
1463 bss
->ieee802_11f
= 1;
1464 os_strlcpy(bss
->iapp_iface
, pos
,
1465 sizeof(bss
->iapp_iface
));
1466 #endif /* CONFIG_IAPP */
1467 } else if (os_strcmp(buf
, "own_ip_addr") == 0) {
1468 if (hostapd_parse_ip_addr(pos
, &bss
->own_ip_addr
)) {
1469 wpa_printf(MSG_ERROR
, "Line %d: invalid IP "
1470 "address '%s'", line
, pos
);
1473 } else if (os_strcmp(buf
, "nas_identifier") == 0) {
1474 bss
->nas_identifier
= os_strdup(pos
);
1475 #ifndef CONFIG_NO_RADIUS
1476 } else if (os_strcmp(buf
, "auth_server_addr") == 0) {
1477 if (hostapd_config_read_radius_addr(
1478 &bss
->radius
->auth_servers
,
1479 &bss
->radius
->num_auth_servers
, pos
, 1812,
1480 &bss
->radius
->auth_server
)) {
1481 wpa_printf(MSG_ERROR
, "Line %d: invalid IP "
1482 "address '%s'", line
, pos
);
1485 } else if (bss
->radius
->auth_server
&&
1486 os_strcmp(buf
, "auth_server_port") == 0) {
1487 bss
->radius
->auth_server
->port
= atoi(pos
);
1488 } else if (bss
->radius
->auth_server
&&
1489 os_strcmp(buf
, "auth_server_shared_secret") == 0) {
1490 int len
= os_strlen(pos
);
1492 /* RFC 2865, Ch. 3 */
1493 wpa_printf(MSG_ERROR
, "Line %d: empty shared "
1494 "secret is not allowed.", line
);
1497 bss
->radius
->auth_server
->shared_secret
=
1498 (u8
*) os_strdup(pos
);
1499 bss
->radius
->auth_server
->shared_secret_len
= len
;
1500 } else if (os_strcmp(buf
, "acct_server_addr") == 0) {
1501 if (hostapd_config_read_radius_addr(
1502 &bss
->radius
->acct_servers
,
1503 &bss
->radius
->num_acct_servers
, pos
, 1813,
1504 &bss
->radius
->acct_server
)) {
1505 wpa_printf(MSG_ERROR
, "Line %d: invalid IP "
1506 "address '%s'", line
, pos
);
1509 } else if (bss
->radius
->acct_server
&&
1510 os_strcmp(buf
, "acct_server_port") == 0) {
1511 bss
->radius
->acct_server
->port
= atoi(pos
);
1512 } else if (bss
->radius
->acct_server
&&
1513 os_strcmp(buf
, "acct_server_shared_secret") == 0) {
1514 int len
= os_strlen(pos
);
1516 /* RFC 2865, Ch. 3 */
1517 wpa_printf(MSG_ERROR
, "Line %d: empty shared "
1518 "secret is not allowed.", line
);
1521 bss
->radius
->acct_server
->shared_secret
=
1522 (u8
*) os_strdup(pos
);
1523 bss
->radius
->acct_server
->shared_secret_len
= len
;
1524 } else if (os_strcmp(buf
, "radius_retry_primary_interval") ==
1526 bss
->radius
->retry_primary_interval
= atoi(pos
);
1527 } else if (os_strcmp(buf
, "radius_acct_interim_interval") == 0)
1529 bss
->acct_interim_interval
= atoi(pos
);
1530 #endif /* CONFIG_NO_RADIUS */
1531 } else if (os_strcmp(buf
, "auth_algs") == 0) {
1532 bss
->auth_algs
= atoi(pos
);
1533 if (bss
->auth_algs
== 0) {
1534 wpa_printf(MSG_ERROR
, "Line %d: no "
1535 "authentication algorithms allowed",
1539 } else if (os_strcmp(buf
, "max_num_sta") == 0) {
1540 bss
->max_num_sta
= atoi(pos
);
1541 if (bss
->max_num_sta
< 0 ||
1542 bss
->max_num_sta
> MAX_STA_COUNT
) {
1543 wpa_printf(MSG_ERROR
, "Line %d: Invalid "
1544 "max_num_sta=%d; allowed range "
1545 "0..%d", line
, bss
->max_num_sta
,
1549 } else if (os_strcmp(buf
, "wpa") == 0) {
1550 bss
->wpa
= atoi(pos
);
1551 } else if (os_strcmp(buf
, "wpa_group_rekey") == 0) {
1552 bss
->wpa_group_rekey
= atoi(pos
);
1553 } else if (os_strcmp(buf
, "wpa_strict_rekey") == 0) {
1554 bss
->wpa_strict_rekey
= atoi(pos
);
1555 } else if (os_strcmp(buf
, "wpa_gmk_rekey") == 0) {
1556 bss
->wpa_gmk_rekey
= atoi(pos
);
1557 } else if (os_strcmp(buf
, "wpa_ptk_rekey") == 0) {
1558 bss
->wpa_ptk_rekey
= atoi(pos
);
1559 } else if (os_strcmp(buf
, "wpa_passphrase") == 0) {
1560 int len
= os_strlen(pos
);
1561 if (len
< 8 || len
> 63) {
1562 wpa_printf(MSG_ERROR
, "Line %d: invalid WPA "
1563 "passphrase length %d (expected "
1564 "8..63)", line
, len
);
1567 os_free(bss
->ssid
.wpa_passphrase
);
1568 bss
->ssid
.wpa_passphrase
= os_strdup(pos
);
1570 } else if (os_strcmp(buf
, "wpa_psk") == 0) {
1571 os_free(bss
->ssid
.wpa_psk
);
1573 os_zalloc(sizeof(struct hostapd_wpa_psk
));
1574 if (bss
->ssid
.wpa_psk
== NULL
)
1576 else if (hexstr2bin(pos
, bss
->ssid
.wpa_psk
->psk
,
1578 pos
[PMK_LEN
* 2] != '\0') {
1579 wpa_printf(MSG_ERROR
, "Line %d: Invalid PSK "
1580 "'%s'.", line
, pos
);
1583 bss
->ssid
.wpa_psk
->group
= 1;
1585 } else if (os_strcmp(buf
, "wpa_psk_file") == 0) {
1586 os_free(bss
->ssid
.wpa_psk_file
);
1587 bss
->ssid
.wpa_psk_file
= os_strdup(pos
);
1588 if (!bss
->ssid
.wpa_psk_file
) {
1589 wpa_printf(MSG_ERROR
, "Line %d: allocation "
1593 } else if (os_strcmp(buf
, "wpa_key_mgmt") == 0) {
1595 hostapd_config_parse_key_mgmt(line
, pos
);
1596 if (bss
->wpa_key_mgmt
== -1)
1598 } else if (os_strcmp(buf
, "wpa_pairwise") == 0) {
1600 hostapd_config_parse_cipher(line
, pos
);
1601 if (bss
->wpa_pairwise
== -1 ||
1602 bss
->wpa_pairwise
== 0)
1604 else if (bss
->wpa_pairwise
&
1605 (WPA_CIPHER_NONE
| WPA_CIPHER_WEP40
|
1606 WPA_CIPHER_WEP104
)) {
1607 wpa_printf(MSG_ERROR
, "Line %d: unsupported "
1608 "pairwise cipher suite '%s'",
1609 bss
->wpa_pairwise
, pos
);
1612 } else if (os_strcmp(buf
, "rsn_pairwise") == 0) {
1614 hostapd_config_parse_cipher(line
, pos
);
1615 if (bss
->rsn_pairwise
== -1 ||
1616 bss
->rsn_pairwise
== 0)
1618 else if (bss
->rsn_pairwise
&
1619 (WPA_CIPHER_NONE
| WPA_CIPHER_WEP40
|
1620 WPA_CIPHER_WEP104
)) {
1621 wpa_printf(MSG_ERROR
, "Line %d: unsupported "
1622 "pairwise cipher suite '%s'",
1623 bss
->rsn_pairwise
, pos
);
1626 #ifdef CONFIG_RSN_PREAUTH
1627 } else if (os_strcmp(buf
, "rsn_preauth") == 0) {
1628 bss
->rsn_preauth
= atoi(pos
);
1629 } else if (os_strcmp(buf
, "rsn_preauth_interfaces") == 0) {
1630 bss
->rsn_preauth_interfaces
= os_strdup(pos
);
1631 #endif /* CONFIG_RSN_PREAUTH */
1632 #ifdef CONFIG_PEERKEY
1633 } else if (os_strcmp(buf
, "peerkey") == 0) {
1634 bss
->peerkey
= atoi(pos
);
1635 #endif /* CONFIG_PEERKEY */
1636 #ifdef CONFIG_IEEE80211R
1637 } else if (os_strcmp(buf
, "mobility_domain") == 0) {
1638 if (os_strlen(pos
) != 2 * MOBILITY_DOMAIN_ID_LEN
||
1639 hexstr2bin(pos
, bss
->mobility_domain
,
1640 MOBILITY_DOMAIN_ID_LEN
) != 0) {
1641 wpa_printf(MSG_DEBUG
, "Line %d: Invalid "
1642 "mobility_domain '%s'", line
, pos
);
1646 } else if (os_strcmp(buf
, "r1_key_holder") == 0) {
1647 if (os_strlen(pos
) != 2 * FT_R1KH_ID_LEN
||
1648 hexstr2bin(pos
, bss
->r1_key_holder
,
1649 FT_R1KH_ID_LEN
) != 0) {
1650 wpa_printf(MSG_DEBUG
, "Line %d: Invalid "
1651 "r1_key_holder '%s'", line
, pos
);
1655 } else if (os_strcmp(buf
, "r0_key_lifetime") == 0) {
1656 bss
->r0_key_lifetime
= atoi(pos
);
1657 } else if (os_strcmp(buf
, "reassociation_deadline") == 0) {
1658 bss
->reassociation_deadline
= atoi(pos
);
1659 } else if (os_strcmp(buf
, "r0kh") == 0) {
1660 if (add_r0kh(bss
, pos
) < 0) {
1661 wpa_printf(MSG_DEBUG
, "Line %d: Invalid "
1662 "r0kh '%s'", line
, pos
);
1666 } else if (os_strcmp(buf
, "r1kh") == 0) {
1667 if (add_r1kh(bss
, pos
) < 0) {
1668 wpa_printf(MSG_DEBUG
, "Line %d: Invalid "
1669 "r1kh '%s'", line
, pos
);
1673 } else if (os_strcmp(buf
, "pmk_r1_push") == 0) {
1674 bss
->pmk_r1_push
= atoi(pos
);
1675 #endif /* CONFIG_IEEE80211R */
1676 #ifndef CONFIG_NO_CTRL_IFACE
1677 } else if (os_strcmp(buf
, "ctrl_interface") == 0) {
1678 os_free(bss
->ctrl_interface
);
1679 bss
->ctrl_interface
= os_strdup(pos
);
1680 } else if (os_strcmp(buf
, "ctrl_interface_group") == 0) {
1681 #ifndef CONFIG_NATIVE_WINDOWS
1684 const char *group
= pos
;
1686 grp
= getgrnam(group
);
1688 bss
->ctrl_interface_gid
= grp
->gr_gid
;
1689 bss
->ctrl_interface_gid_set
= 1;
1690 wpa_printf(MSG_DEBUG
, "ctrl_interface_group=%d"
1691 " (from group name '%s')",
1692 bss
->ctrl_interface_gid
, group
);
1696 /* Group name not found - try to parse this as gid */
1697 bss
->ctrl_interface_gid
= strtol(group
, &endp
, 10);
1698 if (*group
== '\0' || *endp
!= '\0') {
1699 wpa_printf(MSG_DEBUG
, "Line %d: Invalid group "
1700 "'%s'", line
, group
);
1704 bss
->ctrl_interface_gid_set
= 1;
1705 wpa_printf(MSG_DEBUG
, "ctrl_interface_group=%d",
1706 bss
->ctrl_interface_gid
);
1707 #endif /* CONFIG_NATIVE_WINDOWS */
1708 #endif /* CONFIG_NO_CTRL_IFACE */
1709 #ifdef RADIUS_SERVER
1710 } else if (os_strcmp(buf
, "radius_server_clients") == 0) {
1711 os_free(bss
->radius_server_clients
);
1712 bss
->radius_server_clients
= os_strdup(pos
);
1713 } else if (os_strcmp(buf
, "radius_server_auth_port") == 0) {
1714 bss
->radius_server_auth_port
= atoi(pos
);
1715 } else if (os_strcmp(buf
, "radius_server_ipv6") == 0) {
1716 bss
->radius_server_ipv6
= atoi(pos
);
1717 #endif /* RADIUS_SERVER */
1718 } else if (os_strcmp(buf
, "test_socket") == 0) {
1719 os_free(bss
->test_socket
);
1720 bss
->test_socket
= os_strdup(pos
);
1721 } else if (os_strcmp(buf
, "use_pae_group_addr") == 0) {
1722 bss
->use_pae_group_addr
= atoi(pos
);
1723 } else if (os_strcmp(buf
, "hw_mode") == 0) {
1724 if (os_strcmp(pos
, "a") == 0)
1725 conf
->hw_mode
= HOSTAPD_MODE_IEEE80211A
;
1726 else if (os_strcmp(pos
, "b") == 0)
1727 conf
->hw_mode
= HOSTAPD_MODE_IEEE80211B
;
1728 else if (os_strcmp(pos
, "g") == 0)
1729 conf
->hw_mode
= HOSTAPD_MODE_IEEE80211G
;
1731 wpa_printf(MSG_ERROR
, "Line %d: unknown "
1732 "hw_mode '%s'", line
, pos
);
1735 } else if (os_strcmp(buf
, "channel") == 0) {
1736 conf
->channel
= atoi(pos
);
1737 } else if (os_strcmp(buf
, "beacon_int") == 0) {
1738 int val
= atoi(pos
);
1739 /* MIB defines range as 1..65535, but very small values
1740 * cause problems with the current implementation.
1741 * Since it is unlikely that this small numbers are
1742 * useful in real life scenarios, do not allow beacon
1743 * period to be set below 15 TU. */
1744 if (val
< 15 || val
> 65535) {
1745 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1746 "beacon_int %d (expected "
1747 "15..65535)", line
, val
);
1750 conf
->beacon_int
= val
;
1751 } else if (os_strcmp(buf
, "dtim_period") == 0) {
1752 bss
->dtim_period
= atoi(pos
);
1753 if (bss
->dtim_period
< 1 || bss
->dtim_period
> 255) {
1754 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1756 line
, bss
->dtim_period
);
1759 } else if (os_strcmp(buf
, "rts_threshold") == 0) {
1760 conf
->rts_threshold
= atoi(pos
);
1761 if (conf
->rts_threshold
< 0 ||
1762 conf
->rts_threshold
> 2347) {
1763 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1765 line
, conf
->rts_threshold
);
1768 } else if (os_strcmp(buf
, "fragm_threshold") == 0) {
1769 conf
->fragm_threshold
= atoi(pos
);
1770 if (conf
->fragm_threshold
< 256 ||
1771 conf
->fragm_threshold
> 2346) {
1772 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1773 "fragm_threshold %d",
1774 line
, conf
->fragm_threshold
);
1777 } else if (os_strcmp(buf
, "send_probe_response") == 0) {
1778 int val
= atoi(pos
);
1779 if (val
!= 0 && val
!= 1) {
1780 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1781 "send_probe_response %d (expected "
1782 "0 or 1)", line
, val
);
1784 conf
->send_probe_response
= val
;
1785 } else if (os_strcmp(buf
, "supported_rates") == 0) {
1786 if (hostapd_parse_rates(&conf
->supported_rates
, pos
)) {
1787 wpa_printf(MSG_ERROR
, "Line %d: invalid rate "
1791 } else if (os_strcmp(buf
, "basic_rates") == 0) {
1792 if (hostapd_parse_rates(&conf
->basic_rates
, pos
)) {
1793 wpa_printf(MSG_ERROR
, "Line %d: invalid rate "
1797 } else if (os_strcmp(buf
, "preamble") == 0) {
1799 conf
->preamble
= SHORT_PREAMBLE
;
1801 conf
->preamble
= LONG_PREAMBLE
;
1802 } else if (os_strcmp(buf
, "ignore_broadcast_ssid") == 0) {
1803 bss
->ignore_broadcast_ssid
= atoi(pos
);
1804 } else if (os_strcmp(buf
, "wep_default_key") == 0) {
1805 bss
->ssid
.wep
.idx
= atoi(pos
);
1806 if (bss
->ssid
.wep
.idx
> 3) {
1807 wpa_printf(MSG_ERROR
, "Invalid "
1808 "wep_default_key index %d",
1812 } else if (os_strcmp(buf
, "wep_key0") == 0 ||
1813 os_strcmp(buf
, "wep_key1") == 0 ||
1814 os_strcmp(buf
, "wep_key2") == 0 ||
1815 os_strcmp(buf
, "wep_key3") == 0) {
1816 if (hostapd_config_read_wep(&bss
->ssid
.wep
,
1817 buf
[7] - '0', pos
)) {
1818 wpa_printf(MSG_ERROR
, "Line %d: invalid WEP "
1819 "key '%s'", line
, buf
);
1822 #ifndef CONFIG_NO_VLAN
1823 } else if (os_strcmp(buf
, "dynamic_vlan") == 0) {
1824 bss
->ssid
.dynamic_vlan
= atoi(pos
);
1825 } else if (os_strcmp(buf
, "vlan_file") == 0) {
1826 if (hostapd_config_read_vlan_file(bss
, pos
)) {
1827 wpa_printf(MSG_ERROR
, "Line %d: failed to "
1828 "read VLAN file '%s'", line
, pos
);
1831 #ifdef CONFIG_FULL_DYNAMIC_VLAN
1832 } else if (os_strcmp(buf
, "vlan_tagged_interface") == 0) {
1833 bss
->ssid
.vlan_tagged_interface
= os_strdup(pos
);
1834 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
1835 #endif /* CONFIG_NO_VLAN */
1836 } else if (os_strcmp(buf
, "ap_table_max_size") == 0) {
1837 conf
->ap_table_max_size
= atoi(pos
);
1838 } else if (os_strcmp(buf
, "ap_table_expiration_time") == 0) {
1839 conf
->ap_table_expiration_time
= atoi(pos
);
1840 } else if (os_strncmp(buf
, "tx_queue_", 9) == 0) {
1841 if (hostapd_config_tx_queue(conf
, buf
, pos
)) {
1842 wpa_printf(MSG_ERROR
, "Line %d: invalid TX "
1843 "queue item", line
);
1846 } else if (os_strcmp(buf
, "wme_enabled") == 0 ||
1847 os_strcmp(buf
, "wmm_enabled") == 0) {
1848 bss
->wmm_enabled
= atoi(pos
);
1849 } else if (os_strcmp(buf
, "uapsd_advertisement_enabled") == 0) {
1850 bss
->wmm_uapsd
= atoi(pos
);
1851 } else if (os_strncmp(buf
, "wme_ac_", 7) == 0 ||
1852 os_strncmp(buf
, "wmm_ac_", 7) == 0) {
1853 if (hostapd_config_wmm_ac(conf
, buf
, pos
)) {
1854 wpa_printf(MSG_ERROR
, "Line %d: invalid WMM "
1858 } else if (os_strcmp(buf
, "bss") == 0) {
1859 if (hostapd_config_bss(conf
, pos
)) {
1860 wpa_printf(MSG_ERROR
, "Line %d: invalid bss "
1864 } else if (os_strcmp(buf
, "bssid") == 0) {
1865 if (hwaddr_aton(pos
, bss
->bssid
)) {
1866 wpa_printf(MSG_ERROR
, "Line %d: invalid bssid "
1870 #ifdef CONFIG_IEEE80211W
1871 } else if (os_strcmp(buf
, "ieee80211w") == 0) {
1872 bss
->ieee80211w
= atoi(pos
);
1873 } else if (os_strcmp(buf
, "assoc_sa_query_max_timeout") == 0) {
1874 bss
->assoc_sa_query_max_timeout
= atoi(pos
);
1875 if (bss
->assoc_sa_query_max_timeout
== 0) {
1876 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1877 "assoc_sa_query_max_timeout", line
);
1880 } else if (os_strcmp(buf
, "assoc_sa_query_retry_timeout") == 0)
1882 bss
->assoc_sa_query_retry_timeout
= atoi(pos
);
1883 if (bss
->assoc_sa_query_retry_timeout
== 0) {
1884 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1885 "assoc_sa_query_retry_timeout",
1889 #endif /* CONFIG_IEEE80211W */
1890 #ifdef CONFIG_IEEE80211N
1891 } else if (os_strcmp(buf
, "ieee80211n") == 0) {
1892 conf
->ieee80211n
= atoi(pos
);
1893 } else if (os_strcmp(buf
, "ht_capab") == 0) {
1894 if (hostapd_config_ht_capab(conf
, pos
) < 0) {
1895 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1899 #endif /* CONFIG_IEEE80211N */
1900 } else if (os_strcmp(buf
, "max_listen_interval") == 0) {
1901 bss
->max_listen_interval
= atoi(pos
);
1902 } else if (os_strcmp(buf
, "okc") == 0) {
1903 bss
->okc
= atoi(pos
);
1905 } else if (os_strcmp(buf
, "wps_state") == 0) {
1906 bss
->wps_state
= atoi(pos
);
1907 if (bss
->wps_state
< 0 || bss
->wps_state
> 2) {
1908 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1912 } else if (os_strcmp(buf
, "ap_setup_locked") == 0) {
1913 bss
->ap_setup_locked
= atoi(pos
);
1914 } else if (os_strcmp(buf
, "uuid") == 0) {
1915 if (uuid_str2bin(pos
, bss
->uuid
)) {
1916 wpa_printf(MSG_ERROR
, "Line %d: invalid UUID",
1920 } else if (os_strcmp(buf
, "wps_pin_requests") == 0) {
1921 os_free(bss
->wps_pin_requests
);
1922 bss
->wps_pin_requests
= os_strdup(pos
);
1923 } else if (os_strcmp(buf
, "device_name") == 0) {
1924 if (os_strlen(pos
) > 32) {
1925 wpa_printf(MSG_ERROR
, "Line %d: Too long "
1926 "device_name", line
);
1929 os_free(bss
->device_name
);
1930 bss
->device_name
= os_strdup(pos
);
1931 } else if (os_strcmp(buf
, "manufacturer") == 0) {
1932 if (os_strlen(pos
) > 64) {
1933 wpa_printf(MSG_ERROR
, "Line %d: Too long "
1934 "manufacturer", line
);
1937 os_free(bss
->manufacturer
);
1938 bss
->manufacturer
= os_strdup(pos
);
1939 } else if (os_strcmp(buf
, "model_name") == 0) {
1940 if (os_strlen(pos
) > 32) {
1941 wpa_printf(MSG_ERROR
, "Line %d: Too long "
1942 "model_name", line
);
1945 os_free(bss
->model_name
);
1946 bss
->model_name
= os_strdup(pos
);
1947 } else if (os_strcmp(buf
, "model_number") == 0) {
1948 if (os_strlen(pos
) > 32) {
1949 wpa_printf(MSG_ERROR
, "Line %d: Too long "
1950 "model_number", line
);
1953 os_free(bss
->model_number
);
1954 bss
->model_number
= os_strdup(pos
);
1955 } else if (os_strcmp(buf
, "serial_number") == 0) {
1956 if (os_strlen(pos
) > 32) {
1957 wpa_printf(MSG_ERROR
, "Line %d: Too long "
1958 "serial_number", line
);
1961 os_free(bss
->serial_number
);
1962 bss
->serial_number
= os_strdup(pos
);
1963 } else if (os_strcmp(buf
, "device_type") == 0) {
1964 os_free(bss
->device_type
);
1965 bss
->device_type
= os_strdup(pos
);
1966 } else if (os_strcmp(buf
, "config_methods") == 0) {
1967 os_free(bss
->config_methods
);
1968 bss
->config_methods
= os_strdup(pos
);
1969 } else if (os_strcmp(buf
, "os_version") == 0) {
1970 if (hexstr2bin(pos
, bss
->os_version
, 4)) {
1971 wpa_printf(MSG_ERROR
, "Line %d: invalid "
1972 "os_version", line
);
1975 } else if (os_strcmp(buf
, "ap_pin") == 0) {
1976 os_free(bss
->ap_pin
);
1977 bss
->ap_pin
= os_strdup(pos
);
1978 } else if (os_strcmp(buf
, "skip_cred_build") == 0) {
1979 bss
->skip_cred_build
= atoi(pos
);
1980 } else if (os_strcmp(buf
, "extra_cred") == 0) {
1981 os_free(bss
->extra_cred
);
1983 (u8
*) os_readfile(pos
, &bss
->extra_cred_len
);
1984 if (bss
->extra_cred
== NULL
) {
1985 wpa_printf(MSG_ERROR
, "Line %d: could not "
1986 "read Credentials from '%s'",
1990 } else if (os_strcmp(buf
, "wps_cred_processing") == 0) {
1991 bss
->wps_cred_processing
= atoi(pos
);
1992 } else if (os_strcmp(buf
, "ap_settings") == 0) {
1993 os_free(bss
->ap_settings
);
1995 (u8
*) os_readfile(pos
, &bss
->ap_settings_len
);
1996 if (bss
->ap_settings
== NULL
) {
1997 wpa_printf(MSG_ERROR
, "Line %d: could not "
1998 "read AP Settings from '%s'",
2002 } else if (os_strcmp(buf
, "upnp_iface") == 0) {
2003 bss
->upnp_iface
= os_strdup(pos
);
2004 } else if (os_strcmp(buf
, "friendly_name") == 0) {
2005 os_free(bss
->friendly_name
);
2006 bss
->friendly_name
= os_strdup(pos
);
2007 } else if (os_strcmp(buf
, "manufacturer_url") == 0) {
2008 os_free(bss
->manufacturer_url
);
2009 bss
->manufacturer_url
= os_strdup(pos
);
2010 } else if (os_strcmp(buf
, "model_description") == 0) {
2011 os_free(bss
->model_description
);
2012 bss
->model_description
= os_strdup(pos
);
2013 } else if (os_strcmp(buf
, "model_url") == 0) {
2014 os_free(bss
->model_url
);
2015 bss
->model_url
= os_strdup(pos
);
2016 } else if (os_strcmp(buf
, "upc") == 0) {
2018 bss
->upc
= os_strdup(pos
);
2019 #endif /* CONFIG_WPS */
2020 #ifdef CONFIG_P2P_MANAGER
2021 } else if (os_strcmp(buf
, "manage_p2p") == 0) {
2022 int manage
= atoi(pos
);
2024 bss
->p2p
|= P2P_MANAGE
;
2026 bss
->p2p
&= ~P2P_MANAGE
;
2027 } else if (os_strcmp(buf
, "allow_cross_connection") == 0) {
2029 bss
->p2p
|= P2P_ALLOW_CROSS_CONNECTION
;
2031 bss
->p2p
&= ~P2P_ALLOW_CROSS_CONNECTION
;
2032 #endif /* CONFIG_P2P_MANAGER */
2033 } else if (os_strcmp(buf
, "disassoc_low_ack") == 0) {
2034 bss
->disassoc_low_ack
= atoi(pos
);
2035 } else if (os_strcmp(buf
, "tdls_prohibit") == 0) {
2036 int val
= atoi(pos
);
2038 bss
->tdls
|= TDLS_PROHIBIT
;
2040 bss
->tdls
&= ~TDLS_PROHIBIT
;
2041 } else if (os_strcmp(buf
, "tdls_prohibit_chan_switch") == 0) {
2042 int val
= atoi(pos
);
2044 bss
->tdls
|= TDLS_PROHIBIT_CHAN_SWITCH
;
2046 bss
->tdls
&= ~TDLS_PROHIBIT_CHAN_SWITCH
;
2048 wpa_printf(MSG_ERROR
, "Line %d: unknown configuration "
2049 "item '%s'", line
, buf
);
2056 for (i
= 0; i
< conf
->num_bss
; i
++) {
2057 bss
= &conf
->bss
[i
];
2059 if (bss
->individual_wep_key_len
== 0) {
2060 /* individual keys are not use; can use key idx0 for
2062 bss
->broadcast_key_idx_min
= 0;
2065 /* Select group cipher based on the enabled pairwise cipher
2069 pairwise
|= bss
->wpa_pairwise
;
2071 if (bss
->rsn_pairwise
== 0)
2072 bss
->rsn_pairwise
= bss
->wpa_pairwise
;
2073 pairwise
|= bss
->rsn_pairwise
;
2075 if (pairwise
& WPA_CIPHER_TKIP
)
2076 bss
->wpa_group
= WPA_CIPHER_TKIP
;
2078 bss
->wpa_group
= WPA_CIPHER_CCMP
;
2080 bss
->radius
->auth_server
= bss
->radius
->auth_servers
;
2081 bss
->radius
->acct_server
= bss
->radius
->acct_servers
;
2083 if (bss
->wpa
&& bss
->ieee802_1x
) {
2084 bss
->ssid
.security_policy
= SECURITY_WPA
;
2085 } else if (bss
->wpa
) {
2086 bss
->ssid
.security_policy
= SECURITY_WPA_PSK
;
2087 } else if (bss
->ieee802_1x
) {
2088 bss
->ssid
.security_policy
= SECURITY_IEEE_802_1X
;
2089 bss
->ssid
.wep
.default_len
= bss
->default_wep_key_len
;
2090 } else if (bss
->ssid
.wep
.keys_set
)
2091 bss
->ssid
.security_policy
= SECURITY_STATIC_WEP
;
2093 bss
->ssid
.security_policy
= SECURITY_PLAINTEXT
;
2096 if (hostapd_config_check(conf
))
2099 #ifndef WPA_IGNORE_CONFIG_ERRORS
2101 wpa_printf(MSG_ERROR
, "%d errors found in configuration file "
2102 "'%s'", errors
, fname
);
2103 hostapd_config_free(conf
);
2106 #endif /* WPA_IGNORE_CONFIG_ERRORS */