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"
15 #include "common/ieee802_11_common.h"
19 * mesh_conf - local MBSS state and settings
24 /* Active Path Selection Protocol Identifier */
26 /* Active Path Selection Metric Identifier */
28 /* Congestion Control Mode Identifier */
30 /* Synchronization Protocol Identifier */
32 /* Authentication Protocol Identifier */
36 #define MESH_CONF_SEC_NONE BIT(0)
37 #define MESH_CONF_SEC_AUTH BIT(1)
38 #define MESH_CONF_SEC_AMPE BIT(2)
39 unsigned int security
;
42 #define MAX_STA_COUNT 2007
43 #define MAX_VLAN_ID 4094
45 typedef u8 macaddr
[ETH_ALEN
];
47 struct mac_acl_entry
{
52 struct hostapd_radius_servers
;
53 struct ft_remote_r0kh
;
54 struct ft_remote_r1kh
;
56 #define HOSTAPD_MAX_SSID_LEN 32
58 #define NUM_WEP_KEYS 4
59 struct hostapd_wep_keys
{
61 u8
*key
[NUM_WEP_KEYS
];
62 size_t len
[NUM_WEP_KEYS
];
64 size_t default_len
; /* key length used for dynamic key generation */
67 typedef enum hostap_security_policy
{
68 SECURITY_PLAINTEXT
= 0,
69 SECURITY_STATIC_WEP
= 1,
70 SECURITY_IEEE_802_1X
= 2,
77 u8 ssid
[HOSTAPD_MAX_SSID_LEN
];
79 unsigned int ssid_set
:1;
80 unsigned int utf8_ssid
:1;
81 unsigned int wpa_passphrase_set
:1;
82 unsigned int wpa_psk_set
:1;
84 char vlan
[IFNAMSIZ
+ 1];
85 secpolicy security_policy
;
87 struct hostapd_wpa_psk
*wpa_psk
;
91 struct hostapd_wep_keys wep
;
93 #define DYNAMIC_VLAN_DISABLED 0
94 #define DYNAMIC_VLAN_OPTIONAL 1
95 #define DYNAMIC_VLAN_REQUIRED 2
97 #define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0
98 #define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1
99 #define DYNAMIC_VLAN_NAMING_END 2
101 #ifdef CONFIG_FULL_DYNAMIC_VLAN
102 char *vlan_tagged_interface
;
103 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
107 #define VLAN_ID_WILDCARD -1
109 struct hostapd_vlan
{
110 struct hostapd_vlan
*next
;
111 int vlan_id
; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
112 char ifname
[IFNAMSIZ
+ 1];
114 #ifdef CONFIG_FULL_DYNAMIC_VLAN
116 #define DVLAN_CLEAN_BR 0x1
117 #define DVLAN_CLEAN_VLAN 0x2
118 #define DVLAN_CLEAN_VLAN_PORT 0x4
119 #define DVLAN_CLEAN_WLAN_PORT 0x8
121 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
125 struct hostapd_sta_wpa_psk_short
{
126 struct hostapd_sta_wpa_psk_short
*next
;
130 struct hostapd_wpa_psk
{
131 struct hostapd_wpa_psk
*next
;
135 u8 p2p_dev_addr
[ETH_ALEN
];
138 struct hostapd_eap_user
{
139 struct hostapd_eap_user
*next
;
145 } methods
[EAP_MAX_METHODS
];
150 unsigned int wildcard_prefix
:1;
151 unsigned int password_hash
:1; /* whether password is hashed with
152 * nt_password_hash() */
153 unsigned int remediation
:1;
154 unsigned int macacl
:1;
155 int ttls_auth
; /* EAP_TTLS_AUTH_* bitfield */
156 struct hostapd_radius_attr
*accept_attr
;
159 struct hostapd_radius_attr
{
162 struct hostapd_radius_attr
*next
;
166 #define NUM_TX_QUEUES 4
168 struct hostapd_tx_queue_params
{
172 int burst
; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
176 #define MAX_ROAMING_CONSORTIUM_LEN 15
178 struct hostapd_roaming_consortium
{
180 u8 oi
[MAX_ROAMING_CONSORTIUM_LEN
];
183 struct hostapd_lang_string
{
189 #define MAX_NAI_REALMS 10
190 #define MAX_NAI_REALMLEN 255
191 #define MAX_NAI_EAP_METHODS 5
192 #define MAX_NAI_AUTH_TYPES 4
193 struct hostapd_nai_realm_data
{
195 char realm_buf
[MAX_NAI_REALMLEN
+ 1];
196 char *realm
[MAX_NAI_REALMS
];
198 struct hostapd_nai_realm_eap
{
201 u8 auth_id
[MAX_NAI_AUTH_TYPES
];
202 u8 auth_val
[MAX_NAI_AUTH_TYPES
];
203 } eap_method
[MAX_NAI_EAP_METHODS
];
207 * struct hostapd_bss_config - Per-BSS configuration
209 struct hostapd_bss_config
{
210 char iface
[IFNAMSIZ
+ 1];
211 char bridge
[IFNAMSIZ
+ 1];
212 char vlan_bridge
[IFNAMSIZ
+ 1];
213 char wds_bridge
[IFNAMSIZ
+ 1];
215 enum hostapd_logger_level logger_syslog_level
, logger_stdout_level
;
217 unsigned int logger_syslog
; /* module bitfield */
218 unsigned int logger_stdout
; /* module bitfield */
220 int max_num_sta
; /* maximum number of STAs in station table */
223 int bss_load_update_period
;
225 int ieee802_1x
; /* use IEEE 802.1X */
227 int eap_server
; /* Use internal EAP server instead of external
229 struct hostapd_eap_user
*eap_user
;
230 char *eap_user_sqlite
;
232 struct hostapd_ip_addr own_ip_addr
;
233 char *nas_identifier
;
234 struct hostapd_radius_servers
*radius
;
235 int acct_interim_interval
;
236 int radius_request_cui
;
237 struct hostapd_radius_attr
*radius_auth_req_attr
;
238 struct hostapd_radius_attr
*radius_acct_req_attr
;
240 unsigned int radius_das_time_window
;
241 int radius_das_require_event_timestamp
;
242 struct hostapd_ip_addr radius_das_client_addr
;
243 u8
*radius_das_shared_secret
;
244 size_t radius_das_shared_secret_len
;
246 struct hostapd_ssid ssid
;
248 char *eap_req_id_text
; /* optional displayable message sent with
249 * EAP Request-Identity */
250 size_t eap_req_id_text_len
;
251 int eapol_key_index_workaround
;
253 size_t default_wep_key_len
;
254 int individual_wep_key_len
;
255 int wep_rekeying_period
;
256 int broadcast_key_idx_min
, broadcast_key_idx_max
;
257 int eap_reauth_period
;
259 int ieee802_11f
; /* use IEEE 802.11f (IAPP) */
260 char iapp_iface
[IFNAMSIZ
+ 1]; /* interface used with IAPP broadcast
264 ACCEPT_UNLESS_DENIED
= 0,
265 DENY_UNLESS_ACCEPTED
= 1,
266 USE_EXTERNAL_RADIUS_AUTH
= 2
268 struct mac_acl_entry
*accept_mac
;
270 struct mac_acl_entry
*deny_mac
;
276 int auth_algs
; /* bitfield of allowed IEEE 802.11 authentication
277 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
279 int wpa
; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
281 #ifdef CONFIG_IEEE80211W
282 enum mfp_options ieee80211w
;
283 int group_mgmt_cipher
;
284 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
285 unsigned int assoc_sa_query_max_timeout
;
286 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
287 int assoc_sa_query_retry_timeout
;
288 #endif /* CONFIG_IEEE80211W */
290 PSK_RADIUS_IGNORED
= 0,
291 PSK_RADIUS_ACCEPTED
= 1,
292 PSK_RADIUS_REQUIRED
= 2
297 int wpa_strict_rekey
;
302 char *rsn_preauth_interfaces
;
305 #ifdef CONFIG_IEEE80211R
306 /* IEEE 802.11r - Fast BSS Transition */
307 u8 mobility_domain
[MOBILITY_DOMAIN_ID_LEN
];
308 u8 r1_key_holder
[FT_R1KH_ID_LEN
];
310 u32 reassociation_deadline
;
311 struct ft_remote_r0kh
*r0kh_list
;
312 struct ft_remote_r1kh
*r1kh_list
;
315 #endif /* CONFIG_IEEE80211R */
317 char *ctrl_interface
; /* directory for UNIX domain sockets */
318 #ifndef CONFIG_NATIVE_WINDOWS
319 gid_t ctrl_interface_gid
;
320 #endif /* CONFIG_NATIVE_WINDOWS */
321 int ctrl_interface_gid_set
;
326 char *private_key_passwd
;
328 char *ocsp_stapling_response
;
330 char *openssl_ciphers
;
331 u8
*pac_opaque_encr_key
;
333 size_t eap_fast_a_id_len
;
334 char *eap_fast_a_id_info
;
336 int pac_key_lifetime
;
337 int pac_key_refresh_time
;
338 int eap_sim_aka_result_ind
;
343 char *radius_server_clients
;
344 int radius_server_auth_port
;
345 int radius_server_acct_port
;
346 int radius_server_ipv6
;
348 char *test_socket
; /* UNIX domain socket path for driver_test */
350 int use_pae_group_addr
; /* Whether to send EAPOL frames to PAE group
351 * address instead of individual address
352 * (for driver_wired.c).
355 int ap_max_inactivity
;
356 int ignore_broadcast_ssid
;
361 struct hostapd_vlan
*vlan
;
366 * Maximum listen interval that STAs can use when associating with this
367 * BSS. If a STA tries to use larger value, the association will be
368 * denied with status code 51.
370 u16 max_listen_interval
;
372 int disable_pmksa_caching
;
373 int okc
; /* Opportunistic Key Caching */
380 char *wps_pin_requests
;
386 u8 device_type
[WPS_DEV_TYPE_LEN
];
387 char *config_methods
;
392 size_t extra_cred_len
;
393 int wps_cred_processing
;
394 int force_per_enrollee_psk
;
396 size_t ap_settings_len
;
399 char *manufacturer_url
;
400 char *model_description
;
403 struct wpabuf
*wps_vendor_ext
[MAX_WPS_VENDOR_EXTENSIONS
];
404 int wps_nfc_pw_from_config
;
405 int wps_nfc_dev_pw_id
;
406 struct wpabuf
*wps_nfc_dh_pubkey
;
407 struct wpabuf
*wps_nfc_dh_privkey
;
408 struct wpabuf
*wps_nfc_dev_pw
;
409 #endif /* CONFIG_WPS */
413 #define P2P_ENABLED BIT(0)
414 #define P2P_GROUP_OWNER BIT(1)
415 #define P2P_GROUP_FORMATION BIT(2)
416 #define P2P_MANAGE BIT(3)
417 #define P2P_ALLOW_CROSS_CONNECTION BIT(4)
424 #endif /* CONFIG_P2P */
426 int disassoc_low_ack
;
427 int skip_inactivity_poll
;
429 #define TDLS_PROHIBIT BIT(0)
430 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
436 int time_advertisement
;
441 /* IEEE 802.11u - Interworking */
443 int access_network_type
;
453 /* IEEE 802.11u - Roaming Consortium list */
454 unsigned int roaming_consortium_count
;
455 struct hostapd_roaming_consortium
*roaming_consortium
;
457 /* IEEE 802.11u - Venue Name duples */
458 unsigned int venue_name_count
;
459 struct hostapd_lang_string
*venue_name
;
461 /* IEEE 802.11u - Network Authentication Type */
462 u8
*network_auth_type
;
463 size_t network_auth_type_len
;
465 /* IEEE 802.11u - IP Address Type Availability */
466 u8 ipaddr_type_availability
;
467 u8 ipaddr_type_configured
;
469 /* IEEE 802.11u - 3GPP Cellular Network */
470 u8
*anqp_3gpp_cell_net
;
471 size_t anqp_3gpp_cell_net_len
;
473 /* IEEE 802.11u - Domain Name */
475 size_t domain_name_len
;
477 unsigned int nai_realm_count
;
478 struct hostapd_nai_realm_data
*nai_realm_data
;
480 u16 gas_comeback_delay
;
483 u8 qos_map_set
[16 + 2 * 21];
484 unsigned int qos_map_set_len
;
492 unsigned int hs20_oper_friendly_name_count
;
493 struct hostapd_lang_string
*hs20_oper_friendly_name
;
494 u8
*hs20_wan_metrics
;
495 u8
*hs20_connection_capability
;
496 size_t hs20_connection_capability_len
;
497 u8
*hs20_operating_class
;
498 u8 hs20_operating_class_len
;
507 size_t hs20_icons_count
;
508 u8 osu_ssid
[HOSTAPD_MAX_SSID_LEN
];
510 struct hs20_osu_provider
{
511 unsigned int friendly_name_count
;
512 struct hostapd_lang_string
*friendly_name
;
518 unsigned int service_desc_count
;
519 struct hostapd_lang_string
*service_desc
;
520 } *hs20_osu_providers
, *last_osu
;
521 size_t hs20_osu_providers_count
;
522 unsigned int hs20_deauth_req_timeout
;
523 char *subscr_remediation_url
;
524 u8 subscr_remediation_method
;
525 #endif /* CONFIG_HS20 */
527 u8 wps_rf_bands
; /* RF bands for WPS (WPS_RF_*) */
529 #ifdef CONFIG_RADIUS_TEST
531 #endif /* CONFIG_RADIUS_TEST */
533 struct wpabuf
*vendor_elements
;
535 unsigned int sae_anti_clogging_threshold
;
538 #ifdef CONFIG_TESTING_OPTIONS
540 u8 bss_load_test_set
;
541 #endif /* CONFIG_TESTING_OPTIONS */
543 #define MESH_ENABLED BIT(0)
549 * struct hostapd_config - Per-radio interface configuration
551 struct hostapd_config
{
552 struct hostapd_bss_config
**bss
, *last_bss
;
558 u8 send_probe_response
;
561 enum hostapd_hw_mode hw_mode
; /* HOSTAPD_MODE_IEEE80211A, .. */
567 int *supported_rates
;
570 const struct wpa_driver_ops
*driver
;
572 int ap_table_max_size
;
573 int ap_table_expiration_time
;
575 char country
[3]; /* first two octets: country code as described in
576 * ISO/IEC 3166-1. Third octet:
577 * ' ' (ascii 32): all environments
578 * 'O': Outdoor environemnt only
579 * 'I': Indoor environment only
584 int ieee80211h
; /* DFS */
587 * Local power constraint is an octet encoded as an unsigned integer in
588 * units of decibels. Invalid value -1 indicates that Power Constraint
589 * element will not be added.
591 int local_pwr_constraint
;
593 /* Control Spectrum Management bit */
594 int spectrum_mgmt_required
;
596 struct hostapd_tx_queue_params tx_queue
[NUM_TX_QUEUES
];
599 * WMM AC parameters, in same order as 802.1D, i.e.
600 * 0 = BE (best effort)
601 * 1 = BK (background)
605 struct hostapd_wmm_ac_params wmm_ac_params
[4];
607 int ht_op_mode_fixed
;
610 int secondary_channel
;
617 u8 vht_oper_centr_freq_seg0_idx
;
618 u8 vht_oper_centr_freq_seg1_idx
;
620 #ifdef CONFIG_TESTING_OPTIONS
621 double ignore_probe_probability
;
622 double ignore_auth_probability
;
623 double ignore_assoc_probability
;
624 double ignore_reassoc_probability
;
625 double corrupt_gtk_rekey_mic_probability
;
626 #endif /* CONFIG_TESTING_OPTIONS */
629 unsigned int acs_num_scans
;
630 #endif /* CONFIG_ACS */
634 int hostapd_mac_comp(const void *a
, const void *b
);
635 int hostapd_mac_comp_empty(const void *a
);
636 struct hostapd_config
* hostapd_config_defaults(void);
637 void hostapd_config_defaults_bss(struct hostapd_bss_config
*bss
);
638 void hostapd_config_free_eap_user(struct hostapd_eap_user
*user
);
639 void hostapd_config_free_bss(struct hostapd_bss_config
*conf
);
640 void hostapd_config_free(struct hostapd_config
*conf
);
641 int hostapd_maclist_found(struct mac_acl_entry
*list
, int num_entries
,
642 const u8
*addr
, int *vlan_id
);
643 int hostapd_rate_found(int *list
, int rate
);
644 const u8
* hostapd_get_psk(const struct hostapd_bss_config
*conf
,
645 const u8
*addr
, const u8
*p2p_dev_addr
,
647 int hostapd_setup_wpa_psk(struct hostapd_bss_config
*conf
);
648 int hostapd_vlan_id_valid(struct hostapd_vlan
*vlan
, int vlan_id
);
649 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan
*vlan
,
651 struct hostapd_radius_attr
*
652 hostapd_config_get_radius_attr(struct hostapd_radius_attr
*attr
, u8 type
);
653 int hostapd_config_check(struct hostapd_config
*conf
, int full_config
);
654 void hostapd_set_security_params(struct hostapd_bss_config
*bss
,
657 #endif /* HOSTAPD_CONFIG_H */