ap_config.h revision 281806
1101704Smjacob/*
2139749Simp * hostapd / Configuration definitions and helpers functions
3101704Smjacob * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
4101704Smjacob *
5101704Smjacob * This software may be distributed under the terms of the BSD license.
6101704Smjacob * See README for more details.
7101704Smjacob */
8101704Smjacob
9101704Smjacob#ifndef HOSTAPD_CONFIG_H
10101704Smjacob#define HOSTAPD_CONFIG_H
11101704Smjacob
12101704Smjacob#include "common/defs.h"
13101704Smjacob#include "ip_addr.h"
14101704Smjacob#include "common/wpa_common.h"
15101704Smjacob#include "common/ieee802_11_common.h"
16101704Smjacob#include "wps/wps.h"
17101704Smjacob
18101704Smjacob/**
19101704Smjacob * mesh_conf - local MBSS state and settings
20101704Smjacob */
21101704Smjacobstruct mesh_conf {
22101704Smjacob	u8 meshid[32];
23101704Smjacob	u8 meshid_len;
24101704Smjacob	/* Active Path Selection Protocol Identifier */
25101704Smjacob	u8 mesh_pp_id;
26101704Smjacob	/* Active Path Selection Metric Identifier */
27101704Smjacob	u8 mesh_pm_id;
28147883Sscottl	/* Congestion Control Mode Identifier */
29147883Sscottl	u8 mesh_cc_id;
30101704Smjacob	/* Synchronization Protocol Identifier */
31101704Smjacob	u8 mesh_sp_id;
32147883Sscottl	/* Authentication Protocol Identifier */
33147883Sscottl	u8 mesh_auth_id;
34147883Sscottl	u8 *ies;
35147883Sscottl	int ie_len;
36147883Sscottl#define MESH_CONF_SEC_NONE BIT(0)
37147883Sscottl#define MESH_CONF_SEC_AUTH BIT(1)
38147883Sscottl#define MESH_CONF_SEC_AMPE BIT(2)
39147883Sscottl	unsigned int security;
40147883Sscottl	int dot11MeshMaxRetries;
41147883Sscottl	int dot11MeshRetryTimeout; /* msec */
42147883Sscottl	int dot11MeshConfirmTimeout; /* msec */
43147883Sscottl	int dot11MeshHoldingTimeout; /* msec */
44147883Sscottl};
45147883Sscottl
46147883Sscottl#define MAX_STA_COUNT 2007
47148679Sgibbs#define MAX_VLAN_ID 4094
48148679Sgibbs
49148679Sgibbstypedef u8 macaddr[ETH_ALEN];
50147883Sscottl
51147883Sscottlstruct mac_acl_entry {
52147883Sscottl	macaddr addr;
53147883Sscottl	int vlan_id;
54147883Sscottl};
55147883Sscottl
56147883Sscottlstruct hostapd_radius_servers;
57147883Sscottlstruct ft_remote_r0kh;
58147883Sscottlstruct ft_remote_r1kh;
59147883Sscottl
60147883Sscottl#define HOSTAPD_MAX_SSID_LEN 32
61147883Sscottl
62101704Smjacob#define NUM_WEP_KEYS 4
63101704Smjacobstruct hostapd_wep_keys {
64101704Smjacob	u8 idx;
65101704Smjacob	u8 *key[NUM_WEP_KEYS];
66147883Sscottl	size_t len[NUM_WEP_KEYS];
67147883Sscottl	int keys_set;
68147883Sscottl	size_t default_len; /* key length used for dynamic key generation */
69147883Sscottl};
70147883Sscottl
71147883Sscottltypedef enum hostap_security_policy {
72147883Sscottl	SECURITY_PLAINTEXT = 0,
73147883Sscottl	SECURITY_STATIC_WEP = 1,
74147883Sscottl	SECURITY_IEEE_802_1X = 2,
75147883Sscottl	SECURITY_WPA_PSK = 3,
76147883Sscottl	SECURITY_WPA = 4,
77147883Sscottl	SECURITY_OSEN = 5
78147883Sscottl} secpolicy;
79147883Sscottl
80147883Sscottlstruct hostapd_ssid {
81147883Sscottl	u8 ssid[HOSTAPD_MAX_SSID_LEN];
82147883Sscottl	size_t ssid_len;
83147883Sscottl	unsigned int ssid_set:1;
84147883Sscottl	unsigned int utf8_ssid:1;
85147883Sscottl	unsigned int wpa_passphrase_set:1;
86147883Sscottl	unsigned int wpa_psk_set:1;
87147883Sscottl
88147883Sscottl	char vlan[IFNAMSIZ + 1];
89147883Sscottl	secpolicy security_policy;
90147883Sscottl
91147883Sscottl	struct hostapd_wpa_psk *wpa_psk;
92147883Sscottl	char *wpa_passphrase;
93147883Sscottl	char *wpa_psk_file;
94147883Sscottl
95147883Sscottl	struct hostapd_wep_keys wep;
96147883Sscottl
97147883Sscottl#define DYNAMIC_VLAN_DISABLED 0
98147883Sscottl#define DYNAMIC_VLAN_OPTIONAL 1
99147883Sscottl#define DYNAMIC_VLAN_REQUIRED 2
100147883Sscottl	int dynamic_vlan;
101147883Sscottl#define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0
102147883Sscottl#define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1
103147883Sscottl#define DYNAMIC_VLAN_NAMING_END 2
104147883Sscottl	int vlan_naming;
105147883Sscottl#ifdef CONFIG_FULL_DYNAMIC_VLAN
106147883Sscottl	char *vlan_tagged_interface;
107147883Sscottl#endif /* CONFIG_FULL_DYNAMIC_VLAN */
108147883Sscottl};
109147883Sscottl
110147883Sscottl
111147883Sscottl#define VLAN_ID_WILDCARD -1
112101704Smjacob
113101704Smjacobstruct hostapd_vlan {
114101704Smjacob	struct hostapd_vlan *next;
115147883Sscottl	int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
116101704Smjacob	char ifname[IFNAMSIZ + 1];
117147883Sscottl	int dynamic_vlan;
118147883Sscottl#ifdef CONFIG_FULL_DYNAMIC_VLAN
119147883Sscottl
120147883Sscottl#define DVLAN_CLEAN_BR 	0x1
121101704Smjacob#define DVLAN_CLEAN_VLAN	0x2
122147883Sscottl#define DVLAN_CLEAN_VLAN_PORT	0x4
123147883Sscottl#define DVLAN_CLEAN_WLAN_PORT	0x8
124147883Sscottl	int clean;
125147883Sscottl#endif /* CONFIG_FULL_DYNAMIC_VLAN */
126147883Sscottl};
127147883Sscottl
128147883Sscottl#define PMK_LEN 32
129147883Sscottlstruct hostapd_sta_wpa_psk_short {
130147883Sscottl	struct hostapd_sta_wpa_psk_short *next;
131147883Sscottl	u8 psk[PMK_LEN];
132147883Sscottl};
133147883Sscottl
134147883Sscottlstruct hostapd_wpa_psk {
135147883Sscottl	struct hostapd_wpa_psk *next;
136147883Sscottl	int group;
137147883Sscottl	u8 psk[PMK_LEN];
138147883Sscottl	u8 addr[ETH_ALEN];
139147883Sscottl	u8 p2p_dev_addr[ETH_ALEN];
140147883Sscottl};
141147883Sscottl
142147883Sscottlstruct hostapd_eap_user {
143147883Sscottl	struct hostapd_eap_user *next;
144147883Sscottl	u8 *identity;
145147883Sscottl	size_t identity_len;
146147883Sscottl	struct {
147147883Sscottl		int vendor;
148147883Sscottl		u32 method;
149101704Smjacob	} methods[EAP_MAX_METHODS];
150101704Smjacob	u8 *password;
151147883Sscottl	size_t password_len;
152101704Smjacob	int phase2;
153147883Sscottl	int force_version;
154147883Sscottl	unsigned int wildcard_prefix:1;
155101704Smjacob	unsigned int password_hash:1; /* whether password is hashed with
156147883Sscottl				       * nt_password_hash() */
157147883Sscottl	unsigned int remediation:1;
158101704Smjacob	unsigned int macacl:1;
159147883Sscottl	int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
160147883Sscottl	struct hostapd_radius_attr *accept_attr;
161147883Sscottl};
162147883Sscottl
163147883Sscottlstruct hostapd_radius_attr {
164147883Sscottl	u8 type;
165147883Sscottl	struct wpabuf *val;
166147883Sscottl	struct hostapd_radius_attr *next;
167147883Sscottl};
168147883Sscottl
169147883Sscottl
170147883Sscottl#define NUM_TX_QUEUES 4
171147883Sscottl
172147883Sscottlstruct hostapd_tx_queue_params {
173147883Sscottl	int aifs;
174147883Sscottl	int cwmin;
175147883Sscottl	int cwmax;
176147883Sscottl	int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
177147883Sscottl};
178147883Sscottl
179147883Sscottl
180147883Sscottl#define MAX_ROAMING_CONSORTIUM_LEN 15
181147883Sscottl
182147883Sscottlstruct hostapd_roaming_consortium {
183147883Sscottl	u8 len;
184147883Sscottl	u8 oi[MAX_ROAMING_CONSORTIUM_LEN];
185147883Sscottl};
186147883Sscottl
187147883Sscottlstruct hostapd_lang_string {
188147883Sscottl	u8 lang[3];
189147883Sscottl	u8 name_len;
190147883Sscottl	u8 name[252];
191147883Sscottl};
192147883Sscottl
193147883Sscottl#define MAX_NAI_REALMS 10
194147883Sscottl#define MAX_NAI_REALMLEN 255
195147883Sscottl#define MAX_NAI_EAP_METHODS 5
196147883Sscottl#define MAX_NAI_AUTH_TYPES 4
197147883Sscottlstruct hostapd_nai_realm_data {
198147883Sscottl	u8 encoding;
199147883Sscottl	char realm_buf[MAX_NAI_REALMLEN + 1];
200147883Sscottl	char *realm[MAX_NAI_REALMS];
201147883Sscottl	u8 eap_method_count;
202147883Sscottl	struct hostapd_nai_realm_eap {
203147883Sscottl		u8 eap_method;
204147883Sscottl		u8 num_auths;
205147883Sscottl		u8 auth_id[MAX_NAI_AUTH_TYPES];
206147883Sscottl		u8 auth_val[MAX_NAI_AUTH_TYPES];
207147883Sscottl	} eap_method[MAX_NAI_EAP_METHODS];
208147883Sscottl};
209147883Sscottl
210147883Sscottl/**
211147883Sscottl * struct hostapd_bss_config - Per-BSS configuration
212147883Sscottl */
213147883Sscottlstruct hostapd_bss_config {
214147883Sscottl	char iface[IFNAMSIZ + 1];
215147883Sscottl	char bridge[IFNAMSIZ + 1];
216147883Sscottl	char vlan_bridge[IFNAMSIZ + 1];
217147883Sscottl	char wds_bridge[IFNAMSIZ + 1];
218147883Sscottl
219147883Sscottl	enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
220147883Sscottl
221147883Sscottl	unsigned int logger_syslog; /* module bitfield */
222147883Sscottl	unsigned int logger_stdout; /* module bitfield */
223147883Sscottl
224147883Sscottl	int max_num_sta; /* maximum number of STAs in station table */
225147883Sscottl
226147883Sscottl	int dtim_period;
227147883Sscottl	int bss_load_update_period;
228147883Sscottl
229147883Sscottl	int ieee802_1x; /* use IEEE 802.1X */
230147883Sscottl	int eapol_version;
231147883Sscottl	int eap_server; /* Use internal EAP server instead of external
232147883Sscottl			 * RADIUS server */
233147883Sscottl	struct hostapd_eap_user *eap_user;
234147883Sscottl	char *eap_user_sqlite;
235147883Sscottl	char *eap_sim_db;
236147883Sscottl	int eap_server_erp; /* Whether ERP is enabled on internal EAP server */
237147883Sscottl	struct hostapd_ip_addr own_ip_addr;
238147883Sscottl	char *nas_identifier;
239147883Sscottl	struct hostapd_radius_servers *radius;
240147883Sscottl	int acct_interim_interval;
241147883Sscottl	int radius_request_cui;
242147883Sscottl	struct hostapd_radius_attr *radius_auth_req_attr;
243147883Sscottl	struct hostapd_radius_attr *radius_acct_req_attr;
244147883Sscottl	int radius_das_port;
245147883Sscottl	unsigned int radius_das_time_window;
246147883Sscottl	int radius_das_require_event_timestamp;
247147883Sscottl	struct hostapd_ip_addr radius_das_client_addr;
248147883Sscottl	u8 *radius_das_shared_secret;
249147883Sscottl	size_t radius_das_shared_secret_len;
250147883Sscottl
251147883Sscottl	struct hostapd_ssid ssid;
252147883Sscottl
253101704Smjacob	char *eap_req_id_text; /* optional displayable message sent with
254147883Sscottl				* EAP Request-Identity */
255147883Sscottl	size_t eap_req_id_text_len;
256147883Sscottl	int eapol_key_index_workaround;
257147883Sscottl
258147883Sscottl	size_t default_wep_key_len;
259147883Sscottl	int individual_wep_key_len;
260147883Sscottl	int wep_rekeying_period;
261147883Sscottl	int broadcast_key_idx_min, broadcast_key_idx_max;
262147883Sscottl	int eap_reauth_period;
263147883Sscottl	int erp_send_reauth_start;
264147883Sscottl	char *erp_domain;
265147883Sscottl
266147883Sscottl	int ieee802_11f; /* use IEEE 802.11f (IAPP) */
267147883Sscottl	char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
268147883Sscottl					* frames */
269147883Sscottl
270147883Sscottl	enum {
271147883Sscottl		ACCEPT_UNLESS_DENIED = 0,
272101704Smjacob		DENY_UNLESS_ACCEPTED = 1,
273147883Sscottl		USE_EXTERNAL_RADIUS_AUTH = 2
274147883Sscottl	} macaddr_acl;
275147883Sscottl	struct mac_acl_entry *accept_mac;
276147883Sscottl	int num_accept_mac;
277147883Sscottl	struct mac_acl_entry *deny_mac;
278147883Sscottl	int num_deny_mac;
279147883Sscottl	int wds_sta;
280147883Sscottl	int isolate;
281147883Sscottl	int start_disabled;
282101704Smjacob
283147883Sscottl	int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
284147883Sscottl			* algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
285147883Sscottl
286147883Sscottl	int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
287147883Sscottl	int wpa_key_mgmt;
288147883Sscottl#ifdef CONFIG_IEEE80211W
289101704Smjacob	enum mfp_options ieee80211w;
290147883Sscottl	int group_mgmt_cipher;
291147883Sscottl	/* dot11AssociationSAQueryMaximumTimeout (in TUs) */
292147883Sscottl	unsigned int assoc_sa_query_max_timeout;
293147883Sscottl	/* dot11AssociationSAQueryRetryTimeout (in TUs) */
294101704Smjacob	int assoc_sa_query_retry_timeout;
295101704Smjacob#endif /* CONFIG_IEEE80211W */
296147883Sscottl	enum {
297147883Sscottl		PSK_RADIUS_IGNORED = 0,
298147883Sscottl		PSK_RADIUS_ACCEPTED = 1,
299147883Sscottl		PSK_RADIUS_REQUIRED = 2
300147883Sscottl	} wpa_psk_radius;
301147883Sscottl	int wpa_pairwise;
302147883Sscottl	int wpa_group;
303147883Sscottl	int wpa_group_rekey;
304147883Sscottl	int wpa_strict_rekey;
305147883Sscottl	int wpa_gmk_rekey;
306147883Sscottl	int wpa_ptk_rekey;
307147883Sscottl	int rsn_pairwise;
308147883Sscottl	int rsn_preauth;
309147883Sscottl	char *rsn_preauth_interfaces;
310147883Sscottl	int peerkey;
311147883Sscottl
312147883Sscottl#ifdef CONFIG_IEEE80211R
313147883Sscottl	/* IEEE 802.11r - Fast BSS Transition */
314147883Sscottl	u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
315147883Sscottl	u8 r1_key_holder[FT_R1KH_ID_LEN];
316147883Sscottl	u32 r0_key_lifetime;
317147883Sscottl	u32 reassociation_deadline;
318147883Sscottl	struct ft_remote_r0kh *r0kh_list;
319147883Sscottl	struct ft_remote_r1kh *r1kh_list;
320147883Sscottl	int pmk_r1_push;
321147883Sscottl	int ft_over_ds;
322147883Sscottl#endif /* CONFIG_IEEE80211R */
323147883Sscottl
324147883Sscottl	char *ctrl_interface; /* directory for UNIX domain sockets */
325147883Sscottl#ifndef CONFIG_NATIVE_WINDOWS
326101704Smjacob	gid_t ctrl_interface_gid;
327101704Smjacob#endif /* CONFIG_NATIVE_WINDOWS */
328147883Sscottl	int ctrl_interface_gid_set;
329147883Sscottl
330147883Sscottl	char *ca_cert;
331147883Sscottl	char *server_cert;
332147883Sscottl	char *private_key;
333147883Sscottl	char *private_key_passwd;
334147883Sscottl	int check_crl;
335147883Sscottl	char *ocsp_stapling_response;
336101704Smjacob	char *dh_file;
337147883Sscottl	char *openssl_ciphers;
338147883Sscottl	u8 *pac_opaque_encr_key;
339147883Sscottl	u8 *eap_fast_a_id;
340147883Sscottl	size_t eap_fast_a_id_len;
341147883Sscottl	char *eap_fast_a_id_info;
342101704Smjacob	int eap_fast_prov;
343101704Smjacob	int pac_key_lifetime;
344147883Sscottl	int pac_key_refresh_time;
345147883Sscottl	int eap_sim_aka_result_ind;
346147883Sscottl	int tnc;
347147883Sscottl	int fragment_size;
348147883Sscottl	u16 pwd_group;
349147883Sscottl
350147883Sscottl	char *radius_server_clients;
351147883Sscottl	int radius_server_auth_port;
352147883Sscottl	int radius_server_acct_port;
353147883Sscottl	int radius_server_ipv6;
354147883Sscottl
355147883Sscottl	int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
356147883Sscottl				 * address instead of individual address
357147883Sscottl				 * (for driver_wired.c).
358147883Sscottl				 */
359147883Sscottl
360101704Smjacob	int ap_max_inactivity;
361101704Smjacob	int ignore_broadcast_ssid;
362147883Sscottl
363147883Sscottl	int wmm_enabled;
364147883Sscottl	int wmm_uapsd;
365147883Sscottl
366147883Sscottl	struct hostapd_vlan *vlan;
367101704Smjacob
368147883Sscottl	macaddr bssid;
369101704Smjacob
370147883Sscottl	/*
371147883Sscottl	 * Maximum listen interval that STAs can use when associating with this
372147883Sscottl	 * BSS. If a STA tries to use larger value, the association will be
373147883Sscottl	 * denied with status code 51.
374147883Sscottl	 */
375147883Sscottl	u16 max_listen_interval;
376147883Sscottl
377147883Sscottl	int disable_pmksa_caching;
378147883Sscottl	int okc; /* Opportunistic Key Caching */
379147883Sscottl
380147883Sscottl	int wps_state;
381147883Sscottl#ifdef CONFIG_WPS
382147883Sscottl	int wps_independent;
383147883Sscottl	int ap_setup_locked;
384147883Sscottl	u8 uuid[16];
385147883Sscottl	char *wps_pin_requests;
386147883Sscottl	char *device_name;
387147883Sscottl	char *manufacturer;
388147883Sscottl	char *model_name;
389147883Sscottl	char *model_number;
390101704Smjacob	char *serial_number;
391147883Sscottl	u8 device_type[WPS_DEV_TYPE_LEN];
392101704Smjacob	char *config_methods;
393147883Sscottl	u8 os_version[4];
394147883Sscottl	char *ap_pin;
395147883Sscottl	int skip_cred_build;
396147883Sscottl	u8 *extra_cred;
397147883Sscottl	size_t extra_cred_len;
398147883Sscottl	int wps_cred_processing;
399147883Sscottl	int force_per_enrollee_psk;
400101704Smjacob	u8 *ap_settings;
401147883Sscottl	size_t ap_settings_len;
402147883Sscottl	char *upnp_iface;
403147883Sscottl	char *friendly_name;
404147883Sscottl	char *manufacturer_url;
405147883Sscottl	char *model_description;
406147883Sscottl	char *model_url;
407147883Sscottl	char *upc;
408102822Smjacob	struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
409147883Sscottl	int wps_nfc_pw_from_config;
410147883Sscottl	int wps_nfc_dev_pw_id;
411147883Sscottl	struct wpabuf *wps_nfc_dh_pubkey;
412147883Sscottl	struct wpabuf *wps_nfc_dh_privkey;
413147883Sscottl	struct wpabuf *wps_nfc_dev_pw;
414147883Sscottl#endif /* CONFIG_WPS */
415147883Sscottl	int pbc_in_m1;
416147883Sscottl	char *server_id;
417147883Sscottl
418147883Sscottl#define P2P_ENABLED BIT(0)
419147883Sscottl#define P2P_GROUP_OWNER BIT(1)
420147883Sscottl#define P2P_GROUP_FORMATION BIT(2)
421147883Sscottl#define P2P_MANAGE BIT(3)
422147883Sscottl#define P2P_ALLOW_CROSS_CONNECTION BIT(4)
423147883Sscottl	int p2p;
424147883Sscottl#ifdef CONFIG_P2P
425147883Sscottl	u8 ip_addr_go[4];
426147883Sscottl	u8 ip_addr_mask[4];
427147883Sscottl	u8 ip_addr_start[4];
428147883Sscottl	u8 ip_addr_end[4];
429147883Sscottl#endif /* CONFIG_P2P */
430147883Sscottl
431147883Sscottl	int disassoc_low_ack;
432147883Sscottl	int skip_inactivity_poll;
433147883Sscottl
434147883Sscottl#define TDLS_PROHIBIT BIT(0)
435147883Sscottl#define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
436147883Sscottl	int tdls;
437147883Sscottl	int disable_11n;
438147883Sscottl	int disable_11ac;
439147883Sscottl
440147883Sscottl	/* IEEE 802.11v */
441147883Sscottl	int time_advertisement;
442147883Sscottl	char *time_zone;
443147883Sscottl	int wnm_sleep_mode;
444147883Sscottl	int bss_transition;
445147883Sscottl
446147883Sscottl	/* IEEE 802.11u - Interworking */
447147883Sscottl	int interworking;
448147883Sscottl	int access_network_type;
449147883Sscottl	int internet;
450147883Sscottl	int asra;
451147883Sscottl	int esr;
452147883Sscottl	int uesa;
453147883Sscottl	int venue_info_set;
454147883Sscottl	u8 venue_group;
455147883Sscottl	u8 venue_type;
456147883Sscottl	u8 hessid[ETH_ALEN];
457147883Sscottl
458147883Sscottl	/* IEEE 802.11u - Roaming Consortium list */
459147883Sscottl	unsigned int roaming_consortium_count;
460147883Sscottl	struct hostapd_roaming_consortium *roaming_consortium;
461147883Sscottl
462147883Sscottl	/* IEEE 802.11u - Venue Name duples */
463147883Sscottl	unsigned int venue_name_count;
464147883Sscottl	struct hostapd_lang_string *venue_name;
465147883Sscottl
466147883Sscottl	/* IEEE 802.11u - Network Authentication Type */
467147883Sscottl	u8 *network_auth_type;
468147883Sscottl	size_t network_auth_type_len;
469147883Sscottl
470147883Sscottl	/* IEEE 802.11u - IP Address Type Availability */
471147883Sscottl	u8 ipaddr_type_availability;
472147883Sscottl	u8 ipaddr_type_configured;
473147883Sscottl
474147883Sscottl	/* IEEE 802.11u - 3GPP Cellular Network */
475147883Sscottl	u8 *anqp_3gpp_cell_net;
476147883Sscottl	size_t anqp_3gpp_cell_net_len;
477147883Sscottl
478147883Sscottl	/* IEEE 802.11u - Domain Name */
479147883Sscottl	u8 *domain_name;
480147883Sscottl	size_t domain_name_len;
481147883Sscottl
482147883Sscottl	unsigned int nai_realm_count;
483147883Sscottl	struct hostapd_nai_realm_data *nai_realm_data;
484147883Sscottl
485147883Sscottl	u16 gas_comeback_delay;
486147883Sscottl	int gas_frag_limit;
487147883Sscottl
488147883Sscottl	u8 qos_map_set[16 + 2 * 21];
489147883Sscottl	unsigned int qos_map_set_len;
490147883Sscottl
491147883Sscottl	int osen;
492147883Sscottl	int proxy_arp;
493147883Sscottl#ifdef CONFIG_HS20
494147883Sscottl	int hs20;
495147883Sscottl	int disable_dgaf;
496147883Sscottl	u16 anqp_domain_id;
497147883Sscottl	unsigned int hs20_oper_friendly_name_count;
498147883Sscottl	struct hostapd_lang_string *hs20_oper_friendly_name;
499147883Sscottl	u8 *hs20_wan_metrics;
500147883Sscottl	u8 *hs20_connection_capability;
501147883Sscottl	size_t hs20_connection_capability_len;
502147883Sscottl	u8 *hs20_operating_class;
503147883Sscottl	u8 hs20_operating_class_len;
504147883Sscottl	struct hs20_icon {
505147883Sscottl		u16 width;
506147883Sscottl		u16 height;
507147883Sscottl		char language[3];
508147883Sscottl		char type[256];
509147883Sscottl		char name[256];
510147883Sscottl		char file[256];
511147883Sscottl	} *hs20_icons;
512147883Sscottl	size_t hs20_icons_count;
513147883Sscottl	u8 osu_ssid[HOSTAPD_MAX_SSID_LEN];
514147883Sscottl	size_t osu_ssid_len;
515147883Sscottl	struct hs20_osu_provider {
516147883Sscottl		unsigned int friendly_name_count;
517147883Sscottl		struct hostapd_lang_string *friendly_name;
518147883Sscottl		char *server_uri;
519147883Sscottl		int *method_list;
520147883Sscottl		char **icons;
521147883Sscottl		size_t icons_count;
522147883Sscottl		char *osu_nai;
523147883Sscottl		unsigned int service_desc_count;
524147883Sscottl		struct hostapd_lang_string *service_desc;
525147883Sscottl	} *hs20_osu_providers, *last_osu;
526147883Sscottl	size_t hs20_osu_providers_count;
527147883Sscottl	unsigned int hs20_deauth_req_timeout;
528147883Sscottl	char *subscr_remediation_url;
529147883Sscottl	u8 subscr_remediation_method;
530147883Sscottl#endif /* CONFIG_HS20 */
531147883Sscottl
532147883Sscottl	u8 wps_rf_bands; /* RF bands for WPS (WPS_RF_*) */
533147883Sscottl
534147883Sscottl#ifdef CONFIG_RADIUS_TEST
535147883Sscottl	char *dump_msk_file;
536147883Sscottl#endif /* CONFIG_RADIUS_TEST */
537147883Sscottl
538147883Sscottl	struct wpabuf *vendor_elements;
539147883Sscottl
540147883Sscottl	unsigned int sae_anti_clogging_threshold;
541147883Sscottl	int *sae_groups;
542147883Sscottl
543147883Sscottl	char *wowlan_triggers; /* Wake-on-WLAN triggers */
544147883Sscottl
545147883Sscottl#ifdef CONFIG_TESTING_OPTIONS
546147883Sscottl	u8 bss_load_test[5];
547147883Sscottl	u8 bss_load_test_set;
548147883Sscottl#endif /* CONFIG_TESTING_OPTIONS */
549147883Sscottl
550147883Sscottl#define MESH_ENABLED BIT(0)
551147883Sscottl	int mesh;
552147883Sscottl
553147883Sscottl	int radio_measurements;
554147883Sscottl
555147883Sscottl	int vendor_vht;
556147883Sscottl};
557147883Sscottl
558147883Sscottl
559147883Sscottl/**
560147883Sscottl * struct hostapd_config - Per-radio interface configuration
561147883Sscottl */
562147883Sscottlstruct hostapd_config {
563147883Sscottl	struct hostapd_bss_config **bss, *last_bss;
564147883Sscottl	size_t num_bss;
565147883Sscottl
566147883Sscottl	u16 beacon_int;
567147883Sscottl	int rts_threshold;
568147883Sscottl	int fragm_threshold;
569147883Sscottl	u8 send_probe_response;
570147883Sscottl	u8 channel;
571147883Sscottl	int *chanlist;
572147883Sscottl	enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
573147883Sscottl	enum {
574147883Sscottl		LONG_PREAMBLE = 0,
575147883Sscottl		SHORT_PREAMBLE = 1
576147883Sscottl	} preamble;
577147883Sscottl
578147883Sscottl	int *supported_rates;
579147883Sscottl	int *basic_rates;
580147883Sscottl
581147883Sscottl	const struct wpa_driver_ops *driver;
582147883Sscottl	char *driver_params;
583147883Sscottl
584147883Sscottl	int ap_table_max_size;
585147883Sscottl	int ap_table_expiration_time;
586147883Sscottl
587147883Sscottl	char country[3]; /* first two octets: country code as described in
588147883Sscottl			  * ISO/IEC 3166-1. Third octet:
589147883Sscottl			  * ' ' (ascii 32): all environments
590147883Sscottl			  * 'O': Outdoor environemnt only
591147883Sscottl			  * 'I': Indoor environment only
592147883Sscottl			  */
593147883Sscottl
594147883Sscottl	int ieee80211d;
595147883Sscottl
596147883Sscottl	int ieee80211h; /* DFS */
597147883Sscottl
598147883Sscottl	/*
599147883Sscottl	 * Local power constraint is an octet encoded as an unsigned integer in
600147883Sscottl	 * units of decibels. Invalid value -1 indicates that Power Constraint
601147883Sscottl	 * element will not be added.
602147883Sscottl	 */
603147883Sscottl	int local_pwr_constraint;
604147883Sscottl
605147883Sscottl	/* Control Spectrum Management bit */
606147883Sscottl	int spectrum_mgmt_required;
607147883Sscottl
608147883Sscottl	struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
609147883Sscottl
610147883Sscottl	/*
611147883Sscottl	 * WMM AC parameters, in same order as 802.1D, i.e.
612147883Sscottl	 * 0 = BE (best effort)
613147883Sscottl	 * 1 = BK (background)
614147883Sscottl	 * 2 = VI (video)
615147883Sscottl	 * 3 = VO (voice)
616147883Sscottl	 */
617147883Sscottl	struct hostapd_wmm_ac_params wmm_ac_params[4];
618147883Sscottl
619147883Sscottl	int ht_op_mode_fixed;
620147883Sscottl	u16 ht_capab;
621147883Sscottl	int ieee80211n;
622147883Sscottl	int secondary_channel;
623147883Sscottl	int require_ht;
624147883Sscottl	int obss_interval;
625147883Sscottl	u32 vht_capab;
626147883Sscottl	int ieee80211ac;
627147883Sscottl	int require_vht;
628147883Sscottl	u8 vht_oper_chwidth;
629147883Sscottl	u8 vht_oper_centr_freq_seg0_idx;
630147883Sscottl	u8 vht_oper_centr_freq_seg1_idx;
631147883Sscottl
632147883Sscottl#ifdef CONFIG_P2P
633147883Sscottl	u8 p2p_go_ctwindow;
634147883Sscottl#endif /* CONFIG_P2P */
635147883Sscottl
636147883Sscottl#ifdef CONFIG_TESTING_OPTIONS
637147883Sscottl	double ignore_probe_probability;
638147883Sscottl	double ignore_auth_probability;
639147883Sscottl	double ignore_assoc_probability;
640147883Sscottl	double ignore_reassoc_probability;
641147883Sscottl	double corrupt_gtk_rekey_mic_probability;
642147883Sscottl#endif /* CONFIG_TESTING_OPTIONS */
643147883Sscottl
644147883Sscottl#ifdef CONFIG_ACS
645147883Sscottl	unsigned int acs_num_scans;
646147883Sscottl	struct acs_bias {
647147883Sscottl		int channel;
648147883Sscottl		double bias;
649147883Sscottl	} *acs_chan_bias;
650147883Sscottl	unsigned int num_acs_chan_bias;
651147883Sscottl#endif /* CONFIG_ACS */
652147883Sscottl};
653147883Sscottl
654147883Sscottl
655147883Sscottlint hostapd_mac_comp(const void *a, const void *b);
656147883Sscottlint hostapd_mac_comp_empty(const void *a);
657147883Sscottlstruct hostapd_config * hostapd_config_defaults(void);
658147883Sscottlvoid hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
659147883Sscottlvoid hostapd_config_free_eap_user(struct hostapd_eap_user *user);
660147883Sscottlvoid hostapd_config_clear_wpa_psk(struct hostapd_wpa_psk **p);
661147883Sscottlvoid hostapd_config_free_bss(struct hostapd_bss_config *conf);
662147883Sscottlvoid hostapd_config_free(struct hostapd_config *conf);
663147883Sscottlint hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
664147883Sscottl			  const u8 *addr, int *vlan_id);
665147883Sscottlint hostapd_rate_found(int *list, int rate);
666147883Sscottlconst u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
667147883Sscottl			   const u8 *addr, const u8 *p2p_dev_addr,
668147883Sscottl			   const u8 *prev_psk);
669147883Sscottlint hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
670147883Sscottlint hostapd_vlan_id_valid(struct hostapd_vlan *vlan, int vlan_id);
671147883Sscottlconst char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
672147883Sscottl					int vlan_id);
673147883Sscottlstruct hostapd_radius_attr *
674147883Sscottlhostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type);
675147883Sscottlint hostapd_config_check(struct hostapd_config *conf, int full_config);
676147883Sscottlvoid hostapd_set_security_params(struct hostapd_bss_config *bss,
677147883Sscottl				 int full_config);
678147883Sscottl
679147883Sscottl#endif /* HOSTAPD_CONFIG_H */
680147883Sscottl