]> git.ipfire.org Git - thirdparty/hostap.git/blob - wpa_supplicant/wpa_supplicant_i.h
FT: Process reassoc resp FT IEs when using wpa_supplicant SME
[thirdparty/hostap.git] / wpa_supplicant / wpa_supplicant_i.h
1 /*
2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2010, 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 WPA_SUPPLICANT_I_H
16 #define WPA_SUPPLICANT_I_H
17
18 #include "utils/list.h"
19 #include "common/defs.h"
20
21 extern const char *wpa_supplicant_version;
22 extern const char *wpa_supplicant_license;
23 #ifndef CONFIG_NO_STDOUT_DEBUG
24 extern const char *wpa_supplicant_full_license1;
25 extern const char *wpa_supplicant_full_license2;
26 extern const char *wpa_supplicant_full_license3;
27 extern const char *wpa_supplicant_full_license4;
28 extern const char *wpa_supplicant_full_license5;
29 #endif /* CONFIG_NO_STDOUT_DEBUG */
30
31 struct wpa_sm;
32 struct wpa_supplicant;
33 struct ibss_rsn;
34 struct scan_info;
35 struct wpa_bss;
36
37 /*
38 * Forward declarations of private structures used within the ctrl_iface
39 * backends. Other parts of wpa_supplicant do not have access to data stored in
40 * these structures.
41 */
42 struct ctrl_iface_priv;
43 struct ctrl_iface_global_priv;
44 struct wpas_dbus_priv;
45
46 /**
47 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
48 */
49 struct wpa_interface {
50 /**
51 * confname - Configuration name (file or profile) name
52 *
53 * This can also be %NULL when a configuration file is not used. In
54 * that case, ctrl_interface must be set to allow the interface to be
55 * configured.
56 */
57 const char *confname;
58
59 /**
60 * ctrl_interface - Control interface parameter
61 *
62 * If a configuration file is not used, this variable can be used to
63 * set the ctrl_interface parameter that would have otherwise been read
64 * from the configuration file. If both confname and ctrl_interface are
65 * set, ctrl_interface is used to override the value from configuration
66 * file.
67 */
68 const char *ctrl_interface;
69
70 /**
71 * driver - Driver interface name, or %NULL to use the default driver
72 */
73 const char *driver;
74
75 /**
76 * driver_param - Driver interface parameters
77 *
78 * If a configuration file is not used, this variable can be used to
79 * set the driver_param parameters that would have otherwise been read
80 * from the configuration file. If both confname and driver_param are
81 * set, driver_param is used to override the value from configuration
82 * file.
83 */
84 const char *driver_param;
85
86 /**
87 * ifname - Interface name
88 */
89 const char *ifname;
90
91 /**
92 * bridge_ifname - Optional bridge interface name
93 *
94 * If the driver interface (ifname) is included in a Linux bridge
95 * device, the bridge interface may need to be used for receiving EAPOL
96 * frames. This can be enabled by setting this variable to enable
97 * receiving of EAPOL frames from an additional interface.
98 */
99 const char *bridge_ifname;
100 };
101
102 /**
103 * struct wpa_params - Parameters for wpa_supplicant_init()
104 */
105 struct wpa_params {
106 /**
107 * daemonize - Run %wpa_supplicant in the background
108 */
109 int daemonize;
110
111 /**
112 * wait_for_monitor - Wait for a monitor program before starting
113 */
114 int wait_for_monitor;
115
116 /**
117 * pid_file - Path to a PID (process ID) file
118 *
119 * If this and daemonize are set, process ID of the background process
120 * will be written to the specified file.
121 */
122 char *pid_file;
123
124 /**
125 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
126 */
127 int wpa_debug_level;
128
129 /**
130 * wpa_debug_show_keys - Whether keying material is included in debug
131 *
132 * This parameter can be used to allow keying material to be included
133 * in debug messages. This is a security risk and this option should
134 * not be enabled in normal configuration. If needed during
135 * development or while troubleshooting, this option can provide more
136 * details for figuring out what is happening.
137 */
138 int wpa_debug_show_keys;
139
140 /**
141 * wpa_debug_timestamp - Whether to include timestamp in debug messages
142 */
143 int wpa_debug_timestamp;
144
145 /**
146 * ctrl_interface - Global ctrl_iface path/parameter
147 */
148 char *ctrl_interface;
149
150 /**
151 * dbus_ctrl_interface - Enable the DBus control interface
152 */
153 int dbus_ctrl_interface;
154
155 /**
156 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
157 */
158 const char *wpa_debug_file_path;
159
160 /**
161 * wpa_debug_syslog - Enable log output through syslog
162 */
163 int wpa_debug_syslog;
164
165 /**
166 * override_driver - Optional driver parameter override
167 *
168 * This parameter can be used to override the driver parameter in
169 * dynamic interface addition to force a specific driver wrapper to be
170 * used instead.
171 */
172 char *override_driver;
173
174 /**
175 * override_ctrl_interface - Optional ctrl_interface override
176 *
177 * This parameter can be used to override the ctrl_interface parameter
178 * in dynamic interface addition to force a control interface to be
179 * created.
180 */
181 char *override_ctrl_interface;
182 };
183
184 /**
185 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
186 *
187 * This structure is initialized by calling wpa_supplicant_init() when starting
188 * %wpa_supplicant.
189 */
190 struct wpa_global {
191 struct wpa_supplicant *ifaces;
192 struct wpa_params params;
193 struct ctrl_iface_global_priv *ctrl_iface;
194 struct wpas_dbus_priv *dbus;
195 void **drv_priv;
196 size_t drv_count;
197 struct os_time suspend_time;
198 };
199
200
201 struct wpa_client_mlme {
202 #ifdef CONFIG_CLIENT_MLME
203 enum {
204 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
205 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
206 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
207 } state;
208 u8 prev_bssid[ETH_ALEN];
209 u8 ssid[32];
210 size_t ssid_len;
211 u16 aid;
212 u16 ap_capab, capab;
213 u8 *extra_ie; /* to be added to the end of AssocReq */
214 size_t extra_ie_len;
215 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
216 size_t extra_probe_ie_len;
217 enum wpa_key_mgmt key_mgmt;
218
219 /* The last AssocReq/Resp IEs */
220 u8 *assocreq_ies, *assocresp_ies;
221 size_t assocreq_ies_len, assocresp_ies_len;
222
223 int auth_tries, assoc_tries;
224
225 unsigned int ssid_set:1;
226 unsigned int bssid_set:1;
227 unsigned int prev_bssid_set:1;
228 unsigned int authenticated:1;
229 unsigned int associated:1;
230 unsigned int probereq_poll:1;
231 unsigned int use_protection:1;
232 unsigned int create_ibss:1;
233 unsigned int mixed_cell:1;
234 unsigned int wmm_enabled:1;
235
236 struct os_time last_probe;
237
238 unsigned int auth_algs; /* bitfield of allowed auth algs
239 * (WPA_AUTH_ALG_*) */
240 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
241 int auth_transaction;
242
243 struct os_time ibss_join_req;
244 u8 *probe_resp; /* ProbeResp template for IBSS */
245 size_t probe_resp_len;
246 u32 supp_rates_bits;
247
248 int wmm_last_param_set;
249
250 int sta_scanning;
251 int scan_hw_mode_idx;
252 int scan_channel_idx;
253 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
254 struct os_time last_scan_completed;
255 int scan_oper_channel;
256 int scan_oper_freq;
257 int scan_oper_phymode;
258 u8 scan_ssid[32];
259 size_t scan_ssid_len;
260 int scan_skip_11b;
261 int *scan_freqs;
262
263 struct ieee80211_sta_bss *sta_bss_list;
264 #define STA_HASH_SIZE 256
265 #define STA_HASH(sta) (sta[5])
266 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
267
268 int cts_protect_erp_frames;
269
270 enum hostapd_hw_mode phymode; /* current mode */
271 struct hostapd_hw_modes *modes;
272 size_t num_modes;
273 unsigned int hw_modes; /* bitfield of allowed hardware modes;
274 * (1 << HOSTAPD_MODE_*) */
275 int num_curr_rates;
276 int *curr_rates;
277 int freq; /* The current frequency in MHz */
278 int channel; /* The current IEEE 802.11 channel number */
279
280 #ifdef CONFIG_IEEE80211R
281 u8 current_md[6];
282 u8 *ft_ies;
283 size_t ft_ies_len;
284 #endif /* CONFIG_IEEE80211R */
285
286 #else /* CONFIG_CLIENT_MLME */
287 int dummy; /* to keep MSVC happy */
288 #endif /* CONFIG_CLIENT_MLME */
289 };
290
291 /**
292 * struct wpa_supplicant - Internal data for wpa_supplicant interface
293 *
294 * This structure contains the internal data for core wpa_supplicant code. This
295 * should be only used directly from the core code. However, a pointer to this
296 * data is used from other files as an arbitrary context pointer in calls to
297 * core functions.
298 */
299 struct wpa_supplicant {
300 struct wpa_global *global;
301 struct wpa_supplicant *next;
302 struct l2_packet_data *l2;
303 struct l2_packet_data *l2_br;
304 unsigned char own_addr[ETH_ALEN];
305 char ifname[100];
306 #ifdef CONFIG_CTRL_IFACE_DBUS
307 char *dbus_path;
308 #endif /* CONFIG_CTRL_IFACE_DBUS */
309 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
310 char *dbus_new_path;
311 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
312 char bridge_ifname[16];
313
314 char *confname;
315 struct wpa_config *conf;
316 int countermeasures;
317 os_time_t last_michael_mic_error;
318 u8 bssid[ETH_ALEN];
319 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
320 * field contains the targer BSSID. */
321 int reassociate; /* reassociation requested */
322 int disconnected; /* all connections disabled; i.e., do no reassociate
323 * before this has been cleared */
324 struct wpa_ssid *current_ssid;
325 struct wpa_bss *current_bss;
326 int ap_ies_from_associnfo;
327 unsigned int assoc_freq;
328
329 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
330 int pairwise_cipher;
331 int group_cipher;
332 int key_mgmt;
333 int mgmt_group_cipher;
334
335 void *drv_priv; /* private data used by driver_ops */
336 void *global_drv_priv;
337
338 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
339 * NULL = not yet initialized (start
340 * with wildcard SSID)
341 * WILDCARD_SSID_SCAN = wildcard
342 * SSID was used in the previous scan
343 */
344 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
345
346 struct dl_list bss; /* struct wpa_bss::list */
347 struct dl_list bss_id; /* struct wpa_bss::list_id */
348 size_t num_bss;
349 unsigned int bss_update_idx;
350 unsigned int bss_next_id;
351
352 struct wpa_driver_ops *driver;
353 int interface_removed; /* whether the network interface has been
354 * removed */
355 struct wpa_sm *wpa;
356 struct eapol_sm *eapol;
357
358 struct ctrl_iface_priv *ctrl_iface;
359
360 enum wpa_states wpa_state;
361 int scanning;
362 int new_connection;
363 int reassociated_connection;
364
365 int eapol_received; /* number of EAPOL packets received after the
366 * previous association event */
367
368 struct scard_data *scard;
369
370 unsigned char last_eapol_src[ETH_ALEN];
371
372 int keys_cleared;
373
374 struct wpa_blacklist *blacklist;
375
376 int scan_req; /* manual scan request; this forces a scan even if there
377 * are no enabled networks in the configuration */
378 int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
379 * results without a new scan request; this is used
380 * to speed up the first association if the driver
381 * has already available scan results. */
382 int scan_runs; /* number of scan runs since WPS was started */
383
384 struct wpa_client_mlme mlme;
385 unsigned int drv_flags;
386 int max_scan_ssids;
387
388 int pending_mic_error_report;
389 int pending_mic_error_pairwise;
390 int mic_errors_seen; /* Michael MIC errors with the current PTK */
391
392 struct wps_context *wps;
393 int wps_success; /* WPS success event received */
394 struct wps_er *wps_er;
395 int blacklist_cleared;
396
397 struct wpabuf *pending_eapol_rx;
398 struct os_time pending_eapol_rx_time;
399 u8 pending_eapol_rx_src[ETH_ALEN];
400
401 struct ibss_rsn *ibss_rsn;
402
403 #ifdef CONFIG_SME
404 struct {
405 u8 ssid[32];
406 size_t ssid_len;
407 int freq;
408 u8 assoc_req_ie[80];
409 size_t assoc_req_ie_len;
410 int mfp;
411 int ft_used;
412 u8 mobility_domain[2];
413 u8 *ft_ies;
414 size_t ft_ies_len;
415 u8 prev_bssid[ETH_ALEN];
416 int prev_bssid_set;
417 int auth_alg;
418 } sme;
419 #endif /* CONFIG_SME */
420
421 #ifdef CONFIG_AP
422 struct hostapd_iface *ap_iface;
423 #endif /* CONFIG_AP */
424
425 struct wpa_ssid *bgscan_ssid;
426 const struct bgscan_ops *bgscan;
427 void *bgscan_priv;
428 };
429
430
431 /* wpa_supplicant.c */
432 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
433
434 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
435
436 const char * wpa_supplicant_state_txt(enum wpa_states state);
437 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
438 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
439 struct wpa_bss *bss, struct wpa_ssid *ssid,
440 u8 *wpa_ie, size_t *wpa_ie_len);
441 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
442 struct wpa_bss *bss,
443 struct wpa_ssid *ssid);
444 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
445 struct wpa_ssid *ssid);
446 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
447 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
448 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
449 int sec, int usec);
450 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
451 enum wpa_states state);
452 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
453 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
454 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
455 int reason_code);
456 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
457 int reason_code);
458
459 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
460 struct wpa_ssid *ssid);
461 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
462 struct wpa_ssid *ssid);
463 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
464 struct wpa_ssid *ssid);
465 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
466 int ap_scan);
467 int wpa_supplicant_set_debug_params(struct wpa_global *global,
468 int debug_level, int debug_timestamp,
469 int debug_show_keys);
470
471 void wpa_show_license(void);
472
473 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
474 struct wpa_interface *iface);
475 int wpa_supplicant_remove_iface(struct wpa_global *global,
476 struct wpa_supplicant *wpa_s);
477 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
478 const char *ifname);
479 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
480 int wpa_supplicant_run(struct wpa_global *global);
481 void wpa_supplicant_deinit(struct wpa_global *global);
482
483 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
484 struct wpa_ssid *ssid);
485 void wpa_supplicant_terminate_proc(struct wpa_global *global);
486 void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
487 const u8 *buf, size_t len);
488
489 /* events.c */
490 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
491
492 /* eap_register.c */
493 int eap_register_methods(void);
494
495 #endif /* WPA_SUPPLICANT_I_H */