23a37cc35621ab6609f494b2fce3d0644ac0a039
[mech_eap.git] / wpa_supplicant / config_ssid.h
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          * mem_only_psk - Whether to keep PSK/passphrase only in memory
185          *
186          * 0 = allow psk/passphrase to be stored to the configuration file
187          * 1 = do not store psk/passphrase to the configuration file
188          */
189         int mem_only_psk;
190
191         /**
192          * pairwise_cipher - Bitfield of allowed pairwise ciphers, WPA_CIPHER_*
193          */
194         int pairwise_cipher;
195
196         /**
197          * group_cipher - Bitfield of allowed group ciphers, WPA_CIPHER_*
198          */
199         int group_cipher;
200
201         /**
202          * key_mgmt - Bitfield of allowed key management protocols
203          *
204          * WPA_KEY_MGMT_*
205          */
206         int key_mgmt;
207
208         /**
209          * bg_scan_period - Background scan period in seconds, 0 to disable, or
210          * -1 to indicate no change to default driver configuration
211          */
212         int bg_scan_period;
213
214         /**
215          * proto - Bitfield of allowed protocols, WPA_PROTO_*
216          */
217         int proto;
218
219         /**
220          * auth_alg -  Bitfield of allowed authentication algorithms
221          *
222          * WPA_AUTH_ALG_*
223          */
224         int auth_alg;
225
226         /**
227          * scan_ssid - Scan this SSID with Probe Requests
228          *
229          * scan_ssid can be used to scan for APs using hidden SSIDs.
230          * Note: Many drivers do not support this. ap_mode=2 can be used with
231          * such drivers to use hidden SSIDs.
232          */
233         int scan_ssid;
234
235 #ifdef IEEE8021X_EAPOL
236 #define EAPOL_FLAG_REQUIRE_KEY_UNICAST BIT(0)
237 #define EAPOL_FLAG_REQUIRE_KEY_BROADCAST BIT(1)
238         /**
239          * eapol_flags - Bit field of IEEE 802.1X/EAPOL options (EAPOL_FLAG_*)
240          */
241         int eapol_flags;
242
243         /**
244          * eap - EAP peer configuration for this network
245          */
246         struct eap_peer_config eap;
247 #endif /* IEEE8021X_EAPOL */
248
249 #define NUM_WEP_KEYS 4
250 #define MAX_WEP_KEY_LEN 16
251         /**
252          * wep_key - WEP keys
253          */
254         u8 wep_key[NUM_WEP_KEYS][MAX_WEP_KEY_LEN];
255
256         /**
257          * wep_key_len - WEP key lengths
258          */
259         size_t wep_key_len[NUM_WEP_KEYS];
260
261         /**
262          * wep_tx_keyidx - Default key index for TX frames using WEP
263          */
264         int wep_tx_keyidx;
265
266         /**
267          * proactive_key_caching - Enable proactive key caching
268          *
269          * This field can be used to enable proactive key caching which is also
270          * known as opportunistic PMKSA caching for WPA2. This is disabled (0)
271          * by default unless default value is changed with the global okc=1
272          * parameter. Enable by setting this to 1.
273          *
274          * Proactive key caching is used to make supplicant assume that the APs
275          * are using the same PMK and generate PMKSA cache entries without
276          * doing RSN pre-authentication. This requires support from the AP side
277          * and is normally used with wireless switches that co-locate the
278          * authenticator.
279          *
280          * Internally, special value -1 is used to indicate that the parameter
281          * was not specified in the configuration (i.e., default behavior is
282          * followed).
283          */
284         int proactive_key_caching;
285
286         /**
287          * mixed_cell - Whether mixed cells are allowed
288          *
289          * This option can be used to configure whether so called mixed cells,
290          * i.e., networks that use both plaintext and encryption in the same
291          * SSID, are allowed. This is disabled (0) by default. Enable by
292          * setting this to 1.
293          */
294         int mixed_cell;
295
296 #ifdef IEEE8021X_EAPOL
297
298         /**
299          * leap - Number of EAP methods using LEAP
300          *
301          * This field should be set to 1 if LEAP is enabled. This is used to
302          * select IEEE 802.11 authentication algorithm.
303          */
304         int leap;
305
306         /**
307          * non_leap - Number of EAP methods not using LEAP
308          *
309          * This field should be set to >0 if any EAP method other than LEAP is
310          * enabled. This is used to select IEEE 802.11 authentication
311          * algorithm.
312          */
313         int non_leap;
314
315         /**
316          * eap_workaround - EAP workarounds enabled
317          *
318          * wpa_supplicant supports number of "EAP workarounds" to work around
319          * interoperability issues with incorrectly behaving authentication
320          * servers. This is recommended to be enabled by default because some
321          * of the issues are present in large number of authentication servers.
322          *
323          * Strict EAP conformance mode can be configured by disabling
324          * workarounds with eap_workaround = 0.
325          */
326         unsigned int eap_workaround;
327
328 #endif /* IEEE8021X_EAPOL */
329
330         /**
331          * mode - IEEE 802.11 operation mode (Infrastucture/IBSS)
332          *
333          * 0 = infrastructure (Managed) mode, i.e., associate with an AP.
334          *
335          * 1 = IBSS (ad-hoc, peer-to-peer)
336          *
337          * 2 = AP (access point)
338          *
339          * 3 = P2P Group Owner (can be set in the configuration file)
340          *
341          * 4 = P2P Group Formation (used internally; not in configuration
342          * files)
343          *
344          * 5 = Mesh
345          *
346          * Note: IBSS can only be used with key_mgmt NONE (plaintext and static
347          * WEP) and WPA-PSK (with proto=RSN). In addition, key_mgmt=WPA-NONE
348          * (fixed group key TKIP/CCMP) is available for backwards compatibility,
349          * but its use is deprecated. WPA-None requires following network block
350          * options: proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or
351          * CCMP, but not both), and psk must also be set (either directly or
352          * using ASCII passphrase).
353          */
354         enum wpas_mode {
355                 WPAS_MODE_INFRA = 0,
356                 WPAS_MODE_IBSS = 1,
357                 WPAS_MODE_AP = 2,
358                 WPAS_MODE_P2P_GO = 3,
359                 WPAS_MODE_P2P_GROUP_FORMATION = 4,
360                 WPAS_MODE_MESH = 5,
361         } mode;
362
363         /**
364          * disabled - Whether this network is currently disabled
365          *
366          * 0 = this network can be used (default).
367          * 1 = this network block is disabled (can be enabled through
368          * ctrl_iface, e.g., with wpa_cli or wpa_gui).
369          * 2 = this network block includes parameters for a persistent P2P
370          * group (can be used with P2P ctrl_iface commands)
371          */
372         int disabled;
373
374         /**
375          * disabled_for_connect - Whether this network was temporarily disabled
376          *
377          * This flag is used to reenable all the temporarily disabled networks
378          * after either the success or failure of a WPS connection.
379          */
380         int disabled_for_connect;
381
382         /**
383          * peerkey -  Whether PeerKey handshake for direct links is allowed
384          *
385          * This is only used when both RSN/WPA2 and IEEE 802.11e (QoS) are
386          * enabled.
387          *
388          * 0 = disabled (default)
389          * 1 = enabled
390          */
391         int peerkey;
392
393         /**
394          * id_str - Network identifier string for external scripts
395          *
396          * This value is passed to external ctrl_iface monitors in
397          * WPA_EVENT_CONNECTED event and wpa_cli sets this as WPA_ID_STR
398          * environment variable for action scripts.
399          */
400         char *id_str;
401
402 #ifdef CONFIG_IEEE80211W
403         /**
404          * ieee80211w - Whether management frame protection is enabled
405          *
406          * This value is used to configure policy for management frame
407          * protection (IEEE 802.11w). 0 = disabled, 1 = optional, 2 = required.
408          * This is disabled by default unless the default value has been changed
409          * with the global pmf=1/2 parameter.
410          *
411          * Internally, special value 3 is used to indicate that the parameter
412          * was not specified in the configuration (i.e., default behavior is
413          * followed).
414          */
415         enum mfp_options ieee80211w;
416 #endif /* CONFIG_IEEE80211W */
417
418         /**
419          * frequency - Channel frequency in megahertz (MHz) for IBSS
420          *
421          * This value is used to configure the initial channel for IBSS (adhoc)
422          * networks, e.g., 2412 = IEEE 802.11b/g channel 1. It is ignored in
423          * the infrastructure mode. In addition, this value is only used by the
424          * station that creates the IBSS. If an IBSS network with the
425          * configured SSID is already present, the frequency of the network
426          * will be used instead of this configured value.
427          */
428         int frequency;
429
430         /**
431          * fixed_freq - Use fixed frequency for IBSS
432          */
433         int fixed_freq;
434
435         /**
436          * mesh_basic_rates - BSS Basic rate set for mesh network
437          *
438          */
439         int *mesh_basic_rates;
440
441         /**
442          * Mesh network plink parameters
443          */
444         int dot11MeshMaxRetries;
445         int dot11MeshRetryTimeout; /* msec */
446         int dot11MeshConfirmTimeout; /* msec */
447         int dot11MeshHoldingTimeout; /* msec */
448
449         int ht40;
450
451         int vht;
452
453         /**
454          * wpa_ptk_rekey - Maximum lifetime for PTK in seconds
455          *
456          * This value can be used to enforce rekeying of PTK to mitigate some
457          * attacks against TKIP deficiencies.
458          */
459         int wpa_ptk_rekey;
460
461         /**
462          * scan_freq - Array of frequencies to scan or %NULL for all
463          *
464          * This is an optional zero-terminated array of frequencies in
465          * megahertz (MHz) to include in scan requests when searching for this
466          * network. This can be used to speed up scanning when the network is
467          * known to not use all possible channels.
468          */
469         int *scan_freq;
470
471         /**
472          * bgscan - Background scan and roaming parameters or %NULL if none
473          *
474          * This is an optional set of parameters for background scanning and
475          * roaming within a network (ESS) in following format:
476          * <bgscan module name>:<module parameters>
477          */
478         char *bgscan;
479
480         /**
481          * ignore_broadcast_ssid - Hide SSID in AP mode
482          *
483          * Send empty SSID in beacons and ignore probe request frames that do
484          * not specify full SSID, i.e., require stations to know SSID.
485          * default: disabled (0)
486          * 1 = send empty (length=0) SSID in beacon and ignore probe request
487          * for broadcast SSID
488          * 2 = clear SSID (ASCII 0), but keep the original length (this may be
489          * required with some clients that do not support empty SSID) and
490          * ignore probe requests for broadcast SSID
491          */
492         int ignore_broadcast_ssid;
493
494         /**
495          * freq_list - Array of allowed frequencies or %NULL for all
496          *
497          * This is an optional zero-terminated array of frequencies in
498          * megahertz (MHz) to allow for selecting the BSS. If set, scan results
499          * that do not match any of the specified frequencies are not
500          * considered when selecting a BSS.
501          */
502         int *freq_list;
503
504         /**
505          * p2p_client_list - List of P2P Clients in a persistent group (GO)
506          *
507          * This is a list of P2P Clients (P2P Device Address) that have joined
508          * the persistent group. This is maintained on the GO for persistent
509          * group entries (disabled == 2).
510          */
511         u8 *p2p_client_list;
512
513         /**
514          * num_p2p_clients - Number of entries in p2p_client_list
515          */
516         size_t num_p2p_clients;
517
518 #ifndef P2P_MAX_STORED_CLIENTS
519 #define P2P_MAX_STORED_CLIENTS 100
520 #endif /* P2P_MAX_STORED_CLIENTS */
521
522         /**
523          * psk_list - Per-client PSKs (struct psk_list_entry)
524          */
525         struct dl_list psk_list;
526
527         /**
528          * p2p_group - Network generated as a P2P group (used internally)
529          */
530         int p2p_group;
531
532         /**
533          * p2p_persistent_group - Whether this is a persistent group
534          */
535         int p2p_persistent_group;
536
537         /**
538          * temporary - Whether this network is temporary and not to be saved
539          */
540         int temporary;
541
542         /**
543          * export_keys - Whether keys may be exported
544          *
545          * This attribute will be set when keys are determined through
546          * WPS or similar so that they may be exported.
547          */
548         int export_keys;
549
550 #ifdef CONFIG_HT_OVERRIDES
551         /**
552          * disable_ht - Disable HT (IEEE 802.11n) 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_ht;
558
559         /**
560          * disable_ht40 - Disable HT40 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_ht40;
566
567         /**
568          * disable_sgi - Disable SGI (Short Guard Interval) 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_sgi;
574
575         /**
576          * disable_ldpc - Disable LDPC for this network
577          *
578          * By default, use it if it is available, but this can be configured
579          * to 1 to have it disabled.
580          */
581         int disable_ldpc;
582
583         /**
584          * ht40_intolerant - Indicate 40 MHz intolerant for this network
585          */
586         int ht40_intolerant;
587
588         /**
589          * disable_max_amsdu - Disable MAX A-MSDU
590          *
591          * A-MDSU will be 3839 bytes when disabled, or 7935
592          * when enabled (assuming it is otherwise supported)
593          * -1 (default) means do not apply any settings to the kernel.
594          */
595         int disable_max_amsdu;
596
597         /**
598          * ampdu_factor - Maximum A-MPDU Length Exponent
599          *
600          * Value: 0-3, see 7.3.2.56.3 in IEEE Std 802.11n-2009.
601          */
602         int ampdu_factor;
603
604         /**
605          * ampdu_density - Minimum A-MPDU Start Spacing
606          *
607          * Value: 0-7, see 7.3.2.56.3 in IEEE Std 802.11n-2009.
608          */
609         int ampdu_density;
610
611         /**
612          * ht_mcs - Allowed HT-MCS rates, in ASCII hex: ffff0000...
613          *
614          * By default (empty string): Use whatever the OS has configured.
615          */
616         char *ht_mcs;
617 #endif /* CONFIG_HT_OVERRIDES */
618
619 #ifdef CONFIG_VHT_OVERRIDES
620         /**
621          * disable_vht - Disable VHT (IEEE 802.11ac) for this network
622          *
623          * By default, use it if it is available, but this can be configured
624          * to 1 to have it disabled.
625          */
626         int disable_vht;
627
628         /**
629          * vht_capa - VHT capabilities to use
630          */
631         unsigned int vht_capa;
632
633         /**
634          * vht_capa_mask - mask for VHT capabilities
635          */
636         unsigned int vht_capa_mask;
637
638         int vht_rx_mcs_nss_1, vht_rx_mcs_nss_2,
639             vht_rx_mcs_nss_3, vht_rx_mcs_nss_4,
640             vht_rx_mcs_nss_5, vht_rx_mcs_nss_6,
641             vht_rx_mcs_nss_7, vht_rx_mcs_nss_8;
642         int vht_tx_mcs_nss_1, vht_tx_mcs_nss_2,
643             vht_tx_mcs_nss_3, vht_tx_mcs_nss_4,
644             vht_tx_mcs_nss_5, vht_tx_mcs_nss_6,
645             vht_tx_mcs_nss_7, vht_tx_mcs_nss_8;
646 #endif /* CONFIG_VHT_OVERRIDES */
647
648         /**
649          * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
650          *
651          * This timeout value is used in AP mode to clean up inactive stations.
652          * By default: 300 seconds.
653          */
654         int ap_max_inactivity;
655
656         /**
657          * dtim_period - DTIM period in Beacon intervals
658          * By default: 2
659          */
660         int dtim_period;
661
662         /**
663          * beacon_int - Beacon interval (default: 100 TU)
664          */
665         int beacon_int;
666
667         /**
668          * auth_failures - Number of consecutive authentication failures
669          */
670         unsigned int auth_failures;
671
672         /**
673          * disabled_until - Network block disabled until this time if non-zero
674          */
675         struct os_reltime disabled_until;
676
677         /**
678          * parent_cred - Pointer to parent wpa_cred entry
679          *
680          * This pointer can be used to delete temporary networks when a wpa_cred
681          * that was used to create them is removed. This pointer should not be
682          * dereferences since it may not be updated in all cases.
683          */
684         void *parent_cred;
685
686 #ifdef CONFIG_MACSEC
687         /**
688          * macsec_policy - Determines the policy for MACsec secure session
689          *
690          * 0: MACsec not in use (default)
691          * 1: MACsec enabled - Should secure, accept key server's advice to
692          *    determine whether to use a secure session or not.
693          */
694         int macsec_policy;
695 #endif /* CONFIG_MACSEC */
696
697 #ifdef CONFIG_HS20
698         int update_identifier;
699 #endif /* CONFIG_HS20 */
700
701         unsigned int wps_run;
702
703         /**
704          * mac_addr - MAC address policy
705          *
706          * 0 = use permanent MAC address
707          * 1 = use random MAC address for each ESS connection
708          * 2 = like 1, but maintain OUI (with local admin bit set)
709          *
710          * Internally, special value -1 is used to indicate that the parameter
711          * was not specified in the configuration (i.e., default behavior is
712          * followed).
713          */
714         int mac_addr;
715
716         /**
717          * no_auto_peer - Do not automatically peer with compatible mesh peers
718          *
719          * When unset, the reception of a beacon from a another mesh peer in
720          * this MBSS will trigger a peering attempt.
721          */
722         int no_auto_peer;
723 };
724
725 #endif /* CONFIG_SSID_H */