2 * hostapd / Configuration definitions and helpers functions
3 * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #ifndef HOSTAPD_CONFIG_H
10 #define HOSTAPD_CONFIG_H
12 #include "common/defs.h"
14 #include "common/wpa_common.h"
17 #define MAX_STA_COUNT 2007
18 #define MAX_VLAN_ID 4094
20 typedef u8 macaddr
[ETH_ALEN
];
22 struct mac_acl_entry
{
27 struct hostapd_radius_servers
;
28 struct ft_remote_r0kh
;
29 struct ft_remote_r1kh
;
31 #define HOSTAPD_MAX_SSID_LEN 32
33 #define NUM_WEP_KEYS 4
34 struct hostapd_wep_keys
{
36 u8
*key
[NUM_WEP_KEYS
];
37 size_t len
[NUM_WEP_KEYS
];
39 size_t default_len
; /* key length used for dynamic key generation */
42 typedef enum hostap_security_policy
{
43 SECURITY_PLAINTEXT
= 0,
44 SECURITY_STATIC_WEP
= 1,
45 SECURITY_IEEE_802_1X
= 2,
51 char ssid
[HOSTAPD_MAX_SSID_LEN
+ 1];
55 char vlan
[IFNAMSIZ
+ 1];
56 secpolicy security_policy
;
58 struct hostapd_wpa_psk
*wpa_psk
;
62 struct hostapd_wep_keys wep
;
64 #define DYNAMIC_VLAN_DISABLED 0
65 #define DYNAMIC_VLAN_OPTIONAL 1
66 #define DYNAMIC_VLAN_REQUIRED 2
68 #ifdef CONFIG_FULL_DYNAMIC_VLAN
69 char *vlan_tagged_interface
;
70 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
71 struct hostapd_wep_keys
**dyn_vlan_keys
;
72 size_t max_dyn_vlan_keys
;
76 #define VLAN_ID_WILDCARD -1
79 struct hostapd_vlan
*next
;
80 int vlan_id
; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
81 char ifname
[IFNAMSIZ
+ 1];
83 #ifdef CONFIG_FULL_DYNAMIC_VLAN
85 #define DVLAN_CLEAN_BR 0x1
86 #define DVLAN_CLEAN_VLAN 0x2
87 #define DVLAN_CLEAN_VLAN_PORT 0x4
88 #define DVLAN_CLEAN_WLAN_PORT 0x8
90 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
94 struct hostapd_wpa_psk
{
95 struct hostapd_wpa_psk
*next
;
101 struct hostapd_eap_user
{
102 struct hostapd_eap_user
*next
;
108 } methods
[EAP_MAX_METHODS
];
113 unsigned int wildcard_prefix
:1;
114 unsigned int password_hash
:1; /* whether password is hashed with
115 * nt_password_hash() */
116 int ttls_auth
; /* EAP_TTLS_AUTH_* bitfield */
119 struct hostapd_radius_attr
{
122 struct hostapd_radius_attr
*next
;
126 #define NUM_TX_QUEUES 4
128 struct hostapd_tx_queue_params
{
132 int burst
; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
135 struct hostapd_wmm_ac_params
{
139 int txop_limit
; /* in units of 32us */
140 int admission_control_mandatory
;
144 #define MAX_ROAMING_CONSORTIUM_LEN 15
146 struct hostapd_roaming_consortium
{
148 u8 oi
[MAX_ROAMING_CONSORTIUM_LEN
];
151 struct hostapd_venue_name
{
158 * struct hostapd_bss_config - Per-BSS configuration
160 struct hostapd_bss_config
{
161 char iface
[IFNAMSIZ
+ 1];
162 char bridge
[IFNAMSIZ
+ 1];
163 char wds_bridge
[IFNAMSIZ
+ 1];
165 enum hostapd_logger_level logger_syslog_level
, logger_stdout_level
;
167 unsigned int logger_syslog
; /* module bitfield */
168 unsigned int logger_stdout
; /* module bitfield */
170 char *dump_log_name
; /* file name for state dump (SIGUSR1) */
172 int max_num_sta
; /* maximum number of STAs in station table */
176 int ieee802_1x
; /* use IEEE 802.1X */
178 int eap_server
; /* Use internal EAP server instead of external
180 struct hostapd_eap_user
*eap_user
;
182 struct hostapd_ip_addr own_ip_addr
;
183 char *nas_identifier
;
184 struct hostapd_radius_servers
*radius
;
185 int acct_interim_interval
;
186 int radius_request_cui
;
187 struct hostapd_radius_attr
*radius_auth_req_attr
;
188 struct hostapd_radius_attr
*radius_acct_req_attr
;
190 unsigned int radius_das_time_window
;
191 int radius_das_require_event_timestamp
;
192 struct hostapd_ip_addr radius_das_client_addr
;
193 u8
*radius_das_shared_secret
;
194 size_t radius_das_shared_secret_len
;
196 struct hostapd_ssid ssid
;
198 char *eap_req_id_text
; /* optional displayable message sent with
199 * EAP Request-Identity */
200 size_t eap_req_id_text_len
;
201 int eapol_key_index_workaround
;
203 size_t default_wep_key_len
;
204 int individual_wep_key_len
;
205 int wep_rekeying_period
;
206 int broadcast_key_idx_min
, broadcast_key_idx_max
;
207 int eap_reauth_period
;
209 int ieee802_11f
; /* use IEEE 802.11f (IAPP) */
210 char iapp_iface
[IFNAMSIZ
+ 1]; /* interface used with IAPP broadcast
214 ACCEPT_UNLESS_DENIED
= 0,
215 DENY_UNLESS_ACCEPTED
= 1,
216 USE_EXTERNAL_RADIUS_AUTH
= 2
218 struct mac_acl_entry
*accept_mac
;
220 struct mac_acl_entry
*deny_mac
;
225 int auth_algs
; /* bitfield of allowed IEEE 802.11 authentication
226 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
228 int wpa
; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
230 #ifdef CONFIG_IEEE80211W
231 enum mfp_options ieee80211w
;
232 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
233 unsigned int assoc_sa_query_max_timeout
;
234 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
235 int assoc_sa_query_retry_timeout
;
236 #endif /* CONFIG_IEEE80211W */
238 PSK_RADIUS_IGNORED
= 0,
239 PSK_RADIUS_ACCEPTED
= 1,
240 PSK_RADIUS_REQUIRED
= 2
245 int wpa_strict_rekey
;
250 char *rsn_preauth_interfaces
;
253 #ifdef CONFIG_IEEE80211R
254 /* IEEE 802.11r - Fast BSS Transition */
255 u8 mobility_domain
[MOBILITY_DOMAIN_ID_LEN
];
256 u8 r1_key_holder
[FT_R1KH_ID_LEN
];
258 u32 reassociation_deadline
;
259 struct ft_remote_r0kh
*r0kh_list
;
260 struct ft_remote_r1kh
*r1kh_list
;
263 #endif /* CONFIG_IEEE80211R */
265 char *ctrl_interface
; /* directory for UNIX domain sockets */
266 #ifndef CONFIG_NATIVE_WINDOWS
267 gid_t ctrl_interface_gid
;
268 #endif /* CONFIG_NATIVE_WINDOWS */
269 int ctrl_interface_gid_set
;
274 char *private_key_passwd
;
277 u8
*pac_opaque_encr_key
;
279 size_t eap_fast_a_id_len
;
280 char *eap_fast_a_id_info
;
282 int pac_key_lifetime
;
283 int pac_key_refresh_time
;
284 int eap_sim_aka_result_ind
;
289 char *radius_server_clients
;
290 int radius_server_auth_port
;
291 int radius_server_ipv6
;
293 char *test_socket
; /* UNIX domain socket path for driver_test */
295 int use_pae_group_addr
; /* Whether to send EAPOL frames to PAE group
296 * address instead of individual address
297 * (for driver_wired.c).
300 int ap_max_inactivity
;
301 int ignore_broadcast_ssid
;
306 struct hostapd_vlan
*vlan
, *vlan_tail
;
311 * Maximum listen interval that STAs can use when associating with this
312 * BSS. If a STA tries to use larger value, the association will be
313 * denied with status code 51.
315 u16 max_listen_interval
;
317 int disable_pmksa_caching
;
318 int okc
; /* Opportunistic Key Caching */
324 char *wps_pin_requests
;
330 u8 device_type
[WPS_DEV_TYPE_LEN
];
331 char *config_methods
;
336 size_t extra_cred_len
;
337 int wps_cred_processing
;
339 size_t ap_settings_len
;
342 char *manufacturer_url
;
343 char *model_description
;
346 struct wpabuf
*wps_vendor_ext
[MAX_WPS_VENDOR_EXTENSIONS
];
347 int wps_nfc_dev_pw_id
;
348 struct wpabuf
*wps_nfc_dh_pubkey
;
349 struct wpabuf
*wps_nfc_dh_privkey
;
350 struct wpabuf
*wps_nfc_dev_pw
;
351 #endif /* CONFIG_WPS */
354 #define P2P_ENABLED BIT(0)
355 #define P2P_GROUP_OWNER BIT(1)
356 #define P2P_GROUP_FORMATION BIT(2)
357 #define P2P_MANAGE BIT(3)
358 #define P2P_ALLOW_CROSS_CONNECTION BIT(4)
361 int disassoc_low_ack
;
362 int skip_inactivity_poll
;
364 #define TDLS_PROHIBIT BIT(0)
365 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
371 int time_advertisement
;
374 /* IEEE 802.11u - Interworking */
376 int access_network_type
;
386 /* IEEE 802.11u - Roaming Consortium list */
387 unsigned int roaming_consortium_count
;
388 struct hostapd_roaming_consortium
*roaming_consortium
;
390 /* IEEE 802.11u - Venue Name duples */
391 unsigned int venue_name_count
;
392 struct hostapd_venue_name
*venue_name
;
394 /* IEEE 802.11u - Network Authentication Type */
395 u8
*network_auth_type
;
396 size_t network_auth_type_len
;
398 u16 gas_comeback_delay
;
404 #endif /* CONFIG_HS20 */
406 u8 wps_rf_bands
; /* RF bands for WPS (WPS_RF_*) */
408 #ifdef CONFIG_RADIUS_TEST
410 #endif /* CONFIG_RADIUS_TEST */
415 * struct hostapd_config - Per-radio interface configuration
417 struct hostapd_config
{
418 struct hostapd_bss_config
*bss
, *last_bss
;
424 u8 send_probe_response
;
426 enum hostapd_hw_mode hw_mode
; /* HOSTAPD_MODE_IEEE80211A, .. */
432 int *supported_rates
;
435 const struct wpa_driver_ops
*driver
;
437 int ap_table_max_size
;
438 int ap_table_expiration_time
;
440 char country
[3]; /* first two octets: country code as described in
441 * ISO/IEC 3166-1. Third octet:
442 * ' ' (ascii 32): all environments
443 * 'O': Outdoor environemnt only
444 * 'I': Indoor environment only
449 struct hostapd_tx_queue_params tx_queue
[NUM_TX_QUEUES
];
452 * WMM AC parameters, in same order as 802.1D, i.e.
453 * 0 = BE (best effort)
454 * 1 = BK (background)
458 struct hostapd_wmm_ac_params wmm_ac_params
[4];
460 int ht_op_mode_fixed
;
463 int secondary_channel
;
471 int hostapd_mac_comp(const void *a
, const void *b
);
472 int hostapd_mac_comp_empty(const void *a
);
473 struct hostapd_config
* hostapd_config_defaults(void);
474 void hostapd_config_defaults_bss(struct hostapd_bss_config
*bss
);
475 void hostapd_config_free(struct hostapd_config
*conf
);
476 int hostapd_maclist_found(struct mac_acl_entry
*list
, int num_entries
,
477 const u8
*addr
, int *vlan_id
);
478 int hostapd_rate_found(int *list
, int rate
);
479 int hostapd_wep_key_cmp(struct hostapd_wep_keys
*a
,
480 struct hostapd_wep_keys
*b
);
481 const u8
* hostapd_get_psk(const struct hostapd_bss_config
*conf
,
482 const u8
*addr
, const u8
*prev_psk
);
483 int hostapd_setup_wpa_psk(struct hostapd_bss_config
*conf
);
484 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan
*vlan
,
486 const struct hostapd_eap_user
*
487 hostapd_get_eap_user(const struct hostapd_bss_config
*conf
, const u8
*identity
,
488 size_t identity_len
, int phase2
);
489 struct hostapd_radius_attr
*
490 hostapd_config_get_radius_attr(struct hostapd_radius_attr
*attr
, u8 type
);
492 #endif /* HOSTAPD_CONFIG_H */