2 * hostapd / Configuration definitions and helpers functions
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 #ifndef HOSTAPD_CONFIG_H
16 #define HOSTAPD_CONFIG_H
18 #include "common/defs.h"
20 #include "common/wpa_common.h"
23 #define MAX_STA_COUNT 2007
24 #define MAX_VLAN_ID 4094
26 typedef u8 macaddr[ETH_ALEN];
28 struct mac_acl_entry {
33 struct hostapd_radius_servers;
34 struct ft_remote_r0kh;
35 struct ft_remote_r1kh;
37 #define HOSTAPD_MAX_SSID_LEN 32
39 #define NUM_WEP_KEYS 4
40 struct hostapd_wep_keys {
42 u8 *key[NUM_WEP_KEYS];
43 size_t len[NUM_WEP_KEYS];
45 size_t default_len; /* key length used for dynamic key generation */
48 typedef enum hostap_security_policy {
49 SECURITY_PLAINTEXT = 0,
50 SECURITY_STATIC_WEP = 1,
51 SECURITY_IEEE_802_1X = 2,
57 char ssid[HOSTAPD_MAX_SSID_LEN + 1];
61 char vlan[IFNAMSIZ + 1];
62 secpolicy security_policy;
64 struct hostapd_wpa_psk *wpa_psk;
68 struct hostapd_wep_keys wep;
70 #define DYNAMIC_VLAN_DISABLED 0
71 #define DYNAMIC_VLAN_OPTIONAL 1
72 #define DYNAMIC_VLAN_REQUIRED 2
74 #ifdef CONFIG_FULL_DYNAMIC_VLAN
75 char *vlan_tagged_interface;
76 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
77 struct hostapd_wep_keys **dyn_vlan_keys;
78 size_t max_dyn_vlan_keys;
82 #define VLAN_ID_WILDCARD -1
85 struct hostapd_vlan *next;
86 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
87 char ifname[IFNAMSIZ + 1];
89 #ifdef CONFIG_FULL_DYNAMIC_VLAN
91 #define DVLAN_CLEAN_BR 0x1
92 #define DVLAN_CLEAN_VLAN 0x2
93 #define DVLAN_CLEAN_VLAN_PORT 0x4
94 #define DVLAN_CLEAN_WLAN_PORT 0x8
96 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
100 struct hostapd_wpa_psk {
101 struct hostapd_wpa_psk *next;
107 #define EAP_USER_MAX_METHODS 8
108 struct hostapd_eap_user {
109 struct hostapd_eap_user *next;
115 } methods[EAP_USER_MAX_METHODS];
120 unsigned int wildcard_prefix:1;
121 unsigned int password_hash:1; /* whether password is hashed with
122 * nt_password_hash() */
123 int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
127 #define NUM_TX_QUEUES 4
129 struct hostapd_tx_queue_params {
133 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
136 struct hostapd_wmm_ac_params {
140 int txop_limit; /* in units of 32us */
141 int admission_control_mandatory;
145 #define MAX_ROAMING_CONSORTIUM_LEN 15
147 struct hostapd_roaming_consortium {
149 u8 oi[MAX_ROAMING_CONSORTIUM_LEN];
153 * struct hostapd_bss_config - Per-BSS configuration
155 struct hostapd_bss_config {
156 char iface[IFNAMSIZ + 1];
157 char bridge[IFNAMSIZ + 1];
158 char wds_bridge[IFNAMSIZ + 1];
160 enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
162 unsigned int logger_syslog; /* module bitfield */
163 unsigned int logger_stdout; /* module bitfield */
165 char *dump_log_name; /* file name for state dump (SIGUSR1) */
167 int max_num_sta; /* maximum number of STAs in station table */
171 int ieee802_1x; /* use IEEE 802.1X */
173 int eap_server; /* Use internal EAP server instead of external
175 struct hostapd_eap_user *eap_user;
177 struct hostapd_ip_addr own_ip_addr;
178 char *nas_identifier;
179 struct hostapd_radius_servers *radius;
180 int acct_interim_interval;
182 struct hostapd_ssid ssid;
184 char *eap_req_id_text; /* optional displayable message sent with
185 * EAP Request-Identity */
186 size_t eap_req_id_text_len;
187 int eapol_key_index_workaround;
189 size_t default_wep_key_len;
190 int individual_wep_key_len;
191 int wep_rekeying_period;
192 int broadcast_key_idx_min, broadcast_key_idx_max;
193 int eap_reauth_period;
195 int ieee802_11f; /* use IEEE 802.11f (IAPP) */
196 char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
200 ACCEPT_UNLESS_DENIED = 0,
201 DENY_UNLESS_ACCEPTED = 1,
202 USE_EXTERNAL_RADIUS_AUTH = 2
204 struct mac_acl_entry *accept_mac;
206 struct mac_acl_entry *deny_mac;
211 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
212 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
214 int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
216 #ifdef CONFIG_IEEE80211W
217 enum mfp_options ieee80211w;
218 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
219 unsigned int assoc_sa_query_max_timeout;
220 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
221 int assoc_sa_query_retry_timeout;
222 #endif /* CONFIG_IEEE80211W */
226 int wpa_strict_rekey;
231 char *rsn_preauth_interfaces;
234 #ifdef CONFIG_IEEE80211R
235 /* IEEE 802.11r - Fast BSS Transition */
236 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
237 u8 r1_key_holder[FT_R1KH_ID_LEN];
239 u32 reassociation_deadline;
240 struct ft_remote_r0kh *r0kh_list;
241 struct ft_remote_r1kh *r1kh_list;
244 #endif /* CONFIG_IEEE80211R */
246 char *ctrl_interface; /* directory for UNIX domain sockets */
247 #ifndef CONFIG_NATIVE_WINDOWS
248 gid_t ctrl_interface_gid;
249 #endif /* CONFIG_NATIVE_WINDOWS */
250 int ctrl_interface_gid_set;
255 char *private_key_passwd;
258 u8 *pac_opaque_encr_key;
260 size_t eap_fast_a_id_len;
261 char *eap_fast_a_id_info;
263 int pac_key_lifetime;
264 int pac_key_refresh_time;
265 int eap_sim_aka_result_ind;
270 char *radius_server_clients;
271 int radius_server_auth_port;
272 int radius_server_ipv6;
274 char *test_socket; /* UNIX domain socket path for driver_test */
276 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
277 * address instead of individual address
278 * (for driver_wired.c).
281 int ap_max_inactivity;
282 int ignore_broadcast_ssid;
287 struct hostapd_vlan *vlan, *vlan_tail;
292 * Maximum listen interval that STAs can use when associating with this
293 * BSS. If a STA tries to use larger value, the association will be
294 * denied with status code 51.
296 u16 max_listen_interval;
298 int disable_pmksa_caching;
299 int okc; /* Opportunistic Key Caching */
305 char *wps_pin_requests;
311 u8 device_type[WPS_DEV_TYPE_LEN];
312 char *config_methods;
317 size_t extra_cred_len;
318 int wps_cred_processing;
320 size_t ap_settings_len;
323 char *manufacturer_url;
324 char *model_description;
327 struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
328 #endif /* CONFIG_WPS */
331 #define P2P_ENABLED BIT(0)
332 #define P2P_GROUP_OWNER BIT(1)
333 #define P2P_GROUP_FORMATION BIT(2)
334 #define P2P_MANAGE BIT(3)
335 #define P2P_ALLOW_CROSS_CONNECTION BIT(4)
338 int disassoc_low_ack;
340 #define TDLS_PROHIBIT BIT(0)
341 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
345 /* IEEE 802.11u - Interworking */
347 int access_network_type;
357 /* IEEE 802.11u - Roaming Consortium list */
358 unsigned int roaming_consortium_count;
359 struct hostapd_roaming_consortium *roaming_consortium;
364 * struct hostapd_config - Per-radio interface configuration
366 struct hostapd_config {
367 struct hostapd_bss_config *bss, *last_bss;
373 u8 send_probe_response;
375 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
381 CTS_PROTECTION_AUTOMATIC = 0,
382 CTS_PROTECTION_FORCE_ENABLED = 1,
383 CTS_PROTECTION_FORCE_DISABLED = 2,
384 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
385 } cts_protection_type;
387 int *supported_rates;
390 const struct wpa_driver_ops *driver;
392 int ap_table_max_size;
393 int ap_table_expiration_time;
395 char country[3]; /* first two octets: country code as described in
396 * ISO/IEC 3166-1. Third octet:
397 * ' ' (ascii 32): all environments
398 * 'O': Outdoor environemnt only
399 * 'I': Indoor environment only
404 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
407 * WMM AC parameters, in same order as 802.1D, i.e.
408 * 0 = BE (best effort)
409 * 1 = BK (background)
413 struct hostapd_wmm_ac_params wmm_ac_params[4];
415 int ht_op_mode_fixed;
418 int secondary_channel;
423 int hostapd_mac_comp(const void *a, const void *b);
424 int hostapd_mac_comp_empty(const void *a);
425 struct hostapd_config * hostapd_config_defaults(void);
426 void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
427 void hostapd_config_free(struct hostapd_config *conf);
428 int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
429 const u8 *addr, int *vlan_id);
430 int hostapd_rate_found(int *list, int rate);
431 int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
432 struct hostapd_wep_keys *b);
433 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
434 const u8 *addr, const u8 *prev_psk);
435 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
436 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
438 const struct hostapd_eap_user *
439 hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
440 size_t identity_len, int phase2);
442 #endif /* HOSTAPD_CONFIG_H */