Standardize on a single definition of auth_alg bitfield values
[hostap-gosc2009.git] / wpa_supplicant / config_ssid.h
blob6056c9c32a87b0a3253754d34951ecef1597351a
1 /*
2 * WPA Supplicant / Network configuration structures
3 * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
12 * See README and COPYING for more details.
15 #ifndef CONFIG_SSID_H
16 #define CONFIG_SSID_H
18 #include "common/defs.h"
19 #include "eap_peer/eap_config.h"
21 #define MAX_SSID_LEN 32
24 #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
25 #define DEFAULT_EAPOL_FLAGS (EAPOL_FLAG_REQUIRE_KEY_UNICAST | \
26 EAPOL_FLAG_REQUIRE_KEY_BROADCAST)
27 #define DEFAULT_PROTO (WPA_PROTO_WPA | WPA_PROTO_RSN)
28 #define DEFAULT_KEY_MGMT (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X)
29 #define DEFAULT_PAIRWISE (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP)
30 #define DEFAULT_GROUP (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP | \
31 WPA_CIPHER_WEP104 | WPA_CIPHER_WEP40)
32 #define DEFAULT_FRAGMENT_SIZE 1398
34 /**
35 * struct wpa_ssid - Network configuration data
37 * This structure includes all the configuration variables for a network. This
38 * data is included in the per-interface configuration data as an element of
39 * the network list, struct wpa_config::ssid. Each network block in the
40 * configuration is mapped to a struct wpa_ssid instance.
42 struct wpa_ssid {
43 /**
44 * next - Next network in global list
46 * This pointer can be used to iterate over all networks. The head of
47 * this list is stored in the ssid field of struct wpa_config.
49 struct wpa_ssid *next;
51 /**
52 * pnext - Next network in per-priority list
54 * This pointer can be used to iterate over all networks in the same
55 * priority class. The heads of these list are stored in the pssid
56 * fields of struct wpa_config.
58 struct wpa_ssid *pnext;
60 /**
61 * id - Unique id for the network
63 * This identifier is used as a unique identifier for each network
64 * block when using the control interface. Each network is allocated an
65 * id when it is being created, either when reading the configuration
66 * file or when a new network is added through the control interface.
68 int id;
70 /**
71 * priority - Priority group
73 * By default, all networks will get same priority group (0). If some
74 * of the networks are more desirable, this field can be used to change
75 * the order in which wpa_supplicant goes through the networks when
76 * selecting a BSS. The priority groups will be iterated in decreasing
77 * priority (i.e., the larger the priority value, the sooner the
78 * network is matched against the scan results). Within each priority
79 * group, networks will be selected based on security policy, signal
80 * strength, etc.
82 * Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are
83 * not using this priority to select the order for scanning. Instead,
84 * they try the networks in the order that used in the configuration
85 * file.
87 int priority;
89 /**
90 * ssid - Service set identifier (network name)
92 * This is the SSID for the network. For wireless interfaces, this is
93 * used to select which network will be used. If set to %NULL (or
94 * ssid_len=0), any SSID can be used. For wired interfaces, this must
95 * be set to %NULL. Note: SSID may contain any characters, even nul
96 * (ASCII 0) and as such, this should not be assumed to be a nul
97 * terminated string. ssid_len defines how many characters are valid
98 * and the ssid field is not guaranteed to be nul terminated.
100 u8 *ssid;
103 * ssid_len - Length of the SSID
105 size_t ssid_len;
108 * bssid - BSSID
110 * If set, this network block is used only when associating with the AP
111 * using the configured BSSID
113 u8 bssid[ETH_ALEN];
116 * bssid_set - Whether BSSID is configured for this network
118 int bssid_set;
121 * psk - WPA pre-shared key (256 bits)
123 u8 psk[32];
126 * psk_set - Whether PSK field is configured
128 int psk_set;
131 * passphrase - WPA ASCII passphrase
133 * If this is set, psk will be generated using the SSID and passphrase
134 * configured for the network. ASCII passphrase must be between 8 and
135 * 63 characters (inclusive).
137 char *passphrase;
140 * pairwise_cipher - Bitfield of allowed pairwise ciphers, WPA_CIPHER_*
142 int pairwise_cipher;
145 * group_cipher - Bitfield of allowed group ciphers, WPA_CIPHER_*
147 int group_cipher;
150 * key_mgmt - Bitfield of allowed key management protocols
152 * WPA_KEY_MGMT_*
154 int key_mgmt;
157 * proto - Bitfield of allowed protocols, WPA_PROTO_*
159 int proto;
162 * auth_alg - Bitfield of allowed authentication algorithms
164 * WPA_AUTH_ALG_*
166 int auth_alg;
169 * scan_ssid - Scan this SSID with Probe Requests
171 * scan_ssid can be used to scan for APs using hidden SSIDs.
172 * Note: Many drivers do not support this. ap_mode=2 can be used with
173 * such drivers to use hidden SSIDs.
175 int scan_ssid;
177 #ifdef IEEE8021X_EAPOL
178 #define EAPOL_FLAG_REQUIRE_KEY_UNICAST BIT(0)
179 #define EAPOL_FLAG_REQUIRE_KEY_BROADCAST BIT(1)
181 * eapol_flags - Bit field of IEEE 802.1X/EAPOL options (EAPOL_FLAG_*)
183 int eapol_flags;
186 * eap - EAP peer configuration for this network
188 struct eap_peer_config eap;
189 #endif /* IEEE8021X_EAPOL */
191 #define NUM_WEP_KEYS 4
192 #define MAX_WEP_KEY_LEN 16
194 * wep_key - WEP keys
196 u8 wep_key[NUM_WEP_KEYS][MAX_WEP_KEY_LEN];
199 * wep_key_len - WEP key lengths
201 size_t wep_key_len[NUM_WEP_KEYS];
204 * wep_tx_keyidx - Default key index for TX frames using WEP
206 int wep_tx_keyidx;
209 * proactive_key_caching - Enable proactive key caching
211 * This field can be used to enable proactive key caching which is also
212 * known as opportunistic PMKSA caching for WPA2. This is disabled (0)
213 * by default. Enable by setting this to 1.
215 * Proactive key caching is used to make supplicant assume that the APs
216 * are using the same PMK and generate PMKSA cache entries without
217 * doing RSN pre-authentication. This requires support from the AP side
218 * and is normally used with wireless switches that co-locate the
219 * authenticator.
221 int proactive_key_caching;
224 * mixed_cell - Whether mixed cells are allowed
226 * This option can be used to configure whether so called mixed cells,
227 * i.e., networks that use both plaintext and encryption in the same
228 * SSID, are allowed. This is disabled (0) by default. Enable by
229 * setting this to 1.
231 int mixed_cell;
233 #ifdef IEEE8021X_EAPOL
236 * leap - Number of EAP methods using LEAP
238 * This field should be set to 1 if LEAP is enabled. This is used to
239 * select IEEE 802.11 authentication algorithm.
241 int leap;
244 * non_leap - Number of EAP methods not using LEAP
246 * This field should be set to >0 if any EAP method other than LEAP is
247 * enabled. This is used to select IEEE 802.11 authentication
248 * algorithm.
250 int non_leap;
253 * eap_workaround - EAP workarounds enabled
255 * wpa_supplicant supports number of "EAP workarounds" to work around
256 * interoperability issues with incorrectly behaving authentication
257 * servers. This is recommended to be enabled by default because some
258 * of the issues are present in large number of authentication servers.
260 * Strict EAP conformance mode can be configured by disabling
261 * workarounds with eap_workaround = 0.
263 unsigned int eap_workaround;
265 #endif /* IEEE8021X_EAPOL */
268 * mode - IEEE 802.11 operation mode (Infrastucture/IBSS)
270 * 0 = infrastructure (Managed) mode, i.e., associate with an AP.
272 * 1 = IBSS (ad-hoc, peer-to-peer)
274 * 2 = AP (access point)
276 * Note: IBSS can only be used with key_mgmt NONE (plaintext and
277 * static WEP) and key_mgmt=WPA-NONE (fixed group key TKIP/CCMP). In
278 * addition, ap_scan has to be set to 2 for IBSS. WPA-None requires
279 * following network block options: proto=WPA, key_mgmt=WPA-NONE,
280 * pairwise=NONE, group=TKIP (or CCMP, but not both), and psk must also
281 * be set (either directly or using ASCII passphrase).
283 enum wpas_mode {
284 WPAS_MODE_INFRA = 0,
285 WPAS_MODE_IBSS = 1,
286 WPAS_MODE_AP = 2,
287 } mode;
290 * disabled - Whether this network is currently disabled
292 * 0 = this network can be used (default).
293 * 1 = this network block is disabled (can be enabled through
294 * ctrl_iface, e.g., with wpa_cli or wpa_gui).
296 int disabled;
299 * peerkey - Whether PeerKey handshake for direct links is allowed
301 * This is only used when both RSN/WPA2 and IEEE 802.11e (QoS) are
302 * enabled.
304 * 0 = disabled (default)
305 * 1 = enabled
307 int peerkey;
310 * id_str - Network identifier string for external scripts
312 * This value is passed to external ctrl_iface monitors in
313 * WPA_EVENT_CONNECTED event and wpa_cli sets this as WPA_ID_STR
314 * environment variable for action scripts.
316 char *id_str;
318 #ifdef CONFIG_IEEE80211W
320 * ieee80211w - Whether management frame protection is enabled
322 * This value is used to configure policy for management frame
323 * protection (IEEE 802.11w). 0 = disabled, 1 = optional, 2 = required.
325 enum mfp_options ieee80211w;
326 #endif /* CONFIG_IEEE80211W */
329 * frequency - Channel frequency in megahertz (MHz) for IBSS
331 * This value is used to configure the initial channel for IBSS (adhoc)
332 * networks, e.g., 2412 = IEEE 802.11b/g channel 1. It is ignored in
333 * the infrastructure mode. In addition, this value is only used by the
334 * station that creates the IBSS. If an IBSS network with the
335 * configured SSID is already present, the frequency of the network
336 * will be used instead of this configured value.
338 int frequency;
341 * wpa_ptk_rekey - Maximum lifetime for PTK in seconds
343 * This value can be used to enforce rekeying of PTK to mitigate some
344 * attacks against TKIP deficiencies.
346 int wpa_ptk_rekey;
349 * scan_freq - Array of frequencies to scan or %NULL for all
351 * This is an optional zero-terminated array of frequencies in
352 * megahertz (MHz) to include in scan requests when searching for this
353 * network. This can be used to speed up scanning when the network is
354 * known to not use all possible channels.
356 int *scan_freq;
359 * bgscan - Background scan and roaming parameters or %NULL if none
361 * This is an optional set of parameters for background scanning and
362 * roaming within a network (ESS) in following format:
363 * <bgscan module name>:<module parameters>
365 char *bgscan;
368 #endif /* CONFIG_SSID_H */