config_ssid.h revision 189251
1274955Ssvnmir/*
2274955Ssvnmir * WPA Supplicant / Network configuration structures
3274955Ssvnmir * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
4274955Ssvnmir *
5274955Ssvnmir * This program is free software; you can redistribute it and/or modify
6274955Ssvnmir * it under the terms of the GNU General Public License version 2 as
7274955Ssvnmir * published by the Free Software Foundation.
8274955Ssvnmir *
9274955Ssvnmir * Alternatively, this software may be distributed under the terms of BSD
10274955Ssvnmir * license.
11296417Sdim *
12280031Sdim * See README and COPYING for more details.
13280031Sdim */
14274955Ssvnmir
15296417Sdim#ifndef CONFIG_SSID_H
16296417Sdim#define CONFIG_SSID_H
17274955Ssvnmir
18274955Ssvnmir#include "defs.h"
19296417Sdim#include "eap_peer/eap_config.h"
20296417Sdim
21296417Sdim#define MAX_SSID_LEN 32
22296417Sdim
23296417Sdim
24296417Sdim#define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
25296417Sdim#define DEFAULT_EAPOL_FLAGS (EAPOL_FLAG_REQUIRE_KEY_UNICAST | \
26296417Sdim			     EAPOL_FLAG_REQUIRE_KEY_BROADCAST)
27296417Sdim#define DEFAULT_PROTO (WPA_PROTO_WPA | WPA_PROTO_RSN)
28296417Sdim#define DEFAULT_KEY_MGMT (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X)
29296417Sdim#define DEFAULT_PAIRWISE (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP)
30296417Sdim#define DEFAULT_GROUP (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP | \
31296417Sdim		       WPA_CIPHER_WEP104 | WPA_CIPHER_WEP40)
32296417Sdim#define DEFAULT_FRAGMENT_SIZE 1398
33296417Sdim
34296417Sdim/**
35296417Sdim * struct wpa_ssid - Network configuration data
36296417Sdim *
37296417Sdim * This structure includes all the configuration variables for a network. This
38296417Sdim * data is included in the per-interface configuration data as an element of
39296417Sdim * the network list, struct wpa_config::ssid. Each network block in the
40296417Sdim * configuration is mapped to a struct wpa_ssid instance.
41296417Sdim */
42296417Sdimstruct wpa_ssid {
43296417Sdim	/**
44296417Sdim	 * next - Next network in global list
45296417Sdim	 *
46296417Sdim	 * This pointer can be used to iterate over all networks. The head of
47296417Sdim	 * this list is stored in the ssid field of struct wpa_config.
48296417Sdim	 */
49296417Sdim	struct wpa_ssid *next;
50296417Sdim
51274955Ssvnmir	/**
52296417Sdim	 * pnext - Next network in per-priority list
53296417Sdim	 *
54296417Sdim	 * This pointer can be used to iterate over all networks in the same
55296417Sdim	 * priority class. The heads of these list are stored in the pssid
56296417Sdim	 * fields of struct wpa_config.
57296417Sdim	 */
58296417Sdim	struct wpa_ssid *pnext;
59296417Sdim
60296417Sdim	/**
61296417Sdim	 * id - Unique id for the network
62274955Ssvnmir	 *
63274955Ssvnmir	 * This identifier is used as a unique identifier for each network
64296417Sdim	 * block when using the control interface. Each network is allocated an
65296417Sdim	 * id when it is being created, either when reading the configuration
66280031Sdim	 * file or when a new network is added through the control interface.
67296417Sdim	 */
68296417Sdim	int id;
69280031Sdim
70296417Sdim	/**
71296417Sdim	 * priority - Priority group
72274955Ssvnmir	 *
73296417Sdim	 * By default, all networks will get same priority group (0). If some
74296417Sdim	 * of the networks are more desirable, this field can be used to change
75296417Sdim	 * the order in which wpa_supplicant goes through the networks when
76280031Sdim	 * selecting a BSS. The priority groups will be iterated in decreasing
77280031Sdim	 * priority (i.e., the larger the priority value, the sooner the
78280031Sdim	 * network is matched against the scan results). Within each priority
79280031Sdim	 * group, networks will be selected based on security policy, signal
80280031Sdim	 * strength, etc.
81280031Sdim	 *
82280031Sdim	 * Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are
83280031Sdim	 * not using this priority to select the order for scanning. Instead,
84280031Sdim	 * they try the networks in the order that used in the configuration
85280031Sdim	 * file.
86274955Ssvnmir	 */
87274955Ssvnmir	int priority;
88296417Sdim
89296417Sdim	/**
90296417Sdim	 * ssid - Service set identifier (network name)
91296417Sdim	 *
92280031Sdim	 * This is the SSID for the network. For wireless interfaces, this is
93296417Sdim	 * used to select which network will be used. If set to %NULL (or
94296417Sdim	 * ssid_len=0), any SSID can be used. For wired interfaces, this must
95274955Ssvnmir	 * be set to %NULL. Note: SSID may contain any characters, even nul
96274955Ssvnmir	 * (ASCII 0) and as such, this should not be assumed to be a nul
97274955Ssvnmir	 * terminated string. ssid_len defines how many characters are valid
98296417Sdim	 * and the ssid field is not guaranteed to be nul terminated.
99296417Sdim	 */
100296417Sdim	u8 *ssid;
101296417Sdim
102296417Sdim	/**
103274955Ssvnmir	 * ssid_len - Length of the SSID
104280031Sdim	 */
105296417Sdim	size_t ssid_len;
106296417Sdim
107280031Sdim	/**
108280031Sdim	 * bssid - BSSID
109280031Sdim	 *
110280031Sdim	 * If set, this network block is used only when associating with the AP
111280031Sdim	 * using the configured BSSID
112280031Sdim	 */
113280031Sdim	u8 bssid[ETH_ALEN];
114280031Sdim
115280031Sdim	/**
116280031Sdim	 * bssid_set - Whether BSSID is configured for this network
117296417Sdim	 */
118280031Sdim	int bssid_set;
119296417Sdim
120280031Sdim	/**
121280031Sdim	 * psk - WPA pre-shared key (256 bits)
122296417Sdim	 */
123296417Sdim	u8 psk[32];
124274955Ssvnmir
125280031Sdim	/**
126280031Sdim	 * psk_set - Whether PSK field is configured
127280031Sdim	 */
128280031Sdim	int psk_set;
129280031Sdim
130296417Sdim	/**
131296417Sdim	 * passphrase - WPA ASCII passphrase
132296417Sdim	 *
133296417Sdim	 * If this is set, psk will be generated using the SSID and passphrase
134296417Sdim	 * configured for the network. ASCII passphrase must be between 8 and
135296417Sdim	 * 63 characters (inclusive).
136296417Sdim	 */
137296417Sdim	char *passphrase;
138296417Sdim
139296417Sdim	/**
140296417Sdim	 * pairwise_cipher - Bitfield of allowed pairwise ciphers, WPA_CIPHER_*
141296417Sdim	 */
142296417Sdim	int pairwise_cipher;
143296417Sdim
144296417Sdim	/**
145	 * group_cipher - Bitfield of allowed group ciphers, WPA_CIPHER_*
146	 */
147	int group_cipher;
148
149	/**
150	 * key_mgmt - Bitfield of allowed key management protocols
151	 *
152	 * WPA_KEY_MGMT_*
153	 */
154	int key_mgmt;
155
156	/**
157	 * proto - Bitfield of allowed protocols, WPA_PROTO_*
158	 */
159	int proto;
160
161	/**
162	 * auth_alg -  Bitfield of allowed authentication algorithms
163	 *
164	 * WPA_AUTH_ALG_*
165	 */
166	int auth_alg;
167
168	/**
169	 * scan_ssid - Scan this SSID with Probe Requests
170	 *
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.
174	 */
175	int scan_ssid;
176
177#ifdef IEEE8021X_EAPOL
178#define EAPOL_FLAG_REQUIRE_KEY_UNICAST BIT(0)
179#define EAPOL_FLAG_REQUIRE_KEY_BROADCAST BIT(1)
180	/**
181	 * eapol_flags - Bit field of IEEE 802.1X/EAPOL options (EAPOL_FLAG_*)
182	 */
183	int eapol_flags;
184
185	/**
186	 * eap - EAP peer configuration for this network
187	 */
188	struct eap_peer_config eap;
189#endif /* IEEE8021X_EAPOL */
190
191#define NUM_WEP_KEYS 4
192#define MAX_WEP_KEY_LEN 16
193	/**
194	 * wep_key - WEP keys
195	 */
196	u8 wep_key[NUM_WEP_KEYS][MAX_WEP_KEY_LEN];
197
198	/**
199	 * wep_key_len - WEP key lengths
200	 */
201	size_t wep_key_len[NUM_WEP_KEYS];
202
203	/**
204	 * wep_tx_keyidx - Default key index for TX frames using WEP
205	 */
206	int wep_tx_keyidx;
207
208	/**
209	 * proactive_key_caching - Enable proactive key caching
210	 *
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.
214	 *
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.
220	 */
221	int proactive_key_caching;
222
223	/**
224	 * mixed_cell - Whether mixed cells are allowed
225	 *
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.
230	 */
231	int mixed_cell;
232
233#ifdef IEEE8021X_EAPOL
234
235	/**
236	 * leap - Number of EAP methods using LEAP
237	 *
238	 * This field should be set to 1 if LEAP is enabled. This is used to
239	 * select IEEE 802.11 authentication algorithm.
240	 */
241	int leap;
242
243	/**
244	 * non_leap - Number of EAP methods not using LEAP
245	 *
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.
249	 */
250	int non_leap;
251
252	/**
253	 * eap_workaround - EAP workarounds enabled
254	 *
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.
259	 *
260	 * Strict EAP conformance mode can be configured by disabling
261	 * workarounds with eap_workaround = 0.
262	 */
263	unsigned int eap_workaround;
264
265#endif /* IEEE8021X_EAPOL */
266
267	/**
268	 * mode - IEEE 802.11 operation mode (Infrastucture/IBSS)
269	 *
270	 * 0 = infrastructure (Managed) mode, i.e., associate with an AP.
271	 *
272	 * 1 = IBSS (ad-hoc, peer-to-peer)
273	 *
274	 * Note: IBSS can only be used with key_mgmt NONE (plaintext and
275	 * static WEP) and key_mgmt=WPA-NONE (fixed group key TKIP/CCMP). In
276	 * addition, ap_scan has to be set to 2 for IBSS. WPA-None requires
277	 * following network block options: proto=WPA, key_mgmt=WPA-NONE,
278	 * pairwise=NONE, group=TKIP (or CCMP, but not both), and psk must also
279	 * be set (either directly or using ASCII passphrase).
280	 */
281	int mode;
282
283	/**
284	 * disabled - Whether this network is currently disabled
285	 *
286	 * 0 = this network can be used (default).
287	 * 1 = this network block is disabled (can be enabled through
288	 * ctrl_iface, e.g., with wpa_cli or wpa_gui).
289	 */
290	int disabled;
291
292	/**
293	 * peerkey -  Whether PeerKey handshake for direct links is allowed
294	 *
295	 * This is only used when both RSN/WPA2 and IEEE 802.11e (QoS) are
296	 * enabled.
297	 *
298	 * 0 = disabled (default)
299	 * 1 = enabled
300	 */
301	int peerkey;
302
303	/**
304	 * id_str - Network identifier string for external scripts
305	 *
306	 * This value is passed to external ctrl_iface monitors in
307	 * WPA_EVENT_CONNECTED event and wpa_cli sets this as WPA_ID_STR
308	 * environment variable for action scripts.
309	 */
310	char *id_str;
311
312#ifdef CONFIG_IEEE80211W
313	/**
314	 * ieee80211w - Whether management frame protection is enabled
315	 *
316	 * This value is used to configure policy for management frame
317	 * protection (IEEE 802.11w). 0 = disabled, 1 = optional, 2 = required.
318	 */
319	enum {
320		NO_IEEE80211W = 0,
321		IEEE80211W_OPTIONAL = 1,
322		IEEE80211W_REQUIRED = 2
323	} ieee80211w;
324#endif /* CONFIG_IEEE80211W */
325
326	/**
327	 * frequency - Channel frequency in megahertz (MHz) for IBSS
328	 *
329	 * This value is used to configure the initial channel for IBSS (adhoc)
330	 * networks, e.g., 2412 = IEEE 802.11b/g channel 1. It is ignored in
331	 * the infrastructure mode. In addition, this value is only used by the
332	 * station that creates the IBSS. If an IBSS network with the
333	 * configured SSID is already present, the frequency of the network
334	 * will be used instead of this configured value.
335	 */
336	int frequency;
337
338	/**
339	 * wpa_ptk_rekey - Maximum lifetime for PTK in seconds
340	 *
341	 * This value can be used to enforce rekeying of PTK to mitigate some
342	 * attacks against TKIP deficiencies.
343	 */
344	int wpa_ptk_rekey;
345};
346
347#endif /* CONFIG_SSID_H */
348