1 /* 2 * WPA Supplicant / Network configuration structures 3 * Copyright (c) 2003-2013, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef CONFIG_SSID_H 10 #define CONFIG_SSID_H 11 12 #include "common/defs.h" 13 #include "utils/list.h" 14 #include "eap_peer/eap_config.h" 15 16 #define MAX_SSID_LEN 32 17 18 19 #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) 20 #define DEFAULT_EAPOL_FLAGS (EAPOL_FLAG_REQUIRE_KEY_UNICAST | \ 21 EAPOL_FLAG_REQUIRE_KEY_BROADCAST) 22 #define DEFAULT_PROTO (WPA_PROTO_WPA | WPA_PROTO_RSN) 23 #define DEFAULT_KEY_MGMT (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X) 24 #define DEFAULT_PAIRWISE (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP) 25 #define DEFAULT_GROUP (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP | \ 26 WPA_CIPHER_WEP104 | WPA_CIPHER_WEP40) 27 #define DEFAULT_FRAGMENT_SIZE 1398 28 29 #define DEFAULT_BG_SCAN_PERIOD -1 30 #define DEFAULT_MESH_MAX_RETRIES 2 31 #define DEFAULT_MESH_RETRY_TIMEOUT 40 32 #define DEFAULT_MESH_CONFIRM_TIMEOUT 40 33 #define DEFAULT_MESH_HOLDING_TIMEOUT 40 34 #define DEFAULT_DISABLE_HT 0 35 #define DEFAULT_DISABLE_HT40 0 36 #define DEFAULT_DISABLE_SGI 0 37 #define DEFAULT_DISABLE_LDPC 0 38 #define DEFAULT_DISABLE_MAX_AMSDU -1 /* no change */ 39 #define DEFAULT_AMPDU_FACTOR -1 /* no change */ 40 #define DEFAULT_AMPDU_DENSITY -1 /* no change */ 41 #define DEFAULT_USER_SELECTED_SIM 1 42 43 struct psk_list_entry { 44 struct dl_list list; 45 u8 addr[ETH_ALEN]; 46 u8 psk[32]; 47 u8 p2p; 48 }; 49 50 /** 51 * struct wpa_ssid - Network configuration data 52 * 53 * This structure includes all the configuration variables for a network. This 54 * data is included in the per-interface configuration data as an element of 55 * the network list, struct wpa_config::ssid. Each network block in the 56 * configuration is mapped to a struct wpa_ssid instance. 57 */ 58 struct wpa_ssid { 59 /** 60 * next - Next network in global list 61 * 62 * This pointer can be used to iterate over all networks. The head of 63 * this list is stored in the ssid field of struct wpa_config. 64 */ 65 struct wpa_ssid *next; 66 67 /** 68 * pnext - Next network in per-priority list 69 * 70 * This pointer can be used to iterate over all networks in the same 71 * priority class. The heads of these list are stored in the pssid 72 * fields of struct wpa_config. 73 */ 74 struct wpa_ssid *pnext; 75 76 /** 77 * id - Unique id for the network 78 * 79 * This identifier is used as a unique identifier for each network 80 * block when using the control interface. Each network is allocated an 81 * id when it is being created, either when reading the configuration 82 * file or when a new network is added through the control interface. 83 */ 84 int id; 85 86 /** 87 * priority - Priority group 88 * 89 * By default, all networks will get same priority group (0). If some 90 * of the networks are more desirable, this field can be used to change 91 * the order in which wpa_supplicant goes through the networks when 92 * selecting a BSS. The priority groups will be iterated in decreasing 93 * priority (i.e., the larger the priority value, the sooner the 94 * network is matched against the scan results). Within each priority 95 * group, networks will be selected based on security policy, signal 96 * strength, etc. 97 * 98 * Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are 99 * not using this priority to select the order for scanning. Instead, 100 * they try the networks in the order that used in the configuration 101 * file. 102 */ 103 int priority; 104 105 /** 106 * ssid - Service set identifier (network name) 107 * 108 * This is the SSID for the network. For wireless interfaces, this is 109 * used to select which network will be used. If set to %NULL (or 110 * ssid_len=0), any SSID can be used. For wired interfaces, this must 111 * be set to %NULL. Note: SSID may contain any characters, even nul 112 * (ASCII 0) and as such, this should not be assumed to be a nul 113 * terminated string. ssid_len defines how many characters are valid 114 * and the ssid field is not guaranteed to be nul terminated. 115 */ 116 u8 *ssid; 117 118 /** 119 * ssid_len - Length of the SSID 120 */ 121 size_t ssid_len; 122 123 /** 124 * bssid - BSSID 125 * 126 * If set, this network block is used only when associating with the AP 127 * using the configured BSSID 128 * 129 * If this is a persistent P2P group (disabled == 2), this is the GO 130 * Device Address. 131 */ 132 u8 bssid[ETH_ALEN]; 133 134 /** 135 * bssid_blacklist - List of inacceptable BSSIDs 136 */ 137 u8 *bssid_blacklist; 138 size_t num_bssid_blacklist; 139 140 /** 141 * bssid_blacklist - List of acceptable BSSIDs 142 */ 143 u8 *bssid_whitelist; 144 size_t num_bssid_whitelist; 145 146 /** 147 * bssid_set - Whether BSSID is configured for this network 148 */ 149 int bssid_set; 150 151 /** 152 * go_p2p_dev_addr - GO's P2P Device Address or all zeros if not set 153 */ 154 u8 go_p2p_dev_addr[ETH_ALEN]; 155 156 /** 157 * psk - WPA pre-shared key (256 bits) 158 */ 159 u8 psk[32]; 160 161 /** 162 * psk_set - Whether PSK field is configured 163 */ 164 int psk_set; 165 166 /** 167 * passphrase - WPA ASCII passphrase 168 * 169 * If this is set, psk will be generated using the SSID and passphrase 170 * configured for the network. ASCII passphrase must be between 8 and 171 * 63 characters (inclusive). 172 */ 173 char *passphrase; 174 175 /** 176 * ext_psk - PSK/passphrase name in external storage 177 * 178 * If this is set, PSK/passphrase will be fetched from external storage 179 * when requesting association with the network. 180 */ 181 char *ext_psk; 182 183 /** 184 * pairwise_cipher - Bitfield of allowed pairwise ciphers, WPA_CIPHER_* 185 */ 186 int pairwise_cipher; 187 188 /** 189 * group_cipher - Bitfield of allowed group ciphers, WPA_CIPHER_* 190 */ 191 int group_cipher; 192 193 /** 194 * key_mgmt - Bitfield of allowed key management protocols 195 * 196 * WPA_KEY_MGMT_* 197 */ 198 int key_mgmt; 199 200 /** 201 * bg_scan_period - Background scan period in seconds, 0 to disable, or 202 * -1 to indicate no change to default driver configuration 203 */ 204 int bg_scan_period; 205 206 /** 207 * proto - Bitfield of allowed protocols, WPA_PROTO_* 208 */ 209 int proto; 210 211 /** 212 * auth_alg - Bitfield of allowed authentication algorithms 213 * 214 * WPA_AUTH_ALG_* 215 */ 216 int auth_alg; 217 218 /** 219 * scan_ssid - Scan this SSID with Probe Requests 220 * 221 * scan_ssid can be used to scan for APs using hidden SSIDs. 222 * Note: Many drivers do not support this. ap_mode=2 can be used with 223 * such drivers to use hidden SSIDs. 224 */ 225 int scan_ssid; 226 227 #ifdef IEEE8021X_EAPOL 228 #define EAPOL_FLAG_REQUIRE_KEY_UNICAST BIT(0) 229 #define EAPOL_FLAG_REQUIRE_KEY_BROADCAST BIT(1) 230 /** 231 * eapol_flags - Bit field of IEEE 802.1X/EAPOL options (EAPOL_FLAG_*) 232 */ 233 int eapol_flags; 234 235 /** 236 * eap - EAP peer configuration for this network 237 */ 238 struct eap_peer_config eap; 239 #endif /* IEEE8021X_EAPOL */ 240 241 #define NUM_WEP_KEYS 4 242 #define MAX_WEP_KEY_LEN 16 243 /** 244 * wep_key - WEP keys 245 */ 246 u8 wep_key[NUM_WEP_KEYS][MAX_WEP_KEY_LEN]; 247 248 /** 249 * wep_key_len - WEP key lengths 250 */ 251 size_t wep_key_len[NUM_WEP_KEYS]; 252 253 /** 254 * wep_tx_keyidx - Default key index for TX frames using WEP 255 */ 256 int wep_tx_keyidx; 257 258 /** 259 * proactive_key_caching - Enable proactive key caching 260 * 261 * This field can be used to enable proactive key caching which is also 262 * known as opportunistic PMKSA caching for WPA2. This is disabled (0) 263 * by default unless default value is changed with the global okc=1 264 * parameter. Enable by setting this to 1. 265 * 266 * Proactive key caching is used to make supplicant assume that the APs 267 * are using the same PMK and generate PMKSA cache entries without 268 * doing RSN pre-authentication. This requires support from the AP side 269 * and is normally used with wireless switches that co-locate the 270 * authenticator. 271 * 272 * Internally, special value -1 is used to indicate that the parameter 273 * was not specified in the configuration (i.e., default behavior is 274 * followed). 275 */ 276 int proactive_key_caching; 277 278 /** 279 * mixed_cell - Whether mixed cells are allowed 280 * 281 * This option can be used to configure whether so called mixed cells, 282 * i.e., networks that use both plaintext and encryption in the same 283 * SSID, are allowed. This is disabled (0) by default. Enable by 284 * setting this to 1. 285 */ 286 int mixed_cell; 287 288 #ifdef IEEE8021X_EAPOL 289 290 /** 291 * leap - Number of EAP methods using LEAP 292 * 293 * This field should be set to 1 if LEAP is enabled. This is used to 294 * select IEEE 802.11 authentication algorithm. 295 */ 296 int leap; 297 298 /** 299 * non_leap - Number of EAP methods not using LEAP 300 * 301 * This field should be set to >0 if any EAP method other than LEAP is 302 * enabled. This is used to select IEEE 802.11 authentication 303 * algorithm. 304 */ 305 int non_leap; 306 307 /** 308 * eap_workaround - EAP workarounds enabled 309 * 310 * wpa_supplicant supports number of "EAP workarounds" to work around 311 * interoperability issues with incorrectly behaving authentication 312 * servers. This is recommended to be enabled by default because some 313 * of the issues are present in large number of authentication servers. 314 * 315 * Strict EAP conformance mode can be configured by disabling 316 * workarounds with eap_workaround = 0. 317 */ 318 unsigned int eap_workaround; 319 320 #endif /* IEEE8021X_EAPOL */ 321 322 /** 323 * mode - IEEE 802.11 operation mode (Infrastucture/IBSS) 324 * 325 * 0 = infrastructure (Managed) mode, i.e., associate with an AP. 326 * 327 * 1 = IBSS (ad-hoc, peer-to-peer) 328 * 329 * 2 = AP (access point) 330 * 331 * 3 = P2P Group Owner (can be set in the configuration file) 332 * 333 * 4 = P2P Group Formation (used internally; not in configuration 334 * files) 335 * 336 * 5 = Mesh 337 * 338 * Note: IBSS can only be used with key_mgmt NONE (plaintext and static 339 * WEP) and WPA-PSK (with proto=RSN). In addition, key_mgmt=WPA-NONE 340 * (fixed group key TKIP/CCMP) is available for backwards compatibility, 341 * but its use is deprecated. WPA-None requires following network block 342 * options: proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or 343 * CCMP, but not both), and psk must also be set (either directly or 344 * using ASCII passphrase). 345 */ 346 enum wpas_mode { 347 WPAS_MODE_INFRA = 0, 348 WPAS_MODE_IBSS = 1, 349 WPAS_MODE_AP = 2, 350 WPAS_MODE_P2P_GO = 3, 351 WPAS_MODE_P2P_GROUP_FORMATION = 4, 352 WPAS_MODE_MESH = 5, 353 } mode; 354 355 /** 356 * disabled - Whether this network is currently disabled 357 * 358 * 0 = this network can be used (default). 359 * 1 = this network block is disabled (can be enabled through 360 * ctrl_iface, e.g., with wpa_cli or wpa_gui). 361 * 2 = this network block includes parameters for a persistent P2P 362 * group (can be used with P2P ctrl_iface commands) 363 */ 364 int disabled; 365 366 /** 367 * disabled_for_connect - Whether this network was temporarily disabled 368 * 369 * This flag is used to reenable all the temporarily disabled networks 370 * after either the success or failure of a WPS connection. 371 */ 372 int disabled_for_connect; 373 374 /** 375 * peerkey - Whether PeerKey handshake for direct links is allowed 376 * 377 * This is only used when both RSN/WPA2 and IEEE 802.11e (QoS) are 378 * enabled. 379 * 380 * 0 = disabled (default) 381 * 1 = enabled 382 */ 383 int peerkey; 384 385 /** 386 * id_str - Network identifier string for external scripts 387 * 388 * This value is passed to external ctrl_iface monitors in 389 * WPA_EVENT_CONNECTED event and wpa_cli sets this as WPA_ID_STR 390 * environment variable for action scripts. 391 */ 392 char *id_str; 393 394 #ifdef CONFIG_IEEE80211W 395 /** 396 * ieee80211w - Whether management frame protection is enabled 397 * 398 * This value is used to configure policy for management frame 399 * protection (IEEE 802.11w). 0 = disabled, 1 = optional, 2 = required. 400 * This is disabled by default unless the default value has been changed 401 * with the global pmf=1/2 parameter. 402 * 403 * Internally, special value 3 is used to indicate that the parameter 404 * was not specified in the configuration (i.e., default behavior is 405 * followed). 406 */ 407 enum mfp_options ieee80211w; 408 #endif /* CONFIG_IEEE80211W */ 409 410 /** 411 * frequency - Channel frequency in megahertz (MHz) for IBSS 412 * 413 * This value is used to configure the initial channel for IBSS (adhoc) 414 * networks, e.g., 2412 = IEEE 802.11b/g channel 1. It is ignored in 415 * the infrastructure mode. In addition, this value is only used by the 416 * station that creates the IBSS. If an IBSS network with the 417 * configured SSID is already present, the frequency of the network 418 * will be used instead of this configured value. 419 */ 420 int frequency; 421 422 /** 423 * fixed_freq - Use fixed frequency for IBSS 424 */ 425 int fixed_freq; 426 427 /** 428 * mesh_basic_rates - BSS Basic rate set for mesh network 429 * 430 */ 431 int *mesh_basic_rates; 432 433 /** 434 * Mesh network plink parameters 435 */ 436 int dot11MeshMaxRetries; 437 int dot11MeshRetryTimeout; /* msec */ 438 int dot11MeshConfirmTimeout; /* msec */ 439 int dot11MeshHoldingTimeout; /* msec */ 440 441 int ht40; 442 443 int vht; 444 445 /** 446 * wpa_ptk_rekey - Maximum lifetime for PTK in seconds 447 * 448 * This value can be used to enforce rekeying of PTK to mitigate some 449 * attacks against TKIP deficiencies. 450 */ 451 int wpa_ptk_rekey; 452 453 /** 454 * scan_freq - Array of frequencies to scan or %NULL for all 455 * 456 * This is an optional zero-terminated array of frequencies in 457 * megahertz (MHz) to include in scan requests when searching for this 458 * network. This can be used to speed up scanning when the network is 459 * known to not use all possible channels. 460 */ 461 int *scan_freq; 462 463 /** 464 * bgscan - Background scan and roaming parameters or %NULL if none 465 * 466 * This is an optional set of parameters for background scanning and 467 * roaming within a network (ESS) in following format: 468 * <bgscan module name>:<module parameters> 469 */ 470 char *bgscan; 471 472 /** 473 * ignore_broadcast_ssid - Hide SSID in AP mode 474 * 475 * Send empty SSID in beacons and ignore probe request frames that do 476 * not specify full SSID, i.e., require stations to know SSID. 477 * default: disabled (0) 478 * 1 = send empty (length=0) SSID in beacon and ignore probe request 479 * for broadcast SSID 480 * 2 = clear SSID (ASCII 0), but keep the original length (this may be 481 * required with some clients that do not support empty SSID) and 482 * ignore probe requests for broadcast SSID 483 */ 484 int ignore_broadcast_ssid; 485 486 /** 487 * freq_list - Array of allowed frequencies or %NULL for all 488 * 489 * This is an optional zero-terminated array of frequencies in 490 * megahertz (MHz) to allow for selecting the BSS. If set, scan results 491 * that do not match any of the specified frequencies are not 492 * considered when selecting a BSS. 493 */ 494 int *freq_list; 495 496 /** 497 * p2p_client_list - List of P2P Clients in a persistent group (GO) 498 * 499 * This is a list of P2P Clients (P2P Device Address) that have joined 500 * the persistent group. This is maintained on the GO for persistent 501 * group entries (disabled == 2). 502 */ 503 u8 *p2p_client_list; 504 505 /** 506 * num_p2p_clients - Number of entries in p2p_client_list 507 */ 508 size_t num_p2p_clients; 509 510 #ifndef P2P_MAX_STORED_CLIENTS 511 #define P2P_MAX_STORED_CLIENTS 100 512 #endif /* P2P_MAX_STORED_CLIENTS */ 513 514 /** 515 * psk_list - Per-client PSKs (struct psk_list_entry) 516 */ 517 struct dl_list psk_list; 518 519 /** 520 * p2p_group - Network generated as a P2P group (used internally) 521 */ 522 int p2p_group; 523 524 /** 525 * p2p_persistent_group - Whether this is a persistent group 526 */ 527 int p2p_persistent_group; 528 529 /** 530 * temporary - Whether this network is temporary and not to be saved 531 */ 532 int temporary; 533 534 /** 535 * export_keys - Whether keys may be exported 536 * 537 * This attribute will be set when keys are determined through 538 * WPS or similar so that they may be exported. 539 */ 540 int export_keys; 541 542 #ifdef CONFIG_HT_OVERRIDES 543 /** 544 * disable_ht - Disable HT (IEEE 802.11n) for this network 545 * 546 * By default, use it if it is available, but this can be configured 547 * to 1 to have it disabled. 548 */ 549 int disable_ht; 550 551 /** 552 * disable_ht40 - Disable HT40 for this network 553 * 554 * By default, use it if it is available, but this can be configured 555 * to 1 to have it disabled. 556 */ 557 int disable_ht40; 558 559 /** 560 * disable_sgi - Disable SGI (Short Guard Interval) for this network 561 * 562 * By default, use it if it is available, but this can be configured 563 * to 1 to have it disabled. 564 */ 565 int disable_sgi; 566 567 /** 568 * disable_ldpc - Disable LDPC for this network 569 * 570 * By default, use it if it is available, but this can be configured 571 * to 1 to have it disabled. 572 */ 573 int disable_ldpc; 574 575 /** 576 * ht40_intolerant - Indicate 40 MHz intolerant for this network 577 */ 578 int ht40_intolerant; 579 580 /** 581 * disable_max_amsdu - Disable MAX A-MSDU 582 * 583 * A-MDSU will be 3839 bytes when disabled, or 7935 584 * when enabled (assuming it is otherwise supported) 585 * -1 (default) means do not apply any settings to the kernel. 586 */ 587 int disable_max_amsdu; 588 589 /** 590 * ampdu_factor - Maximum A-MPDU Length Exponent 591 * 592 * Value: 0-3, see 7.3.2.56.3 in IEEE Std 802.11n-2009. 593 */ 594 int ampdu_factor; 595 596 /** 597 * ampdu_density - Minimum A-MPDU Start Spacing 598 * 599 * Value: 0-7, see 7.3.2.56.3 in IEEE Std 802.11n-2009. 600 */ 601 int ampdu_density; 602 603 /** 604 * ht_mcs - Allowed HT-MCS rates, in ASCII hex: ffff0000... 605 * 606 * By default (empty string): Use whatever the OS has configured. 607 */ 608 char *ht_mcs; 609 #endif /* CONFIG_HT_OVERRIDES */ 610 611 #ifdef CONFIG_VHT_OVERRIDES 612 /** 613 * disable_vht - Disable VHT (IEEE 802.11ac) for this network 614 * 615 * By default, use it if it is available, but this can be configured 616 * to 1 to have it disabled. 617 */ 618 int disable_vht; 619 620 /** 621 * vht_capa - VHT capabilities to use 622 */ 623 unsigned int vht_capa; 624 625 /** 626 * vht_capa_mask - mask for VHT capabilities 627 */ 628 unsigned int vht_capa_mask; 629 630 int vht_rx_mcs_nss_1, vht_rx_mcs_nss_2, 631 vht_rx_mcs_nss_3, vht_rx_mcs_nss_4, 632 vht_rx_mcs_nss_5, vht_rx_mcs_nss_6, 633 vht_rx_mcs_nss_7, vht_rx_mcs_nss_8; 634 int vht_tx_mcs_nss_1, vht_tx_mcs_nss_2, 635 vht_tx_mcs_nss_3, vht_tx_mcs_nss_4, 636 vht_tx_mcs_nss_5, vht_tx_mcs_nss_6, 637 vht_tx_mcs_nss_7, vht_tx_mcs_nss_8; 638 #endif /* CONFIG_VHT_OVERRIDES */ 639 640 /** 641 * ap_max_inactivity - Timeout in seconds to detect STA's inactivity 642 * 643 * This timeout value is used in AP mode to clean up inactive stations. 644 * By default: 300 seconds. 645 */ 646 int ap_max_inactivity; 647 648 /** 649 * dtim_period - DTIM period in Beacon intervals 650 * By default: 2 651 */ 652 int dtim_period; 653 654 /** 655 * beacon_int - Beacon interval (default: 100 TU) 656 */ 657 int beacon_int; 658 659 /** 660 * auth_failures - Number of consecutive authentication failures 661 */ 662 unsigned int auth_failures; 663 664 /** 665 * disabled_until - Network block disabled until this time if non-zero 666 */ 667 struct os_reltime disabled_until; 668 669 /** 670 * parent_cred - Pointer to parent wpa_cred entry 671 * 672 * This pointer can be used to delete temporary networks when a wpa_cred 673 * that was used to create them is removed. This pointer should not be 674 * dereferences since it may not be updated in all cases. 675 */ 676 void *parent_cred; 677 678 #ifdef CONFIG_MACSEC 679 /** 680 * macsec_policy - Determines the policy for MACsec secure session 681 * 682 * 0: MACsec not in use (default) 683 * 1: MACsec enabled - Should secure, accept key server's advice to 684 * determine whether to use a secure session or not. 685 */ 686 int macsec_policy; 687 #endif /* CONFIG_MACSEC */ 688 689 #ifdef CONFIG_HS20 690 int update_identifier; 691 #endif /* CONFIG_HS20 */ 692 693 unsigned int wps_run; 694 695 /** 696 * mac_addr - MAC address policy 697 * 698 * 0 = use permanent MAC address 699 * 1 = use random MAC address for each ESS connection 700 * 2 = like 1, but maintain OUI (with local admin bit set) 701 * 702 * Internally, special value -1 is used to indicate that the parameter 703 * was not specified in the configuration (i.e., default behavior is 704 * followed). 705 */ 706 int mac_addr; 707 708 /** 709 * no_auto_peer - Do not automatically peer with compatible mesh peers 710 * 711 * When unset, the reception of a beacon from a another mesh peer in 712 * this MBSS will trigger a peering attempt. 713 */ 714 int no_auto_peer; 715 }; 716 717 #endif /* CONFIG_SSID_H */ 718