ap_config.h revision 1f69aa52ea2e0a73ac502565df8c666ee49cab6a
1/* 2 * hostapd / Configuration definitions and helpers functions 3 * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi> 4 * 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. 8 * 9 * Alternatively, this software may be distributed under the terms of BSD 10 * license. 11 * 12 * See README and COPYING for more details. 13 */ 14 15#ifndef HOSTAPD_CONFIG_H 16#define HOSTAPD_CONFIG_H 17 18#include "common/defs.h" 19#include "ip_addr.h" 20#include "common/wpa_common.h" 21#include "wps/wps.h" 22 23#define MAX_STA_COUNT 2007 24#define MAX_VLAN_ID 4094 25 26typedef u8 macaddr[ETH_ALEN]; 27 28struct mac_acl_entry { 29 macaddr addr; 30 int vlan_id; 31}; 32 33struct hostapd_radius_servers; 34struct ft_remote_r0kh; 35struct ft_remote_r1kh; 36 37#define HOSTAPD_MAX_SSID_LEN 32 38 39#define NUM_WEP_KEYS 4 40struct hostapd_wep_keys { 41 u8 idx; 42 u8 *key[NUM_WEP_KEYS]; 43 size_t len[NUM_WEP_KEYS]; 44 int keys_set; 45 size_t default_len; /* key length used for dynamic key generation */ 46}; 47 48typedef enum hostap_security_policy { 49 SECURITY_PLAINTEXT = 0, 50 SECURITY_STATIC_WEP = 1, 51 SECURITY_IEEE_802_1X = 2, 52 SECURITY_WPA_PSK = 3, 53 SECURITY_WPA = 4 54} secpolicy; 55 56struct hostapd_ssid { 57 char ssid[HOSTAPD_MAX_SSID_LEN + 1]; 58 size_t ssid_len; 59 int ssid_set; 60 61 char vlan[IFNAMSIZ + 1]; 62 secpolicy security_policy; 63 64 struct hostapd_wpa_psk *wpa_psk; 65 char *wpa_passphrase; 66 char *wpa_psk_file; 67 68 struct hostapd_wep_keys wep; 69 70#define DYNAMIC_VLAN_DISABLED 0 71#define DYNAMIC_VLAN_OPTIONAL 1 72#define DYNAMIC_VLAN_REQUIRED 2 73 int dynamic_vlan; 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; 79}; 80 81 82#define VLAN_ID_WILDCARD -1 83 84struct hostapd_vlan { 85 struct hostapd_vlan *next; 86 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */ 87 char ifname[IFNAMSIZ + 1]; 88 int dynamic_vlan; 89#ifdef CONFIG_FULL_DYNAMIC_VLAN 90 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 95 int clean; 96#endif /* CONFIG_FULL_DYNAMIC_VLAN */ 97}; 98 99#define PMK_LEN 32 100struct hostapd_wpa_psk { 101 struct hostapd_wpa_psk *next; 102 int group; 103 u8 psk[PMK_LEN]; 104 u8 addr[ETH_ALEN]; 105}; 106 107struct hostapd_eap_user { 108 struct hostapd_eap_user *next; 109 u8 *identity; 110 size_t identity_len; 111 struct { 112 int vendor; 113 u32 method; 114 } methods[EAP_MAX_METHODS]; 115 u8 *password; 116 size_t password_len; 117 int phase2; 118 int force_version; 119 unsigned int wildcard_prefix:1; 120 unsigned int password_hash:1; /* whether password is hashed with 121 * nt_password_hash() */ 122 int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */ 123}; 124 125 126#define NUM_TX_QUEUES 4 127 128struct hostapd_tx_queue_params { 129 int aifs; 130 int cwmin; 131 int cwmax; 132 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */ 133}; 134 135struct hostapd_wmm_ac_params { 136 int cwmin; 137 int cwmax; 138 int aifs; 139 int txop_limit; /* in units of 32us */ 140 int admission_control_mandatory; 141}; 142 143 144#define MAX_ROAMING_CONSORTIUM_LEN 15 145 146struct hostapd_roaming_consortium { 147 u8 len; 148 u8 oi[MAX_ROAMING_CONSORTIUM_LEN]; 149}; 150 151/** 152 * struct hostapd_bss_config - Per-BSS configuration 153 */ 154struct hostapd_bss_config { 155 char iface[IFNAMSIZ + 1]; 156 char bridge[IFNAMSIZ + 1]; 157 char wds_bridge[IFNAMSIZ + 1]; 158 159 enum hostapd_logger_level logger_syslog_level, logger_stdout_level; 160 161 unsigned int logger_syslog; /* module bitfield */ 162 unsigned int logger_stdout; /* module bitfield */ 163 164 char *dump_log_name; /* file name for state dump (SIGUSR1) */ 165 166 int max_num_sta; /* maximum number of STAs in station table */ 167 168 int dtim_period; 169 170 int ieee802_1x; /* use IEEE 802.1X */ 171 int eapol_version; 172 int eap_server; /* Use internal EAP server instead of external 173 * RADIUS server */ 174 struct hostapd_eap_user *eap_user; 175 char *eap_sim_db; 176 struct hostapd_ip_addr own_ip_addr; 177 char *nas_identifier; 178 struct hostapd_radius_servers *radius; 179 int acct_interim_interval; 180 181 struct hostapd_ssid ssid; 182 183 char *eap_req_id_text; /* optional displayable message sent with 184 * EAP Request-Identity */ 185 size_t eap_req_id_text_len; 186 int eapol_key_index_workaround; 187 188 size_t default_wep_key_len; 189 int individual_wep_key_len; 190 int wep_rekeying_period; 191 int broadcast_key_idx_min, broadcast_key_idx_max; 192 int eap_reauth_period; 193 194 int ieee802_11f; /* use IEEE 802.11f (IAPP) */ 195 char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast 196 * frames */ 197 198 enum { 199 ACCEPT_UNLESS_DENIED = 0, 200 DENY_UNLESS_ACCEPTED = 1, 201 USE_EXTERNAL_RADIUS_AUTH = 2 202 } macaddr_acl; 203 struct mac_acl_entry *accept_mac; 204 int num_accept_mac; 205 struct mac_acl_entry *deny_mac; 206 int num_deny_mac; 207 int wds_sta; 208 int isolate; 209 210 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication 211 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */ 212 213 int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */ 214 int wpa_key_mgmt; 215#ifdef CONFIG_IEEE80211W 216 enum mfp_options ieee80211w; 217 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */ 218 unsigned int assoc_sa_query_max_timeout; 219 /* dot11AssociationSAQueryRetryTimeout (in TUs) */ 220 int assoc_sa_query_retry_timeout; 221#endif /* CONFIG_IEEE80211W */ 222 enum { 223 PSK_RADIUS_IGNORED = 0, 224 PSK_RADIUS_ACCEPTED = 1, 225 PSK_RADIUS_REQUIRED = 2 226 } wpa_psk_radius; 227 int wpa_pairwise; 228 int wpa_group; 229 int wpa_group_rekey; 230 int wpa_strict_rekey; 231 int wpa_gmk_rekey; 232 int wpa_ptk_rekey; 233 int rsn_pairwise; 234 int rsn_preauth; 235 char *rsn_preauth_interfaces; 236 int peerkey; 237 238#ifdef CONFIG_IEEE80211R 239 /* IEEE 802.11r - Fast BSS Transition */ 240 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN]; 241 u8 r1_key_holder[FT_R1KH_ID_LEN]; 242 u32 r0_key_lifetime; 243 u32 reassociation_deadline; 244 struct ft_remote_r0kh *r0kh_list; 245 struct ft_remote_r1kh *r1kh_list; 246 int pmk_r1_push; 247 int ft_over_ds; 248#endif /* CONFIG_IEEE80211R */ 249 250 char *ctrl_interface; /* directory for UNIX domain sockets */ 251#ifndef CONFIG_NATIVE_WINDOWS 252 gid_t ctrl_interface_gid; 253#endif /* CONFIG_NATIVE_WINDOWS */ 254 int ctrl_interface_gid_set; 255 256 char *ca_cert; 257 char *server_cert; 258 char *private_key; 259 char *private_key_passwd; 260 int check_crl; 261 char *dh_file; 262 u8 *pac_opaque_encr_key; 263 u8 *eap_fast_a_id; 264 size_t eap_fast_a_id_len; 265 char *eap_fast_a_id_info; 266 int eap_fast_prov; 267 int pac_key_lifetime; 268 int pac_key_refresh_time; 269 int eap_sim_aka_result_ind; 270 int tnc; 271 int fragment_size; 272 u16 pwd_group; 273 274 char *radius_server_clients; 275 int radius_server_auth_port; 276 int radius_server_ipv6; 277 278 char *test_socket; /* UNIX domain socket path for driver_test */ 279 280 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group 281 * address instead of individual address 282 * (for driver_wired.c). 283 */ 284 285 int ap_max_inactivity; 286 int ignore_broadcast_ssid; 287 288 int wmm_enabled; 289 int wmm_uapsd; 290 291 struct hostapd_vlan *vlan, *vlan_tail; 292 293 macaddr bssid; 294 295 /* 296 * Maximum listen interval that STAs can use when associating with this 297 * BSS. If a STA tries to use larger value, the association will be 298 * denied with status code 51. 299 */ 300 u16 max_listen_interval; 301 302 int disable_pmksa_caching; 303 int okc; /* Opportunistic Key Caching */ 304 305 int wps_state; 306#ifdef CONFIG_WPS 307 int ap_setup_locked; 308 u8 uuid[16]; 309 char *wps_pin_requests; 310 char *device_name; 311 char *manufacturer; 312 char *model_name; 313 char *model_number; 314 char *serial_number; 315 u8 device_type[WPS_DEV_TYPE_LEN]; 316 char *config_methods; 317 u8 os_version[4]; 318 char *ap_pin; 319 int skip_cred_build; 320 u8 *extra_cred; 321 size_t extra_cred_len; 322 int wps_cred_processing; 323 u8 *ap_settings; 324 size_t ap_settings_len; 325 char *upnp_iface; 326 char *friendly_name; 327 char *manufacturer_url; 328 char *model_description; 329 char *model_url; 330 char *upc; 331 struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS]; 332#endif /* CONFIG_WPS */ 333 int pbc_in_m1; 334 335#define P2P_ENABLED BIT(0) 336#define P2P_GROUP_OWNER BIT(1) 337#define P2P_GROUP_FORMATION BIT(2) 338#define P2P_MANAGE BIT(3) 339#define P2P_ALLOW_CROSS_CONNECTION BIT(4) 340 int p2p; 341 342 int disassoc_low_ack; 343 int skip_inactivity_poll; 344 345#define TDLS_PROHIBIT BIT(0) 346#define TDLS_PROHIBIT_CHAN_SWITCH BIT(1) 347 int tdls; 348 int disable_11n; 349 350 /* IEEE 802.11v */ 351 int time_advertisement; 352 char *time_zone; 353 354 /* IEEE 802.11u - Interworking */ 355 int interworking; 356 int access_network_type; 357 int internet; 358 int asra; 359 int esr; 360 int uesa; 361 int venue_info_set; 362 u8 venue_group; 363 u8 venue_type; 364 u8 hessid[ETH_ALEN]; 365 366 /* IEEE 802.11u - Roaming Consortium list */ 367 unsigned int roaming_consortium_count; 368 struct hostapd_roaming_consortium *roaming_consortium; 369 370 u8 wps_rf_bands; /* RF bands for WPS (WPS_RF_*) */ 371 372#ifdef CONFIG_RADIUS_TEST 373 char *dump_msk_file; 374#endif /* CONFIG_RADIUS_TEST */ 375}; 376 377 378/** 379 * struct hostapd_config - Per-radio interface configuration 380 */ 381struct hostapd_config { 382 struct hostapd_bss_config *bss, *last_bss; 383 size_t num_bss; 384 385 u16 beacon_int; 386 int rts_threshold; 387 int fragm_threshold; 388 u8 send_probe_response; 389 u8 channel; 390 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */ 391 enum { 392 LONG_PREAMBLE = 0, 393 SHORT_PREAMBLE = 1 394 } preamble; 395 396 int *supported_rates; 397 int *basic_rates; 398 399 const struct wpa_driver_ops *driver; 400 401 int ap_table_max_size; 402 int ap_table_expiration_time; 403 404 char country[3]; /* first two octets: country code as described in 405 * ISO/IEC 3166-1. Third octet: 406 * ' ' (ascii 32): all environments 407 * 'O': Outdoor environemnt only 408 * 'I': Indoor environment only 409 */ 410 411 int ieee80211d; 412 413 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES]; 414 415 /* 416 * WMM AC parameters, in same order as 802.1D, i.e. 417 * 0 = BE (best effort) 418 * 1 = BK (background) 419 * 2 = VI (video) 420 * 3 = VO (voice) 421 */ 422 struct hostapd_wmm_ac_params wmm_ac_params[4]; 423 424 int ht_op_mode_fixed; 425 u16 ht_capab; 426 int ieee80211n; 427 int secondary_channel; 428 int require_ht; 429}; 430 431 432int hostapd_mac_comp(const void *a, const void *b); 433int hostapd_mac_comp_empty(const void *a); 434struct hostapd_config * hostapd_config_defaults(void); 435void hostapd_config_defaults_bss(struct hostapd_bss_config *bss); 436void hostapd_config_free(struct hostapd_config *conf); 437int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries, 438 const u8 *addr, int *vlan_id); 439int hostapd_rate_found(int *list, int rate); 440int hostapd_wep_key_cmp(struct hostapd_wep_keys *a, 441 struct hostapd_wep_keys *b); 442const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf, 443 const u8 *addr, const u8 *prev_psk); 444int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf); 445const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan, 446 int vlan_id); 447const struct hostapd_eap_user * 448hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity, 449 size_t identity_len, int phase2); 450 451#endif /* HOSTAPD_CONFIG_H */ 452