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