1 /*
2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2014, 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 WPA_SUPPLICANT_I_H
10 #define WPA_SUPPLICANT_I_H
11
12 #include "utils/bitfield.h"
13 #include "utils/list.h"
14 #include "common/defs.h"
15 #include "common/sae.h"
16 #include "common/wpa_ctrl.h"
17 #include "crypto/sha384.h"
18 #include "eapol_supp/eapol_supp_sm.h"
19 #include "wps/wps_defs.h"
20 #include "config_ssid.h"
21 #include "wmm_ac.h"
22
23 extern const char *const wpa_supplicant_version;
24 extern const char *const wpa_supplicant_license;
25 #ifndef CONFIG_NO_STDOUT_DEBUG
26 extern const char *const wpa_supplicant_full_license1;
27 extern const char *const wpa_supplicant_full_license2;
28 extern const char *const wpa_supplicant_full_license3;
29 extern const char *const wpa_supplicant_full_license4;
30 extern const char *const wpa_supplicant_full_license5;
31 #endif /* CONFIG_NO_STDOUT_DEBUG */
32
33 struct wpa_sm;
34 struct wpa_supplicant;
35 struct ibss_rsn;
36 struct scan_info;
37 struct wpa_bss;
38 struct wpa_scan_results;
39 struct hostapd_hw_modes;
40 struct wpa_driver_associate_params;
41
42 /*
43 * Forward declarations of private structures used within the ctrl_iface
44 * backends. Other parts of wpa_supplicant do not have access to data stored in
45 * these structures.
46 */
47 struct ctrl_iface_priv;
48 struct ctrl_iface_global_priv;
49 struct wpas_dbus_priv;
50 struct wpas_hidl_priv;
51
52 /**
53 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
54 */
55 struct wpa_interface {
56 /**
57 * confname - Configuration name (file or profile) name
58 *
59 * This can also be %NULL when a configuration file is not used. In
60 * that case, ctrl_interface must be set to allow the interface to be
61 * configured.
62 */
63 const char *confname;
64
65 /**
66 * confanother - Additional configuration name (file or profile) name
67 *
68 * This can also be %NULL when the additional configuration file is not
69 * used.
70 */
71 const char *confanother;
72
73 /**
74 * ctrl_interface - Control interface parameter
75 *
76 * If a configuration file is not used, this variable can be used to
77 * set the ctrl_interface parameter that would have otherwise been read
78 * from the configuration file. If both confname and ctrl_interface are
79 * set, ctrl_interface is used to override the value from configuration
80 * file.
81 */
82 const char *ctrl_interface;
83
84 /**
85 * driver - Driver interface name, or %NULL to use the default driver
86 */
87 const char *driver;
88
89 /**
90 * driver_param - Driver interface parameters
91 *
92 * If a configuration file is not used, this variable can be used to
93 * set the driver_param parameters that would have otherwise been read
94 * from the configuration file. If both confname and driver_param are
95 * set, driver_param is used to override the value from configuration
96 * file.
97 */
98 const char *driver_param;
99
100 /**
101 * ifname - Interface name
102 */
103 const char *ifname;
104
105 /**
106 * bridge_ifname - Optional bridge interface name
107 *
108 * If the driver interface (ifname) is included in a Linux bridge
109 * device, the bridge interface may need to be used for receiving EAPOL
110 * frames. This can be enabled by setting this variable to enable
111 * receiving of EAPOL frames from an additional interface.
112 */
113 const char *bridge_ifname;
114
115 /**
116 * p2p_mgmt - Interface used for P2P management (P2P Device operations)
117 *
118 * Indicates whether wpas_p2p_init() must be called for this interface.
119 * This is used only when the driver supports a dedicated P2P Device
120 * interface that is not a network interface.
121 */
122 int p2p_mgmt;
123
124 #ifdef CONFIG_MATCH_IFACE
125 /**
126 * matched - Interface was matched rather than specified
127 *
128 */
129 enum {
130 WPA_IFACE_NOT_MATCHED,
131 WPA_IFACE_MATCHED_NULL,
132 WPA_IFACE_MATCHED
133 } matched;
134 #endif /* CONFIG_MATCH_IFACE */
135 };
136
137 /**
138 * struct wpa_params - Parameters for wpa_supplicant_init()
139 */
140 struct wpa_params {
141 /**
142 * daemonize - Run %wpa_supplicant in the background
143 */
144 int daemonize;
145
146 /**
147 * wait_for_monitor - Wait for a monitor program before starting
148 */
149 int wait_for_monitor;
150
151 /**
152 * pid_file - Path to a PID (process ID) file
153 *
154 * If this and daemonize are set, process ID of the background process
155 * will be written to the specified file.
156 */
157 char *pid_file;
158
159 /**
160 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
161 */
162 int wpa_debug_level;
163
164 /**
165 * wpa_debug_show_keys - Whether keying material is included in debug
166 *
167 * This parameter can be used to allow keying material to be included
168 * in debug messages. This is a security risk and this option should
169 * not be enabled in normal configuration. If needed during
170 * development or while troubleshooting, this option can provide more
171 * details for figuring out what is happening.
172 */
173 int wpa_debug_show_keys;
174
175 /**
176 * wpa_debug_timestamp - Whether to include timestamp in debug messages
177 */
178 int wpa_debug_timestamp;
179
180 /**
181 * ctrl_interface - Global ctrl_iface path/parameter
182 */
183 char *ctrl_interface;
184
185 /**
186 * ctrl_interface_group - Global ctrl_iface group
187 */
188 char *ctrl_interface_group;
189
190 /**
191 * dbus_ctrl_interface - Enable the DBus control interface
192 */
193 int dbus_ctrl_interface;
194
195 /**
196 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
197 */
198 const char *wpa_debug_file_path;
199
200 /**
201 * wpa_debug_syslog - Enable log output through syslog
202 */
203 int wpa_debug_syslog;
204
205 /**
206 * wpa_debug_tracing - Enable log output through Linux tracing
207 */
208 int wpa_debug_tracing;
209
210 /**
211 * override_driver - Optional driver parameter override
212 *
213 * This parameter can be used to override the driver parameter in
214 * dynamic interface addition to force a specific driver wrapper to be
215 * used instead.
216 */
217 char *override_driver;
218
219 /**
220 * override_ctrl_interface - Optional ctrl_interface override
221 *
222 * This parameter can be used to override the ctrl_interface parameter
223 * in dynamic interface addition to force a control interface to be
224 * created.
225 */
226 char *override_ctrl_interface;
227
228 /**
229 * entropy_file - Optional entropy file
230 *
231 * This parameter can be used to configure wpa_supplicant to maintain
232 * its internal entropy store over restarts.
233 */
234 char *entropy_file;
235
236 #ifdef CONFIG_P2P
237 /**
238 * conf_p2p_dev - Configuration file used to hold the
239 * P2P Device configuration parameters.
240 *
241 * This can also be %NULL. In such a case, if a P2P Device dedicated
242 * interfaces is created, the main configuration file will be used.
243 */
244 char *conf_p2p_dev;
245 #endif /* CONFIG_P2P */
246
247 #ifdef CONFIG_MATCH_IFACE
248 /**
249 * match_ifaces - Interface descriptions to match
250 */
251 struct wpa_interface *match_ifaces;
252
253 /**
254 * match_iface_count - Number of defined matching interfaces
255 */
256 int match_iface_count;
257 #endif /* CONFIG_MATCH_IFACE */
258 };
259
260 struct p2p_srv_bonjour {
261 struct dl_list list;
262 struct wpabuf *query;
263 struct wpabuf *resp;
264 };
265
266 struct p2p_srv_upnp {
267 struct dl_list list;
268 u8 version;
269 char *service;
270 };
271
272 /**
273 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
274 *
275 * This structure is initialized by calling wpa_supplicant_init() when starting
276 * %wpa_supplicant.
277 */
278 struct wpa_global {
279 struct wpa_supplicant *ifaces;
280 struct wpa_params params;
281 struct ctrl_iface_global_priv *ctrl_iface;
282 struct wpas_dbus_priv *dbus;
283 struct wpas_hidl_priv *hidl;
284 void **drv_priv;
285 size_t drv_count;
286 struct os_time suspend_time;
287 struct p2p_data *p2p;
288 struct wpa_supplicant *p2p_init_wpa_s;
289 struct wpa_supplicant *p2p_group_formation;
290 struct wpa_supplicant *p2p_invite_group;
291 u8 p2p_dev_addr[ETH_ALEN];
292 struct os_reltime p2p_go_wait_client;
293 struct dl_list p2p_srv_bonjour; /* struct p2p_srv_bonjour */
294 struct dl_list p2p_srv_upnp; /* struct p2p_srv_upnp */
295 int p2p_disabled;
296 int cross_connection;
297 int p2p_long_listen; /* remaining time in long Listen state in ms */
298 struct wpa_freq_range_list p2p_disallow_freq;
299 struct wpa_freq_range_list p2p_go_avoid_freq;
300 enum wpa_conc_pref {
301 WPA_CONC_PREF_NOT_SET,
302 WPA_CONC_PREF_STA,
303 WPA_CONC_PREF_P2P
304 } conc_pref;
305 unsigned int p2p_per_sta_psk:1;
306 unsigned int p2p_fail_on_wps_complete:1;
307 unsigned int p2p_24ghz_social_channels:1;
308 unsigned int pending_p2ps_group:1;
309 unsigned int pending_group_iface_for_p2ps:1;
310 unsigned int p2p_go_found_external_scan:1;
311 unsigned int pending_p2ps_group_freq;
312
313 #ifdef CONFIG_WIFI_DISPLAY
314 int wifi_display;
315 #define MAX_WFD_SUBELEMS 12
316 struct wpabuf *wfd_subelem[MAX_WFD_SUBELEMS];
317 #endif /* CONFIG_WIFI_DISPLAY */
318
319 struct psk_list_entry *add_psk; /* From group formation */
320 };
321
322
323 /**
324 * struct wpa_radio - Internal data for per-radio information
325 *
326 * This structure is used to share data about configured interfaces
327 * (struct wpa_supplicant) that share the same physical radio, e.g., to allow
328 * better coordination of offchannel operations.
329 */
330 struct wpa_radio {
331 char name[16]; /* from driver_ops get_radio_name() or empty if not
332 * available */
333 /** NULL if no external scan running. */
334 struct wpa_supplicant *external_scan_req_interface;
335 unsigned int num_active_works;
336 struct dl_list ifaces; /* struct wpa_supplicant::radio_list entries */
337 struct dl_list work; /* struct wpa_radio_work::list entries */
338 };
339
340 /**
341 * Checks whether an external scan is running on a given radio.
342 * @radio: Pointer to radio struct
343 * Returns: true if an external scan is running, false otherwise.
344 */
external_scan_running(struct wpa_radio * radio)345 static inline bool external_scan_running(struct wpa_radio *radio)
346 {
347 return radio && radio->external_scan_req_interface;
348 }
349
350 #define MAX_ACTIVE_WORKS 2
351
352
353 /**
354 * struct wpa_radio_work - Radio work item
355 */
356 struct wpa_radio_work {
357 struct dl_list list;
358 unsigned int freq; /* known frequency (MHz) or 0 for multiple/unknown */
359 const char *type;
360 struct wpa_supplicant *wpa_s;
361 void (*cb)(struct wpa_radio_work *work, int deinit);
362 void *ctx;
363 unsigned int started:1;
364 struct os_reltime time;
365 unsigned int bands;
366 };
367
368 int radio_add_work(struct wpa_supplicant *wpa_s, unsigned int freq,
369 const char *type, int next,
370 void (*cb)(struct wpa_radio_work *work, int deinit),
371 void *ctx);
372 void radio_work_done(struct wpa_radio_work *work);
373 void radio_remove_works(struct wpa_supplicant *wpa_s,
374 const char *type, int remove_all);
375 void radio_remove_pending_work(struct wpa_supplicant *wpa_s, void *ctx);
376 void radio_work_check_next(struct wpa_supplicant *wpa_s);
377 struct wpa_radio_work *
378 radio_work_pending(struct wpa_supplicant *wpa_s, const char *type);
379
380 struct wpa_connect_work {
381 unsigned int sme:1;
382 unsigned int bss_removed:1;
383 struct wpa_bss *bss;
384 struct wpa_ssid *ssid;
385 };
386
387 int wpas_valid_bss_ssid(struct wpa_supplicant *wpa_s, struct wpa_bss *test_bss,
388 struct wpa_ssid *test_ssid);
389 void wpas_connect_work_free(struct wpa_connect_work *cwork);
390 void wpas_connect_work_done(struct wpa_supplicant *wpa_s);
391
392 struct wpa_external_work {
393 unsigned int id;
394 char type[100];
395 unsigned int timeout;
396 };
397
398 enum wpa_radio_work_band wpas_freq_to_band(int freq);
399 unsigned int wpas_get_bands(struct wpa_supplicant *wpa_s, const int *freqs);
400
401 /**
402 * offchannel_send_action_result - Result of offchannel send Action frame
403 */
404 enum offchannel_send_action_result {
405 OFFCHANNEL_SEND_ACTION_SUCCESS /**< Frame was send and acknowledged */,
406 OFFCHANNEL_SEND_ACTION_NO_ACK /**< Frame was sent, but not acknowledged
407 */,
408 OFFCHANNEL_SEND_ACTION_FAILED /**< Frame was not sent due to a failure
409 */
410 };
411
412 struct wps_ap_info {
413 u8 bssid[ETH_ALEN];
414 enum wps_ap_info_type {
415 WPS_AP_NOT_SEL_REG,
416 WPS_AP_SEL_REG,
417 WPS_AP_SEL_REG_OUR
418 } type;
419 unsigned int tries;
420 struct os_reltime last_attempt;
421 unsigned int pbc_active;
422 u8 uuid[WPS_UUID_LEN];
423 };
424
425 #define WPA_FREQ_USED_BY_INFRA_STATION BIT(0)
426 #define WPA_FREQ_USED_BY_P2P_CLIENT BIT(1)
427
428 struct wpa_used_freq_data {
429 int freq;
430 unsigned int flags;
431 };
432
433 #define RRM_NEIGHBOR_REPORT_TIMEOUT 1 /* 1 second for AP to send a report */
434
435 /*
436 * struct rrm_data - Data used for managing RRM features
437 */
438 struct rrm_data {
439 /* rrm_used - indication regarding the current connection */
440 unsigned int rrm_used:1;
441
442 /*
443 * notify_neighbor_rep - Callback for notifying report requester
444 */
445 void (*notify_neighbor_rep)(void *ctx, struct wpabuf *neighbor_rep);
446
447 /*
448 * neighbor_rep_cb_ctx - Callback context
449 * Received in the callback registration, and sent to the callback
450 * function as a parameter.
451 */
452 void *neighbor_rep_cb_ctx;
453
454 /* next_neighbor_rep_token - Next request's dialog token */
455 u8 next_neighbor_rep_token;
456
457 /* token - Dialog token of the current radio measurement */
458 u8 token;
459
460 /* destination address of the current radio measurement request */
461 u8 dst_addr[ETH_ALEN];
462 };
463
464 enum wpa_supplicant_test_failure {
465 WPAS_TEST_FAILURE_NONE,
466 WPAS_TEST_FAILURE_SCAN_TRIGGER,
467 };
468
469 struct icon_entry {
470 struct dl_list list;
471 u8 bssid[ETH_ALEN];
472 u8 dialog_token;
473 char *file_name;
474 u8 *image;
475 size_t image_len;
476 };
477
478 struct wpa_bss_tmp_disallowed {
479 struct dl_list list;
480 u8 bssid[ETH_ALEN];
481 int rssi_threshold;
482 };
483
484 struct beacon_rep_data {
485 u8 token;
486 u8 last_indication;
487 struct wpa_driver_scan_params scan_params;
488 u8 ssid[SSID_MAX_LEN];
489 size_t ssid_len;
490 u8 bssid[ETH_ALEN];
491 enum beacon_report_detail report_detail;
492 struct bitfield *eids;
493 };
494
495
496 struct external_pmksa_cache {
497 struct dl_list list;
498 void *pmksa_cache;
499 };
500
501 struct fils_hlp_req {
502 struct dl_list list;
503 u8 dst[ETH_ALEN];
504 struct wpabuf *pkt;
505 };
506
507 struct driver_signal_override {
508 struct dl_list list;
509 u8 bssid[ETH_ALEN];
510 int si_current_signal;
511 int si_avg_signal;
512 int si_avg_beacon_signal;
513 int si_current_noise;
514 int scan_level;
515 };
516
517 struct robust_av_data {
518 u8 dialog_token;
519 enum scs_request_type request_type;
520 u8 up_bitmap;
521 u8 up_limit;
522 u32 stream_timeout;
523 u8 frame_classifier[48];
524 size_t frame_classifier_len;
525 bool valid_config;
526 };
527
528 #ifdef CONFIG_PASN
529
530 struct pasn_fils {
531 u8 nonce[FILS_NONCE_LEN];
532 u8 anonce[FILS_NONCE_LEN];
533 u8 session[FILS_SESSION_LEN];
534 u8 erp_pmkid[PMKID_LEN];
535 bool completed;
536 };
537
538 struct wpas_pasn {
539 int akmp;
540 int cipher;
541 u16 group;
542 int freq;
543
544 u8 trans_seq;
545 u8 status;
546
547 u8 bssid[ETH_ALEN];
548 size_t pmk_len;
549 u8 pmk[PMK_LEN_MAX];
550 bool using_pmksa;
551
552 u8 hash[SHA384_MAC_LEN];
553
554 struct wpabuf *beacon_rsne_rsnxe;
555 struct wpa_ptk ptk;
556 struct crypto_ecdh *ecdh;
557
558 #ifdef CONFIG_SAE
559 struct sae_data sae;
560 #endif /* CONFIG_SAE */
561
562 struct wpa_ssid *ssid;
563
564 #ifdef CONFIG_FILS
565 struct pasn_fils fils;
566 #endif /* CONFIG_FILS */
567
568 #ifdef CONFIG_IEEE80211R
569 u8 pmk_r1[PMK_LEN_MAX];
570 size_t pmk_r1_len;
571 u8 pmk_r1_name[WPA_PMK_NAME_LEN];
572 #endif /* CONFIG_IEEE80211R */
573 };
574 #endif /* CONFIG_PASN */
575
576 /**
577 * struct wpa_supplicant - Internal data for wpa_supplicant interface
578 *
579 * This structure contains the internal data for core wpa_supplicant code. This
580 * should be only used directly from the core code. However, a pointer to this
581 * data is used from other files as an arbitrary context pointer in calls to
582 * core functions.
583 */
584 struct wpa_supplicant {
585 struct wpa_global *global;
586 struct wpa_radio *radio; /* shared radio context */
587 struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
588 struct wpa_supplicant *parent;
589 struct wpa_supplicant *p2pdev;
590 struct wpa_supplicant *next;
591 struct l2_packet_data *l2;
592 struct l2_packet_data *l2_br;
593 struct os_reltime roam_start;
594 struct os_reltime roam_time;
595 struct os_reltime session_start;
596 struct os_reltime session_length;
597 unsigned char own_addr[ETH_ALEN];
598 unsigned char perm_addr[ETH_ALEN];
599 char ifname[100];
600 #ifdef CONFIG_MATCH_IFACE
601 int matched;
602 #endif /* CONFIG_MATCH_IFACE */
603 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
604 char *dbus_new_path;
605 char *dbus_groupobj_path;
606 #ifdef CONFIG_AP
607 char *preq_notify_peer;
608 #endif /* CONFIG_AP */
609 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
610 #ifdef CONFIG_CTRL_IFACE_HIDL
611 const void *hidl_object_key;
612 #endif /* CONFIG_CTRL_IFACE_HIDL */
613 char bridge_ifname[16];
614
615 char *confname;
616 char *confanother;
617
618 struct wpa_config *conf;
619 int countermeasures;
620 struct os_reltime last_michael_mic_error;
621 u8 bssid[ETH_ALEN];
622 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
623 * field contains the target BSSID. */
624 int reassociate; /* reassociation requested */
625 unsigned int reassoc_same_bss:1; /* reassociating to the same BSS */
626 unsigned int reassoc_same_ess:1; /* reassociating to the same ESS */
627 int disconnected; /* all connections disabled; i.e., do no reassociate
628 * before this has been cleared */
629 struct wpa_ssid *current_ssid;
630 struct wpa_ssid *last_ssid;
631 struct wpa_bss *current_bss;
632 int ap_ies_from_associnfo;
633 unsigned int assoc_freq;
634 u8 *last_con_fail_realm;
635 size_t last_con_fail_realm_len;
636
637 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
638 int pairwise_cipher;
639 int deny_ptk0_rekey;
640 int group_cipher;
641 int key_mgmt;
642 int wpa_proto;
643 int mgmt_group_cipher;
644
645 void *drv_priv; /* private data used by driver_ops */
646 void *global_drv_priv;
647
648 u8 *bssid_filter;
649 size_t bssid_filter_count;
650
651 u8 *disallow_aps_bssid;
652 size_t disallow_aps_bssid_count;
653 struct wpa_ssid_value *disallow_aps_ssid;
654 size_t disallow_aps_ssid_count;
655
656 u32 setband_mask;
657
658 /* Preferred network for the next connection attempt */
659 struct wpa_ssid *next_ssid;
660
661 /* previous scan was wildcard when interleaving between
662 * wildcard scans and specific SSID scan when max_ssids=1 */
663 int prev_scan_wildcard;
664 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
665 * NULL = not yet initialized (start
666 * with wildcard SSID)
667 * WILDCARD_SSID_SCAN = wildcard
668 * SSID was used in the previous scan
669 */
670 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
671
672 struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
673 int sched_scan_timeout;
674 int first_sched_scan;
675 int sched_scan_timed_out;
676 struct sched_scan_plan *sched_scan_plans;
677 size_t sched_scan_plans_num;
678
679 void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
680 struct wpa_scan_results *scan_res);
681 void (*scan_res_fail_handler)(struct wpa_supplicant *wpa_s);
682 struct dl_list bss; /* struct wpa_bss::list */
683 struct dl_list bss_id; /* struct wpa_bss::list_id */
684 size_t num_bss;
685 unsigned int bss_update_idx;
686 unsigned int bss_next_id;
687
688 /*
689 * Pointers to BSS entries in the order they were in the last scan
690 * results.
691 */
692 struct wpa_bss **last_scan_res;
693 size_t last_scan_res_used;
694 size_t last_scan_res_size;
695 struct os_reltime last_scan;
696
697 const struct wpa_driver_ops *driver;
698 int interface_removed; /* whether the network interface has been
699 * removed */
700 struct wpa_sm *wpa;
701 struct ptksa_cache *ptksa;
702
703 struct eapol_sm *eapol;
704
705 struct ctrl_iface_priv *ctrl_iface;
706
707 enum wpa_states wpa_state;
708 struct wpa_radio_work *scan_work;
709 int scanning;
710 int sched_scanning;
711 unsigned int sched_scan_stop_req:1;
712 int new_connection;
713
714 int eapol_received; /* number of EAPOL packets received after the
715 * previous association event */
716
717 u8 rsnxe[20];
718 size_t rsnxe_len;
719
720 struct scard_data *scard;
721 char imsi[20];
722 int mnc_len;
723
724 unsigned char last_eapol_src[ETH_ALEN];
725
726 unsigned int keys_cleared; /* bitfield of key indexes that the driver is
727 * known not to be configured with a key */
728
729 struct wpa_bssid_ignore *bssid_ignore;
730
731 /* Number of connection failures since last successful connection */
732 unsigned int consecutive_conn_failures;
733
734 /**
735 * scan_req - Type of the scan request
736 */
737 enum scan_req_type {
738 /**
739 * NORMAL_SCAN_REQ - Normal scan request
740 *
741 * This is used for scans initiated by wpa_supplicant to find an
742 * AP for a connection.
743 */
744 NORMAL_SCAN_REQ,
745
746 /**
747 * INITIAL_SCAN_REQ - Initial scan request
748 *
749 * This is used for the first scan on an interface to force at
750 * least one scan to be run even if the configuration does not
751 * include any enabled networks.
752 */
753 INITIAL_SCAN_REQ,
754
755 /**
756 * MANUAL_SCAN_REQ - Manual scan request
757 *
758 * This is used for scans where the user request a scan or
759 * a specific wpa_supplicant operation (e.g., WPS) requires scan
760 * to be run.
761 */
762 MANUAL_SCAN_REQ
763 } scan_req, last_scan_req;
764 enum wpa_states scan_prev_wpa_state;
765 struct os_reltime scan_trigger_time, scan_start_time;
766 /* Minimum freshness requirement for connection purposes */
767 struct os_reltime scan_min_time;
768 int scan_runs; /* number of scan runs since WPS was started */
769 int *next_scan_freqs;
770 int *select_network_scan_freqs;
771 int *manual_scan_freqs;
772 int *manual_sched_scan_freqs;
773 unsigned int manual_scan_passive:1;
774 unsigned int manual_scan_use_id:1;
775 unsigned int manual_scan_only_new:1;
776 unsigned int own_scan_requested:1;
777 unsigned int own_scan_running:1;
778 unsigned int clear_driver_scan_cache:1;
779 unsigned int manual_scan_id;
780 int scan_interval; /* time in sec between scans to find suitable AP */
781 int normal_scans; /* normal scans run before sched_scan */
782 int scan_for_connection; /* whether the scan request was triggered for
783 * finding a connection */
784 /*
785 * A unique cookie representing the vendor scan request. This cookie is
786 * returned from the driver interface. 0 indicates that there is no
787 * pending vendor scan request.
788 */
789 u64 curr_scan_cookie;
790 #define MAX_SCAN_ID 16
791 int scan_id[MAX_SCAN_ID];
792 unsigned int scan_id_count;
793 u8 next_scan_bssid[ETH_ALEN];
794 unsigned int next_scan_bssid_wildcard_ssid:1;
795
796 struct wpa_ssid_value *ssids_from_scan_req;
797 unsigned int num_ssids_from_scan_req;
798 int *last_scan_freqs;
799 unsigned int num_last_scan_freqs;
800 unsigned int suitable_network;
801 unsigned int no_suitable_network;
802
803 u64 drv_flags;
804 u64 drv_flags2;
805 unsigned int drv_enc;
806 unsigned int drv_rrm_flags;
807
808 /*
809 * A bitmap of supported protocols for probe response offload. See
810 * struct wpa_driver_capa in driver.h
811 */
812 unsigned int probe_resp_offloads;
813
814 /* extended capabilities supported by the driver */
815 const u8 *extended_capa, *extended_capa_mask;
816 unsigned int extended_capa_len;
817
818 int max_scan_ssids;
819 int max_sched_scan_ssids;
820 unsigned int max_sched_scan_plans;
821 unsigned int max_sched_scan_plan_interval;
822 unsigned int max_sched_scan_plan_iterations;
823 int sched_scan_supported;
824 unsigned int max_match_sets;
825 unsigned int max_remain_on_chan;
826 unsigned int max_stations;
827
828 int pending_mic_error_report;
829 int pending_mic_error_pairwise;
830 int mic_errors_seen; /* Michael MIC errors with the current PTK */
831
832 struct wps_context *wps;
833 int wps_success; /* WPS success event received */
834 struct wps_er *wps_er;
835 unsigned int wps_run;
836 struct os_reltime wps_pin_start_time;
837 bool bssid_ignore_cleared;
838
839 struct wpabuf *pending_eapol_rx;
840 struct os_reltime pending_eapol_rx_time;
841 u8 pending_eapol_rx_src[ETH_ALEN];
842 unsigned int last_eapol_matches_bssid:1;
843 unsigned int eap_expected_failure:1;
844 unsigned int reattach:1; /* reassociation to the same BSS requested */
845 unsigned int mac_addr_changed:1;
846 unsigned int added_vif:1;
847 unsigned int wnmsleep_used:1;
848 unsigned int owe_transition_select:1;
849 unsigned int owe_transition_search:1;
850 unsigned int connection_set:1;
851 unsigned int connection_ht:1;
852 unsigned int connection_vht:1;
853 unsigned int connection_he:1;
854 unsigned int connection_max_nss_rx:4;
855 unsigned int connection_max_nss_tx:4;
856 unsigned int connection_channel_bandwidth:5;
857 unsigned int disable_mbo_oce:1;
858 unsigned int connection_11b_only:1;
859
860 struct os_reltime last_mac_addr_change;
861 int last_mac_addr_style;
862
863 struct ibss_rsn *ibss_rsn;
864
865 int set_sta_uapsd;
866 int sta_uapsd;
867 int set_ap_uapsd;
868 int ap_uapsd;
869 int auth_alg;
870 u16 last_owe_group;
871
872 #ifdef CONFIG_SME
873 struct {
874 u8 ssid[SSID_MAX_LEN];
875 size_t ssid_len;
876 int freq;
877 u8 assoc_req_ie[1500];
878 size_t assoc_req_ie_len;
879 int mfp;
880 int ft_used;
881 u8 mobility_domain[2];
882 u8 *ft_ies;
883 size_t ft_ies_len;
884 u8 prev_bssid[ETH_ALEN];
885 int prev_bssid_set;
886 int auth_alg;
887 int proto;
888
889 int sa_query_count; /* number of pending SA Query requests;
890 * 0 = no SA Query in progress */
891 int sa_query_timed_out;
892 u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
893 * sa_query_count octets of pending
894 * SA Query transaction identifiers */
895 struct os_reltime sa_query_start;
896 struct os_reltime last_unprot_disconnect;
897 enum { HT_SEC_CHAN_UNKNOWN,
898 HT_SEC_CHAN_ABOVE,
899 HT_SEC_CHAN_BELOW } ht_sec_chan;
900 u8 sched_obss_scan;
901 u16 obss_scan_int;
902 u16 bss_max_idle_period;
903 #ifdef CONFIG_SAE
904 struct sae_data sae;
905 struct wpabuf *sae_token;
906 int sae_group_index;
907 unsigned int sae_pmksa_caching:1;
908 u16 seq_num;
909 u8 ext_auth_bssid[ETH_ALEN];
910 u8 ext_auth_ssid[SSID_MAX_LEN];
911 size_t ext_auth_ssid_len;
912 int *sae_rejected_groups;
913 #endif /* CONFIG_SAE */
914 } sme;
915 #endif /* CONFIG_SME */
916
917 #ifdef CONFIG_AP
918 struct hostapd_iface *ap_iface;
919 void (*ap_configured_cb)(void *ctx, void *data);
920 void *ap_configured_cb_ctx;
921 void *ap_configured_cb_data;
922 #endif /* CONFIG_AP */
923
924 struct hostapd_iface *ifmsh;
925 #ifdef CONFIG_MESH
926 struct mesh_rsn *mesh_rsn;
927 int mesh_if_idx;
928 unsigned int mesh_if_created:1;
929 unsigned int mesh_ht_enabled:1;
930 unsigned int mesh_vht_enabled:1;
931 unsigned int mesh_he_enabled:1;
932 struct wpa_driver_mesh_join_params *mesh_params;
933 #ifdef CONFIG_PMKSA_CACHE_EXTERNAL
934 /* struct external_pmksa_cache::list */
935 struct dl_list mesh_external_pmksa_cache;
936 #endif /* CONFIG_PMKSA_CACHE_EXTERNAL */
937 #endif /* CONFIG_MESH */
938
939 unsigned int off_channel_freq;
940 struct wpabuf *pending_action_tx;
941 u8 pending_action_src[ETH_ALEN];
942 u8 pending_action_dst[ETH_ALEN];
943 u8 pending_action_bssid[ETH_ALEN];
944 unsigned int pending_action_freq;
945 int pending_action_no_cck;
946 int pending_action_without_roc;
947 unsigned int pending_action_tx_done:1;
948 void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
949 unsigned int freq, const u8 *dst,
950 const u8 *src, const u8 *bssid,
951 const u8 *data, size_t data_len,
952 enum offchannel_send_action_result
953 result);
954 unsigned int roc_waiting_drv_freq;
955 int action_tx_wait_time;
956 int action_tx_wait_time_used;
957
958 int p2p_mgmt;
959
960 #ifdef CONFIG_P2P
961 struct p2p_go_neg_results *go_params;
962 int create_p2p_iface;
963 u8 pending_interface_addr[ETH_ALEN];
964 char pending_interface_name[100];
965 int pending_interface_type;
966 int p2p_group_idx;
967 unsigned int pending_listen_freq;
968 unsigned int pending_listen_duration;
969 enum {
970 NOT_P2P_GROUP_INTERFACE,
971 P2P_GROUP_INTERFACE_PENDING,
972 P2P_GROUP_INTERFACE_GO,
973 P2P_GROUP_INTERFACE_CLIENT
974 } p2p_group_interface;
975 struct p2p_group *p2p_group;
976 char p2p_pin[10];
977 int p2p_wps_method;
978 u8 p2p_auth_invite[ETH_ALEN];
979 int p2p_sd_over_ctrl_iface;
980 int p2p_in_provisioning;
981 int p2p_in_invitation;
982 int p2p_invite_go_freq;
983 int pending_invite_ssid_id;
984 int show_group_started;
985 u8 go_dev_addr[ETH_ALEN];
986 int pending_pd_before_join;
987 u8 pending_join_iface_addr[ETH_ALEN];
988 u8 pending_join_dev_addr[ETH_ALEN];
989 int pending_join_wps_method;
990 u8 p2p_join_ssid[SSID_MAX_LEN];
991 size_t p2p_join_ssid_len;
992 int p2p_join_scan_count;
993 int auto_pd_scan_retry;
994 int force_long_sd;
995 u16 pending_pd_config_methods;
996 enum {
997 NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
998 } pending_pd_use;
999
1000 /*
1001 * Whether cross connection is disallowed by the AP to which this
1002 * interface is associated (only valid if there is an association).
1003 */
1004 int cross_connect_disallowed;
1005
1006 /*
1007 * Whether this P2P group is configured to use cross connection (only
1008 * valid if this is P2P GO interface). The actual cross connect packet
1009 * forwarding may not be configured depending on the uplink status.
1010 */
1011 int cross_connect_enabled;
1012
1013 /* Whether cross connection forwarding is in use at the moment. */
1014 int cross_connect_in_use;
1015
1016 /*
1017 * Uplink interface name for cross connection
1018 */
1019 char cross_connect_uplink[100];
1020
1021 unsigned int p2p_auto_join:1;
1022 unsigned int p2p_auto_pd:1;
1023 unsigned int p2p_go_do_acs:1;
1024 unsigned int p2p_persistent_group:1;
1025 unsigned int p2p_fallback_to_go_neg:1;
1026 unsigned int p2p_pd_before_go_neg:1;
1027 unsigned int p2p_go_ht40:1;
1028 unsigned int p2p_go_vht:1;
1029 unsigned int p2p_go_edmg:1;
1030 unsigned int p2p_go_he:1;
1031 unsigned int user_initiated_pd:1;
1032 unsigned int p2p_go_group_formation_completed:1;
1033 unsigned int group_formation_reported:1;
1034 unsigned int waiting_presence_resp;
1035 int p2p_first_connection_timeout;
1036 unsigned int p2p_nfc_tag_enabled:1;
1037 unsigned int p2p_peer_oob_pk_hash_known:1;
1038 unsigned int p2p_disable_ip_addr_req:1;
1039 unsigned int p2ps_method_config_any:1;
1040 unsigned int p2p_cli_probe:1;
1041 enum hostapd_hw_mode p2p_go_acs_band;
1042 int p2p_persistent_go_freq;
1043 int p2p_persistent_id;
1044 int p2p_go_intent;
1045 int p2p_connect_freq;
1046 struct os_reltime p2p_auto_started;
1047 struct wpa_ssid *p2p_last_4way_hs_fail;
1048 struct wpa_radio_work *p2p_scan_work;
1049 struct wpa_radio_work *p2p_listen_work;
1050 struct wpa_radio_work *p2p_send_action_work;
1051
1052 u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
1053 struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
1054 * formation */
1055 u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
1056 u8 p2p_ip_addr_info[3 * 4];
1057
1058 /* group common frequencies */
1059 int *p2p_group_common_freqs;
1060 unsigned int p2p_group_common_freqs_num;
1061 u8 p2ps_join_addr[ETH_ALEN];
1062
1063 unsigned int p2p_go_max_oper_chwidth;
1064 unsigned int p2p_go_vht_center_freq2;
1065 int p2p_lo_started;
1066 #endif /* CONFIG_P2P */
1067
1068 struct wpa_ssid *bgscan_ssid;
1069 const struct bgscan_ops *bgscan;
1070 void *bgscan_priv;
1071
1072 const struct autoscan_ops *autoscan;
1073 struct wpa_driver_scan_params *autoscan_params;
1074 void *autoscan_priv;
1075
1076 struct wpa_ssid *connect_without_scan;
1077
1078 struct wps_ap_info *wps_ap;
1079 size_t num_wps_ap;
1080 int wps_ap_iter;
1081
1082 int after_wps;
1083 int known_wps_freq;
1084 unsigned int wps_freq;
1085 int wps_fragment_size;
1086 int auto_reconnect_disabled;
1087
1088 /* Channel preferences for AP/P2P GO use */
1089 int best_24_freq;
1090 int best_5_freq;
1091 int best_overall_freq;
1092
1093 struct gas_query *gas;
1094 struct gas_server *gas_server;
1095
1096 #ifdef CONFIG_INTERWORKING
1097 unsigned int fetch_anqp_in_progress:1;
1098 unsigned int network_select:1;
1099 unsigned int auto_select:1;
1100 unsigned int auto_network_select:1;
1101 unsigned int interworking_fast_assoc_tried:1;
1102 unsigned int fetch_all_anqp:1;
1103 unsigned int fetch_osu_info:1;
1104 unsigned int fetch_osu_waiting_scan:1;
1105 unsigned int fetch_osu_icon_in_progress:1;
1106 struct wpa_bss *interworking_gas_bss;
1107 unsigned int osu_icon_id;
1108 struct dl_list icon_head; /* struct icon_entry */
1109 struct osu_provider *osu_prov;
1110 size_t osu_prov_count;
1111 struct os_reltime osu_icon_fetch_start;
1112 unsigned int num_osu_scans;
1113 unsigned int num_prov_found;
1114 #endif /* CONFIG_INTERWORKING */
1115 unsigned int drv_capa_known;
1116
1117 struct {
1118 struct hostapd_hw_modes *modes;
1119 u16 num_modes;
1120 u16 flags;
1121 } hw;
1122 enum local_hw_capab {
1123 CAPAB_NO_HT_VHT,
1124 CAPAB_HT,
1125 CAPAB_HT40,
1126 CAPAB_VHT,
1127 } hw_capab;
1128 #ifdef CONFIG_MACSEC
1129 struct ieee802_1x_kay *kay;
1130 #endif /* CONFIG_MACSEC */
1131
1132 int pno;
1133 int pno_sched_pending;
1134
1135 /* WLAN_REASON_* reason codes. Negative if locally generated. */
1136 int disconnect_reason;
1137
1138 /* WLAN_STATUS_* status codes from last received Authentication frame
1139 * from the AP. */
1140 u16 auth_status_code;
1141
1142 /* WLAN_STATUS_* status codes from (Re)Association Response frame. */
1143 u16 assoc_status_code;
1144
1145 struct ext_password_data *ext_pw;
1146
1147 struct wpabuf *last_gas_resp, *prev_gas_resp;
1148 u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
1149 u8 last_gas_dialog_token, prev_gas_dialog_token;
1150
1151 unsigned int no_keep_alive:1;
1152 unsigned int ext_mgmt_frame_handling:1;
1153 unsigned int ext_eapol_frame_io:1;
1154 unsigned int wmm_ac_supported:1;
1155 unsigned int ext_work_in_progress:1;
1156 unsigned int own_disconnect_req:1;
1157 unsigned int own_reconnect_req:1;
1158 unsigned int ignore_post_flush_scan_res:1;
1159
1160 #define MAC_ADDR_RAND_SCAN BIT(0)
1161 #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
1162 #define MAC_ADDR_RAND_PNO BIT(2)
1163 #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
1164 MAC_ADDR_RAND_SCHED_SCAN | \
1165 MAC_ADDR_RAND_PNO)
1166 unsigned int mac_addr_rand_supported;
1167 unsigned int mac_addr_rand_enable;
1168
1169 /* MAC Address followed by mask (2 * ETH_ALEN) */
1170 u8 *mac_addr_scan;
1171 u8 *mac_addr_sched_scan;
1172 u8 *mac_addr_pno;
1173
1174 #ifdef CONFIG_WNM
1175 u8 wnm_dialog_token;
1176 u8 wnm_reply;
1177 u8 wnm_num_neighbor_report;
1178 u8 wnm_mode;
1179 u16 wnm_dissoc_timer;
1180 u8 wnm_bss_termination_duration[12];
1181 struct neighbor_report *wnm_neighbor_report_elements;
1182 struct os_reltime wnm_cand_valid_until;
1183 u8 wnm_cand_from_bss[ETH_ALEN];
1184 enum bss_trans_mgmt_status_code bss_tm_status;
1185 struct wpabuf *coloc_intf_elems;
1186 u8 coloc_intf_dialog_token;
1187 u8 coloc_intf_auto_report;
1188 u8 coloc_intf_timeout;
1189 #ifdef CONFIG_MBO
1190 unsigned int wnm_mbo_trans_reason_present:1;
1191 unsigned int wnm_mbo_cell_pref_present:1;
1192 unsigned int wnm_mbo_assoc_retry_delay_present:1;
1193 u8 wnm_mbo_transition_reason;
1194 u8 wnm_mbo_cell_preference;
1195 u16 wnm_mbo_assoc_retry_delay_sec;
1196 #endif /* CONFIG_MBO */
1197 #endif /* CONFIG_WNM */
1198
1199 #ifdef CONFIG_TESTING_GET_GTK
1200 u8 last_gtk[32];
1201 size_t last_gtk_len;
1202 #endif /* CONFIG_TESTING_GET_GTK */
1203
1204 unsigned int num_multichan_concurrent;
1205 struct wpa_radio_work *connect_work;
1206
1207 unsigned int ext_work_id;
1208
1209 struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
1210
1211 #ifdef CONFIG_TESTING_OPTIONS
1212 struct l2_packet_data *l2_test;
1213 unsigned int extra_roc_dur;
1214 enum wpa_supplicant_test_failure test_failure;
1215 char *get_pref_freq_list_override;
1216 unsigned int reject_btm_req_reason;
1217 unsigned int p2p_go_csa_on_inv:1;
1218 unsigned int ignore_auth_resp:1;
1219 unsigned int ignore_assoc_disallow:1;
1220 unsigned int disable_sa_query:1;
1221 unsigned int testing_resend_assoc:1;
1222 unsigned int ignore_sae_h2e_only:1;
1223 int ft_rsnxe_used;
1224 struct wpabuf *sae_commit_override;
1225 enum wpa_alg last_tk_alg;
1226 u8 last_tk_addr[ETH_ALEN];
1227 int last_tk_key_idx;
1228 u8 last_tk[WPA_TK_MAX_LEN];
1229 size_t last_tk_len;
1230 struct wpabuf *last_assoc_req_wpa_ie;
1231 int *extra_sae_rejected_groups;
1232 struct wpabuf *rsne_override_eapol;
1233 struct wpabuf *rsnxe_override_assoc;
1234 struct wpabuf *rsnxe_override_eapol;
1235 struct dl_list drv_signal_override;
1236 unsigned int oci_freq_override_eapol;
1237 unsigned int oci_freq_override_saquery_req;
1238 unsigned int oci_freq_override_saquery_resp;
1239 unsigned int oci_freq_override_eapol_g2;
1240 unsigned int oci_freq_override_ft_assoc;
1241 unsigned int oci_freq_override_fils_assoc;
1242 unsigned int oci_freq_override_wnm_sleep;
1243 int force_hunting_and_pecking_pwe;
1244 #endif /* CONFIG_TESTING_OPTIONS */
1245
1246 struct wmm_ac_assoc_data *wmm_ac_assoc_info;
1247 struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
1248 struct wmm_ac_addts_request *addts_request;
1249 u8 wmm_ac_last_dialog_token;
1250 struct wmm_tspec_element *last_tspecs;
1251 u8 last_tspecs_count;
1252
1253 struct rrm_data rrm;
1254 struct beacon_rep_data beacon_rep_data;
1255
1256 #ifdef CONFIG_FST
1257 struct fst_iface *fst;
1258 const struct wpabuf *fst_ies;
1259 struct wpabuf *received_mb_ies;
1260 #endif /* CONFIG_FST */
1261
1262 #ifdef CONFIG_MBO
1263 /* Multiband operation non-preferred channel */
1264 struct wpa_mbo_non_pref_channel {
1265 enum mbo_non_pref_chan_reason reason;
1266 u8 oper_class;
1267 u8 chan;
1268 u8 preference;
1269 } *non_pref_chan;
1270 size_t non_pref_chan_num;
1271 u8 mbo_wnm_token;
1272 /**
1273 * enable_oce - Enable OCE if it is enabled by user and device also
1274 * supports OCE.
1275 * User can enable OCE with wpa_config's 'oce' parameter as follows -
1276 * - Set BIT(0) to enable OCE in non-AP STA mode.
1277 * - Set BIT(1) to enable OCE in STA-CFON mode.
1278 */
1279 u8 enable_oce;
1280 #endif /* CONFIG_MBO */
1281
1282 /*
1283 * This should be under CONFIG_MBO, but it is left out to allow using
1284 * the bss_temp_disallowed list for other purposes as well.
1285 */
1286 struct dl_list bss_tmp_disallowed;
1287
1288 /*
1289 * Content of a measurement report element with type 8 (LCI),
1290 * own location.
1291 */
1292 struct wpabuf *lci;
1293 struct os_reltime lci_time;
1294
1295 struct os_reltime beacon_rep_scan;
1296
1297 /* FILS HLP requests (struct fils_hlp_req) */
1298 struct dl_list fils_hlp_req;
1299
1300 struct sched_scan_relative_params {
1301 /**
1302 * relative_rssi_set - Enable relatively preferred BSS reporting
1303 *
1304 * 0 = Disable reporting relatively preferred BSSs
1305 * 1 = Enable reporting relatively preferred BSSs
1306 */
1307 int relative_rssi_set;
1308
1309 /**
1310 * relative_rssi - Relative RSSI for reporting better BSSs
1311 *
1312 * Amount of RSSI by which a BSS should be better than the
1313 * current connected BSS so that the new BSS can be reported
1314 * to user space. This applies to sched_scan operations.
1315 */
1316 int relative_rssi;
1317
1318 /**
1319 * relative_adjust_band - Band in which RSSI is to be adjusted
1320 */
1321 enum set_band relative_adjust_band;
1322
1323 /**
1324 * relative_adjust_rssi - RSSI adjustment
1325 *
1326 * An amount of relative_adjust_rssi should be added to the
1327 * BSSs that belong to the relative_adjust_band while comparing
1328 * with other bands for BSS reporting.
1329 */
1330 int relative_adjust_rssi;
1331 } srp;
1332
1333 /* RIC elements for FT protocol */
1334 struct wpabuf *ric_ies;
1335
1336 int last_auth_timeout_sec;
1337
1338 #ifdef CONFIG_DPP
1339 struct dpp_global *dpp;
1340 struct dpp_authentication *dpp_auth;
1341 struct wpa_radio_work *dpp_listen_work;
1342 unsigned int dpp_pending_listen_freq;
1343 unsigned int dpp_listen_freq;
1344 struct os_reltime dpp_listen_end;
1345 u8 dpp_allowed_roles;
1346 int dpp_qr_mutual;
1347 int dpp_netrole;
1348 int dpp_auth_ok_on_ack;
1349 int dpp_in_response_listen;
1350 int dpp_gas_client;
1351 int dpp_gas_dialog_token;
1352 u8 dpp_intro_bssid[ETH_ALEN];
1353 void *dpp_intro_network;
1354 struct dpp_pkex *dpp_pkex;
1355 struct dpp_bootstrap_info *dpp_pkex_bi;
1356 char *dpp_pkex_code;
1357 char *dpp_pkex_identifier;
1358 char *dpp_pkex_auth_cmd;
1359 char *dpp_configurator_params;
1360 struct os_reltime dpp_last_init;
1361 struct os_reltime dpp_init_iter_start;
1362 unsigned int dpp_init_max_tries;
1363 unsigned int dpp_init_retry_time;
1364 unsigned int dpp_resp_wait_time;
1365 unsigned int dpp_resp_max_tries;
1366 unsigned int dpp_resp_retry_time;
1367 u8 dpp_last_ssid[SSID_MAX_LEN];
1368 size_t dpp_last_ssid_len;
1369 bool dpp_conf_backup_received;
1370 #ifdef CONFIG_DPP2
1371 struct dpp_pfs *dpp_pfs;
1372 int dpp_pfs_fallback;
1373 struct wpabuf *dpp_presence_announcement;
1374 struct dpp_bootstrap_info *dpp_chirp_bi;
1375 int dpp_chirp_freq;
1376 int *dpp_chirp_freqs;
1377 int dpp_chirp_iter;
1378 int dpp_chirp_round;
1379 int dpp_chirp_scan_done;
1380 int dpp_chirp_listen;
1381 struct wpa_ssid *dpp_reconfig_ssid;
1382 int dpp_reconfig_ssid_id;
1383 struct dpp_reconfig_id *dpp_reconfig_id;
1384 #endif /* CONFIG_DPP2 */
1385 #ifdef CONFIG_TESTING_OPTIONS
1386 char *dpp_config_obj_override;
1387 char *dpp_discovery_override;
1388 char *dpp_groups_override;
1389 unsigned int dpp_ignore_netaccesskey_mismatch:1;
1390 #endif /* CONFIG_TESTING_OPTIONS */
1391 #endif /* CONFIG_DPP */
1392
1393 #ifdef CONFIG_FILS
1394 unsigned int disable_fils:1;
1395 #endif /* CONFIG_FILS */
1396 unsigned int ieee80211ac:1;
1397 unsigned int enabled_4addr_mode:1;
1398 unsigned int multi_bss_support:1;
1399 unsigned int drv_authorized_port:1;
1400 unsigned int multi_ap_ie:1;
1401 unsigned int multi_ap_backhaul:1;
1402 unsigned int multi_ap_fronthaul:1;
1403 struct robust_av_data robust_av;
1404 bool mscs_setup_done;
1405
1406 #ifdef CONFIG_PASN
1407 struct wpas_pasn pasn;
1408 struct wpa_radio_work *pasn_auth_work;
1409 #endif /* CONFIG_PASN */
1410 };
1411
1412
1413 /* wpa_supplicant.c */
1414 void wpa_supplicant_apply_ht_overrides(
1415 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1416 struct wpa_driver_associate_params *params);
1417 void wpa_supplicant_apply_vht_overrides(
1418 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1419 struct wpa_driver_associate_params *params);
1420 void wpa_supplicant_apply_he_overrides(
1421 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1422 struct wpa_driver_associate_params *params);
1423
1424 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1425 int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
1426 struct wpa_ssid *ssid);
1427
1428 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
1429
1430 const char * wpa_supplicant_state_txt(enum wpa_states state);
1431 int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
1432 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
1433 int wpa_supplicant_update_bridge_ifname(struct wpa_supplicant *wpa_s,
1434 const char *bridge_ifname);
1435 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
1436 struct wpa_bss *bss, struct wpa_ssid *ssid,
1437 u8 *wpa_ie, size_t *wpa_ie_len);
1438 int wpas_restore_permanent_mac_addr(struct wpa_supplicant *wpa_s);
1439 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
1440 struct wpa_bss *bss,
1441 struct wpa_ssid *ssid);
1442 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
1443 struct wpa_ssid *ssid);
1444 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
1445 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
1446 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
1447 int sec, int usec);
1448 void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff);
1449 void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
1450 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
1451 enum wpa_states state);
1452 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
1453 const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
1454 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
1455 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
1456 u16 reason_code);
1457 void wpa_supplicant_reconnect(struct wpa_supplicant *wpa_s);
1458
1459 struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
1460 int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);
1461 int wpa_supplicant_remove_all_networks(struct wpa_supplicant *wpa_s);
1462 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
1463 struct wpa_ssid *ssid);
1464 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
1465 struct wpa_ssid *ssid);
1466 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
1467 struct wpa_ssid *ssid);
1468 int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
1469 const char *pkcs11_engine_path,
1470 const char *pkcs11_module_path);
1471 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
1472 int ap_scan);
1473 int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
1474 unsigned int expire_age);
1475 int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
1476 unsigned int expire_count);
1477 int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
1478 int scan_interval);
1479 int wpa_supplicant_set_debug_params(struct wpa_global *global,
1480 int debug_level, int debug_timestamp,
1481 int debug_show_keys);
1482 void free_hw_features(struct wpa_supplicant *wpa_s);
1483
1484 void wpa_show_license(void);
1485
1486 struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
1487 const char *ifname);
1488 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
1489 struct wpa_interface *iface,
1490 struct wpa_supplicant *parent);
1491 int wpa_supplicant_remove_iface(struct wpa_global *global,
1492 struct wpa_supplicant *wpa_s,
1493 int terminate);
1494 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
1495 const char *ifname);
1496 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
1497 int wpa_supplicant_run(struct wpa_global *global);
1498 void wpa_supplicant_deinit(struct wpa_global *global);
1499
1500 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
1501 struct wpa_ssid *ssid);
1502 void wpa_supplicant_terminate_proc(struct wpa_global *global);
1503 void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
1504 const u8 *buf, size_t len);
1505 void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
1506 void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
1507 void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
1508 void fils_connection_failure(struct wpa_supplicant *wpa_s);
1509 int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
1510 int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
1511 void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
1512 void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
1513 struct wpa_ssid *ssid, int clear_failures);
1514 int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
1515 int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
1516 size_t ssid_len);
1517 void wpas_request_connection(struct wpa_supplicant *wpa_s);
1518 void wpas_request_disconnection(struct wpa_supplicant *wpa_s);
1519 int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
1520 int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
1521 int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
1522 void add_freq(int *freqs, int *num_freqs, int freq);
1523
1524 int wpas_get_op_chan_phy(int freq, const u8 *ies, size_t ies_len,
1525 u8 *op_class, u8 *chan, u8 *phy_type);
1526 void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
1527 void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
1528 const u8 *report, size_t report_len);
1529 int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
1530 const struct wpa_ssid_value *ssid,
1531 int lci, int civic,
1532 void (*cb)(void *ctx,
1533 struct wpabuf *neighbor_rep),
1534 void *cb_ctx);
1535 void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
1536 const u8 *src, const u8 *dst,
1537 const u8 *frame, size_t len);
1538 void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
1539 const u8 *src,
1540 const u8 *frame, size_t len,
1541 int rssi);
1542 void wpas_rrm_refuse_request(struct wpa_supplicant *wpa_s);
1543 int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s,
1544 struct wpa_scan_results *scan_res,
1545 struct scan_info *info);
1546 void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s);
1547 void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
1548 void wpas_clear_disabled_interface(void *eloop_ctx, void *timeout_ctx);
1549 void wpa_supplicant_reset_bgscan(struct wpa_supplicant *wpa_s);
1550
1551
1552 /* MBO functions */
1553 int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len,
1554 int add_oce_capa);
1555 const u8 * mbo_attr_from_mbo_ie(const u8 *mbo_ie, enum mbo_attr_id attr);
1556 const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
1557 void wpas_mbo_check_pmf(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
1558 struct wpa_ssid *ssid);
1559 const u8 * mbo_get_attr_from_ies(const u8 *ies, size_t ies_len,
1560 enum mbo_attr_id attr);
1561 int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
1562 const char *non_pref_chan);
1563 void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
1564 void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie,
1565 size_t len);
1566 size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos,
1567 size_t len,
1568 enum mbo_transition_reject_reason reason);
1569 void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa);
1570 struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
1571 struct wpa_bss *bss, u32 mbo_subtypes);
1572 void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
1573 struct wpa_bss *bss, const u8 *sa,
1574 const u8 *data, size_t slen);
1575 void wpas_update_mbo_connect_params(struct wpa_supplicant *wpa_s);
1576
1577 /* op_classes.c */
1578 enum chan_allowed {
1579 NOT_ALLOWED, NO_IR, ALLOWED
1580 };
1581
1582 enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 op_class,
1583 u8 channel, u8 bw);
1584 size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s,
1585 struct wpa_ssid *ssid,
1586 struct wpa_bss *bss, u8 *pos, size_t len);
1587 int * wpas_supp_op_classes(struct wpa_supplicant *wpa_s);
1588
1589 int wpas_enable_mac_addr_randomization(struct wpa_supplicant *wpa_s,
1590 unsigned int type, const u8 *addr,
1591 const u8 *mask);
1592 int wpas_disable_mac_addr_randomization(struct wpa_supplicant *wpa_s,
1593 unsigned int type);
1594
1595 /**
1596 * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
1597 * @wpa_s: Pointer to wpa_supplicant data
1598 * @ssid: Pointer to the network block the reply is for
1599 * @field: field the response is a reply for
1600 * @value: value (ie, password, etc) for @field
1601 * Returns: 0 on success, non-zero on error
1602 *
1603 * Helper function to handle replies to control interface requests.
1604 */
1605 int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
1606 struct wpa_ssid *ssid,
1607 const char *field,
1608 const char *value);
1609 /**
1610 * wpa_supplicant_ctrl_rsp_handle - Handle a control response
1611 * @wpa_s: Pointer to wpa_supplicant data
1612 * @ssid: Pointer to the network block the reply is for
1613 * @field: field the response is a reply for
1614 * @value: value (ie, password, etc) for @field
1615 * Returns: 0 on success, non-zero on error
1616 *
1617 * Helper function to handle replies to control interface requests.
1618 */
1619 int wpa_supplicant_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
1620 struct wpa_ssid *ssid,
1621 enum wpa_ctrl_req_type rtype,
1622 const char *value, int len);
1623
1624 void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
1625 const struct wpa_ssid *ssid,
1626 struct hostapd_freq_params *freq);
1627
1628 /* events.c */
1629 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
1630 int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
1631 struct wpa_bss *selected,
1632 struct wpa_ssid *ssid);
1633 void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
1634 void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
1635 void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
1636 int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
1637 struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
1638 struct wpa_ssid **selected_ssid);
1639 int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1640 void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s,
1641 struct channel_list_changed *info);
1642 int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
1643 struct wpa_bss *current_bss,
1644 struct wpa_bss *seleceted);
1645
1646 /* eap_register.c */
1647 int eap_register_methods(void);
1648
1649 /**
1650 * Utility method to tell if a given network is for persistent group storage
1651 * @ssid: Network object
1652 * Returns: 1 if network is a persistent group, 0 otherwise
1653 */
network_is_persistent_group(struct wpa_ssid * ssid)1654 static inline int network_is_persistent_group(struct wpa_ssid *ssid)
1655 {
1656 return ssid->disabled == 2 && ssid->p2p_persistent_group;
1657 }
1658
wpas_mode_to_ieee80211_mode(enum wpas_mode mode)1659 static inline int wpas_mode_to_ieee80211_mode(enum wpas_mode mode)
1660 {
1661 switch (mode) {
1662 default:
1663 case WPAS_MODE_INFRA:
1664 return IEEE80211_MODE_INFRA;
1665 case WPAS_MODE_IBSS:
1666 return IEEE80211_MODE_IBSS;
1667 case WPAS_MODE_AP:
1668 case WPAS_MODE_P2P_GO:
1669 case WPAS_MODE_P2P_GROUP_FORMATION:
1670 return IEEE80211_MODE_AP;
1671 case WPAS_MODE_MESH:
1672 return IEEE80211_MODE_MESH;
1673 }
1674 }
1675
1676
1677 int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1678 int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1679
1680 int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
1681
1682 void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
1683 struct wpa_used_freq_data *freqs_data,
1684 unsigned int len);
1685
1686 int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
1687 struct wpa_used_freq_data *freqs_data,
1688 unsigned int len);
1689 int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
1690 int *freq_array, unsigned int len);
1691
1692 void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
1693
1694 void wpas_vendor_elem_update(struct wpa_supplicant *wpa_s);
1695 struct wpa_supplicant * wpas_vendor_elem(struct wpa_supplicant *wpa_s,
1696 enum wpa_vendor_elem_frame frame);
1697 int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
1698 const u8 *elem, size_t len);
1699
1700 #ifdef CONFIG_FST
1701
1702 struct fst_wpa_obj;
1703
1704 void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
1705 struct fst_wpa_obj *iface_obj);
1706
1707 #endif /* CONFIG_FST */
1708
1709 int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd);
1710
1711 struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
1712 u16 num_modes, enum hostapd_hw_mode mode,
1713 bool is_6ghz);
1714
1715 void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
1716 unsigned int sec, int rssi_threshold);
1717 int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s,
1718 struct wpa_bss *bss);
1719 void free_bss_tmp_disallowed(struct wpa_supplicant *wpa_s);
1720
1721 struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
1722 int i, struct wpa_bss *bss,
1723 struct wpa_ssid *group,
1724 int only_first_ssid, int debug_print);
1725
1726 int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
1727 enum wpa_driver_if_type if_type,
1728 unsigned int *num,
1729 unsigned int *freq_list);
1730
1731 int wpa_is_fils_supported(struct wpa_supplicant *wpa_s);
1732 int wpa_is_fils_sk_pfs_supported(struct wpa_supplicant *wpa_s);
1733
1734 void wpas_clear_driver_signal_override(struct wpa_supplicant *wpa_s);
1735
1736 int wpas_send_mscs_req(struct wpa_supplicant *wpa_s);
1737 void wpas_populate_mscs_descriptor_ie(struct robust_av_data *robust_av,
1738 struct wpabuf *buf);
1739 void wpas_handle_robust_av_recv_action(struct wpa_supplicant *wpa_s,
1740 const u8 *src, const u8 *buf,
1741 size_t len);
1742 void wpas_handle_assoc_resp_mscs(struct wpa_supplicant *wpa_s, const u8 *bssid,
1743 const u8 *ies, size_t ies_len);
1744
1745 int wpas_pasn_auth_start(struct wpa_supplicant *wpa_s,
1746 const u8 *bssid, int akmp, int cipher,
1747 u16 group, int network_id);
1748 void wpas_pasn_auth_stop(struct wpa_supplicant *wpa_s);
1749 int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
1750 const u8 *data, size_t data_len, u8 acked);
1751 int wpas_pasn_auth_rx(struct wpa_supplicant *wpa_s,
1752 const struct ieee80211_mgmt *mgmt, size_t len);
1753 int disabled_freq(struct wpa_supplicant *wpa_s, int freq);
1754
1755 #endif /* WPA_SUPPLICANT_I_H */
1756