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