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 "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 };
498
499
500 struct external_pmksa_cache {
501 struct dl_list list;
502 void *pmksa_cache;
503 };
504
505 struct fils_hlp_req {
506 struct dl_list list;
507 u8 dst[ETH_ALEN];
508 struct wpabuf *pkt;
509 };
510
511 struct driver_signal_override {
512 struct dl_list list;
513 u8 bssid[ETH_ALEN];
514 int si_current_signal;
515 int si_avg_signal;
516 int si_avg_beacon_signal;
517 int si_current_noise;
518 int scan_level;
519 };
520
521 struct robust_av_data {
522 u8 dialog_token;
523 enum scs_request_type request_type;
524 u8 up_bitmap;
525 u8 up_limit;
526 u32 stream_timeout;
527 u8 frame_classifier[48];
528 size_t frame_classifier_len;
529 bool valid_config;
530 };
531
532 struct dscp_policy_status {
533 u8 id;
534 u8 status;
535 };
536
537 struct dscp_resp_data {
538 bool more;
539 bool reset;
540 bool solicited;
541 struct dscp_policy_status *policy;
542 int num_policies;
543 };
544
545 enum ip_version {
546 IPV4 = 4,
547 IPV6 = 6,
548 };
549
550
551 struct ipv4_params {
552 struct in_addr src_ip;
553 struct in_addr dst_ip;
554 u16 src_port;
555 u16 dst_port;
556 u8 dscp;
557 u8 protocol;
558 };
559
560
561 struct ipv6_params {
562 struct in6_addr src_ip;
563 struct in6_addr dst_ip;
564 u16 src_port;
565 u16 dst_port;
566 u8 dscp;
567 u8 next_header;
568 u8 flow_label[3];
569 };
570
571
572 struct type4_params {
573 u8 classifier_mask;
574 enum ip_version ip_version;
575 union {
576 struct ipv4_params v4;
577 struct ipv6_params v6;
578 } ip_params;
579 };
580
581
582 struct type10_params {
583 u8 prot_instance;
584 u8 prot_number;
585 u8 *filter_value;
586 u8 *filter_mask;
587 size_t filter_len;
588 };
589
590
591 struct tclas_element {
592 u8 user_priority;
593 u8 classifier_type;
594 union {
595 struct type4_params type4_param;
596 struct type10_params type10_param;
597 } frame_classifier;
598 };
599
600
601 struct qos_characteristics {
602 bool available;
603
604 /* Control Info Direction */
605 u8 direction;
606 /* Presence Bitmap Of Additional Parameters */
607 u16 mask;
608 /* Minimum Service Interval */
609 u32 min_si;
610 /* Maximum Service Interval */
611 u32 max_si;
612 /* Minimum Data Rate */
613 u32 min_data_rate;
614 /* Delay Bound */
615 u32 delay_bound;
616 /* Maximum MSDU Size */
617 u16 max_msdu_size;
618 /* Service Start Time */
619 u32 service_start_time;
620 /* Service Start Time LinkID */
621 u8 service_start_time_link_id;
622 /* Mean Data Rate */
623 u32 mean_data_rate;
624 /* Delayed Bounded Burst Size */
625 u32 burst_size;
626 /* MSDU Lifetime */
627 u16 msdu_lifetime;
628 /* MSDU Delivery Info */
629 u8 msdu_delivery_info;
630 /* Medium Time */
631 u16 medium_time;
632 };
633
634
635 struct scs_desc_elem {
636 u8 scs_id;
637 enum scs_request_type request_type;
638 u8 intra_access_priority;
639 bool scs_up_avail;
640 struct tclas_element *tclas_elems;
641 unsigned int num_tclas_elem;
642 u8 tclas_processing;
643 struct qos_characteristics qos_char_elem;
644 };
645
646
647 struct scs_robust_av_data {
648 struct scs_desc_elem *scs_desc_elems;
649 unsigned int num_scs_desc;
650 };
651
652
653 enum scs_response_status {
654 SCS_DESC_SENT = 0,
655 SCS_DESC_SUCCESS = 1,
656 };
657
658
659 struct active_scs_elem {
660 struct dl_list list;
661 u8 scs_id;
662 enum scs_response_status status;
663 };
664
665 struct dscp_policy_data {
666 u8 policy_id;
667 u8 req_type;
668 u8 dscp;
669 bool dscp_info;
670 const u8 *frame_classifier;
671 u8 frame_classifier_len;
672 struct type4_params type4_param;
673 const u8 *domain_name;
674 u8 domain_name_len;
675 u16 start_port;
676 u16 end_port;
677 bool port_range_info;
678 };
679
680
681 /**
682 * struct wpa_supplicant - Internal data for wpa_supplicant interface
683 *
684 * This structure contains the internal data for core wpa_supplicant code. This
685 * should be only used directly from the core code. However, a pointer to this
686 * data is used from other files as an arbitrary context pointer in calls to
687 * core functions.
688 */
689 struct wpa_supplicant {
690 struct wpa_global *global;
691 struct wpa_radio *radio; /* shared radio context */
692 struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
693 struct wpa_supplicant *parent;
694 struct wpa_supplicant *p2pdev;
695 struct wpa_supplicant *next;
696 struct l2_packet_data *l2;
697 struct l2_packet_data *l2_br;
698 struct os_reltime roam_start;
699 struct os_reltime roam_time;
700 struct os_reltime session_start;
701 struct os_reltime session_length;
702 unsigned char own_addr[ETH_ALEN];
703 unsigned char perm_addr[ETH_ALEN];
704 char ifname[100];
705 #ifdef CONFIG_MATCH_IFACE
706 int matched;
707 #endif /* CONFIG_MATCH_IFACE */
708 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
709 char *dbus_new_path;
710 char *dbus_groupobj_path;
711 #ifdef CONFIG_AP
712 char *preq_notify_peer;
713 #endif /* CONFIG_AP */
714 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
715 #ifdef CONFIG_CTRL_IFACE_AIDL
716 const void *aidl_object_key;
717 #endif /* CONFIG_CTRL_IFACE_AIDL */
718 char bridge_ifname[16];
719
720 char *confname;
721 char *confanother;
722
723 struct wpa_config *conf;
724 int countermeasures;
725 struct os_reltime last_michael_mic_error;
726 u8 bssid[ETH_ALEN];
727 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
728 * field contains the target BSSID. */
729 int reassociate; /* reassociation requested */
730 bool roam_in_progress; /* roam in progress */
731 unsigned int reassoc_same_bss:1; /* reassociating to the same BSS */
732 unsigned int reassoc_same_ess:1; /* reassociating to the same ESS */
733 int disconnected; /* all connections disabled; i.e., do no reassociate
734 * before this has been cleared */
735 struct wpa_ssid *current_ssid;
736 struct wpa_ssid *last_ssid;
737 struct wpa_bss *current_bss;
738 int ap_ies_from_associnfo;
739 unsigned int assoc_freq;
740 u8 ap_mld_addr[ETH_ALEN];
741 u8 mlo_assoc_link_id;
742 u16 valid_links; /* bitmap of valid MLO link IDs */
743 struct ml_sta_link_info {
744 u8 addr[ETH_ALEN];
745 u8 bssid[ETH_ALEN];
746 unsigned int freq;
747 struct wpa_bss *bss;
748 } links[MAX_NUM_MLD_LINKS];
749 u8 *last_con_fail_realm;
750 size_t last_con_fail_realm_len;
751
752 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
753 int pairwise_cipher;
754 int deny_ptk0_rekey;
755 int group_cipher;
756 int key_mgmt;
757 int wpa_proto;
758 int mgmt_group_cipher;
759 /*
760 * Allowed key management suites for roaming/initial connection
761 * when the driver's SME is in use.
762 */
763 int allowed_key_mgmts;
764
765 void *drv_priv; /* private data used by driver_ops */
766 void *global_drv_priv;
767
768 u8 *bssid_filter;
769 size_t bssid_filter_count;
770
771 u8 *disallow_aps_bssid;
772 size_t disallow_aps_bssid_count;
773 struct wpa_ssid_value *disallow_aps_ssid;
774 size_t disallow_aps_ssid_count;
775
776 u32 setband_mask;
777
778 /* Preferred network for the next connection attempt */
779 struct wpa_ssid *next_ssid;
780
781 /* previous scan was wildcard when interleaving between
782 * wildcard scans and specific SSID scan when max_ssids=1 */
783 int prev_scan_wildcard;
784 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
785 * NULL = not yet initialized (start
786 * with wildcard SSID)
787 * WILDCARD_SSID_SCAN = wildcard
788 * SSID was used in the previous scan
789 */
790 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
791
792 struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
793 int sched_scan_timeout;
794 int first_sched_scan;
795 int sched_scan_timed_out;
796 struct sched_scan_plan *sched_scan_plans;
797 size_t sched_scan_plans_num;
798
799 void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
800 struct wpa_scan_results *scan_res);
801 void (*scan_res_fail_handler)(struct wpa_supplicant *wpa_s);
802 struct dl_list bss; /* struct wpa_bss::list */
803 struct dl_list bss_id; /* struct wpa_bss::list_id */
804 size_t num_bss;
805 unsigned int bss_update_idx;
806 unsigned int bss_next_id;
807
808 /*
809 * Pointers to BSS entries in the order they were in the last scan
810 * results.
811 */
812 struct wpa_bss **last_scan_res;
813 size_t last_scan_res_used;
814 size_t last_scan_res_size;
815 struct os_reltime last_scan;
816
817 const struct wpa_driver_ops *driver;
818 int interface_removed; /* whether the network interface has been
819 * removed */
820 struct wpa_sm *wpa;
821 struct ptksa_cache *ptksa;
822
823 struct eapol_sm *eapol;
824
825 struct ctrl_iface_priv *ctrl_iface;
826
827 enum wpa_states wpa_state;
828 struct wpa_radio_work *scan_work;
829 int scanning;
830 int sched_scanning;
831 unsigned int sched_scan_stop_req:1;
832 int new_connection;
833
834 int eapol_received; /* number of EAPOL packets received after the
835 * previous association event */
836
837 u8 rsnxe[20];
838 size_t rsnxe_len;
839
840 struct scard_data *scard;
841 char imsi[20];
842 int mnc_len;
843
844 unsigned char last_eapol_src[ETH_ALEN];
845
846 unsigned int keys_cleared; /* bitfield of key indexes that the driver is
847 * known not to be configured with a key */
848
849 struct wpa_bssid_ignore *bssid_ignore;
850
851 /* Number of connection failures since last successful connection */
852 unsigned int consecutive_conn_failures;
853
854 /**
855 * scan_req - Type of the scan request
856 */
857 enum scan_req_type {
858 /**
859 * NORMAL_SCAN_REQ - Normal scan request
860 *
861 * This is used for scans initiated by wpa_supplicant to find an
862 * AP for a connection.
863 */
864 NORMAL_SCAN_REQ,
865
866 /**
867 * INITIAL_SCAN_REQ - Initial scan request
868 *
869 * This is used for the first scan on an interface to force at
870 * least one scan to be run even if the configuration does not
871 * include any enabled networks.
872 */
873 INITIAL_SCAN_REQ,
874
875 /**
876 * MANUAL_SCAN_REQ - Manual scan request
877 *
878 * This is used for scans where the user request a scan or
879 * a specific wpa_supplicant operation (e.g., WPS) requires scan
880 * to be run.
881 */
882 MANUAL_SCAN_REQ
883 } scan_req, last_scan_req;
884 enum wpa_states scan_prev_wpa_state;
885 struct os_reltime scan_trigger_time, scan_start_time;
886 /* Minimum freshness requirement for connection purposes */
887 struct os_reltime scan_min_time;
888 int scan_runs; /* number of scan runs since WPS was started */
889 int *next_scan_freqs;
890 int *select_network_scan_freqs;
891 int *manual_scan_freqs;
892 int *manual_sched_scan_freqs;
893 unsigned int manual_scan_passive:1;
894 unsigned int manual_scan_use_id:1;
895 unsigned int manual_scan_only_new:1;
896 unsigned int own_scan_requested:1;
897 unsigned int own_scan_running:1;
898 unsigned int clear_driver_scan_cache:1;
899 unsigned int manual_non_coloc_6ghz:1;
900 unsigned int manual_scan_id;
901 int scan_interval; /* time in sec between scans to find suitable AP */
902 int normal_scans; /* normal scans run before sched_scan */
903 int scan_for_connection; /* whether the scan request was triggered for
904 * finding a connection */
905 /*
906 * A unique cookie representing the vendor scan request. This cookie is
907 * returned from the driver interface. 0 indicates that there is no
908 * pending vendor scan request.
909 */
910 u64 curr_scan_cookie;
911 #define MAX_SCAN_ID 16
912 int scan_id[MAX_SCAN_ID];
913 unsigned int scan_id_count;
914 u8 next_scan_bssid[ETH_ALEN];
915 unsigned int next_scan_bssid_wildcard_ssid:1;
916
917 struct wpa_ssid_value *ssids_from_scan_req;
918 unsigned int num_ssids_from_scan_req;
919 int *last_scan_freqs;
920 unsigned int num_last_scan_freqs;
921 unsigned int suitable_network;
922 unsigned int no_suitable_network;
923
924 u8 ml_probe_bssid[ETH_ALEN];
925 int ml_probe_mld_id;
926 u16 ml_probe_links;
927
928 u64 drv_flags;
929 u64 drv_flags2;
930 unsigned int drv_enc;
931 unsigned int drv_rrm_flags;
932 unsigned int drv_max_acl_mac_addrs;
933
934 /*
935 * A bitmap of supported protocols for probe response offload. See
936 * struct wpa_driver_capa in driver.h
937 */
938 unsigned int probe_resp_offloads;
939
940 /* extended capabilities supported by the driver */
941 const u8 *extended_capa, *extended_capa_mask;
942 unsigned int extended_capa_len;
943
944 int max_scan_ssids;
945 int max_sched_scan_ssids;
946 unsigned int max_sched_scan_plans;
947 unsigned int max_sched_scan_plan_interval;
948 unsigned int max_sched_scan_plan_iterations;
949 int sched_scan_supported;
950 unsigned int max_match_sets;
951 unsigned int max_remain_on_chan;
952 unsigned int max_stations;
953 unsigned int max_num_akms;
954
955 int pending_mic_error_report;
956 int pending_mic_error_pairwise;
957 int mic_errors_seen; /* Michael MIC errors with the current PTK */
958
959 struct wps_context *wps;
960 int wps_success; /* WPS success event received */
961 struct wps_er *wps_er;
962 unsigned int wps_run;
963 struct os_reltime wps_pin_start_time;
964 bool bssid_ignore_cleared;
965
966 struct wpabuf *pending_eapol_rx;
967 struct os_reltime pending_eapol_rx_time;
968 u8 pending_eapol_rx_src[ETH_ALEN];
969 enum frame_encryption pending_eapol_encrypted;
970 unsigned int last_eapol_matches_bssid:1;
971 unsigned int eapol_failed:1;
972 unsigned int eap_expected_failure:1;
973 unsigned int reattach:1; /* reassociation to the same BSS requested */
974 unsigned int mac_addr_changed:1;
975 unsigned int added_vif:1;
976 unsigned int wnmsleep_used:1;
977 unsigned int owe_transition_select:1;
978 unsigned int owe_transition_search:1;
979 unsigned int connection_set:1;
980 unsigned int connection_ht:1;
981 unsigned int connection_vht:1;
982 unsigned int connection_he:1;
983 unsigned int connection_eht:1;
984 unsigned int connection_max_nss_rx:4;
985 unsigned int connection_max_nss_tx:4;
986 unsigned int connection_channel_bandwidth:5;
987 unsigned int disable_mbo_oce:1;
988 unsigned int connection_11b_only:1;
989 unsigned int ap_t2lm_negotiation_support:1;
990
991 struct os_reltime last_mac_addr_change;
992 enum wpas_mac_addr_style last_mac_addr_style;
993
994 struct ibss_rsn *ibss_rsn;
995
996 int set_sta_uapsd;
997 int sta_uapsd;
998 int set_ap_uapsd;
999 int ap_uapsd;
1000 int auth_alg;
1001 u16 last_owe_group;
1002
1003 #ifdef CONFIG_SME
1004 struct {
1005 u8 ssid[SSID_MAX_LEN];
1006 size_t ssid_len;
1007 int freq;
1008 u8 assoc_req_ie[1500];
1009 size_t assoc_req_ie_len;
1010 int mfp;
1011 int ft_used;
1012 u8 mobility_domain[2];
1013 u8 *ft_ies;
1014 size_t ft_ies_len;
1015 u8 prev_bssid[ETH_ALEN];
1016 int prev_bssid_set;
1017 int auth_alg;
1018 int proto;
1019
1020 int sa_query_count; /* number of pending SA Query requests;
1021 * 0 = no SA Query in progress */
1022 int sa_query_timed_out;
1023 u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
1024 * sa_query_count octets of pending
1025 * SA Query transaction identifiers */
1026 struct os_reltime sa_query_start;
1027 struct os_reltime last_unprot_disconnect;
1028 enum { HT_SEC_CHAN_UNKNOWN,
1029 HT_SEC_CHAN_ABOVE,
1030 HT_SEC_CHAN_BELOW } ht_sec_chan;
1031 u8 sched_obss_scan;
1032 u16 obss_scan_int;
1033 u16 bss_max_idle_period;
1034 #ifdef CONFIG_SAE
1035 struct sae_data sae;
1036 struct wpabuf *sae_token;
1037 int sae_group_index;
1038 unsigned int sae_pmksa_caching:1;
1039 u16 seq_num;
1040 u8 ext_auth_bssid[ETH_ALEN];
1041 struct wpa_ssid *ext_auth_wpa_ssid;
1042 u8 ext_auth_ssid[SSID_MAX_LEN];
1043 size_t ext_auth_ssid_len;
1044 int ext_auth_key_mgmt;
1045 u8 ext_auth_ap_mld_addr[ETH_ALEN];
1046 bool ext_ml_auth;
1047 int *sae_rejected_groups;
1048 #endif /* CONFIG_SAE */
1049 } sme;
1050 #endif /* CONFIG_SME */
1051
1052 #ifdef CONFIG_AP
1053 struct hostapd_iface *ap_iface;
1054 void (*ap_configured_cb)(void *ctx, void *data);
1055 void *ap_configured_cb_ctx;
1056 void *ap_configured_cb_data;
1057 #endif /* CONFIG_AP */
1058
1059 struct hostapd_iface *ifmsh;
1060 #ifdef CONFIG_MESH
1061 struct mesh_rsn *mesh_rsn;
1062 int mesh_if_idx;
1063 unsigned int mesh_if_created:1;
1064 unsigned int mesh_ht_enabled:1;
1065 unsigned int mesh_vht_enabled:1;
1066 unsigned int mesh_he_enabled:1;
1067 unsigned int mesh_eht_enabled:1;
1068 struct wpa_driver_mesh_join_params *mesh_params;
1069 #ifdef CONFIG_PMKSA_CACHE_EXTERNAL
1070 /* struct external_pmksa_cache::list */
1071 struct dl_list mesh_external_pmksa_cache;
1072 #endif /* CONFIG_PMKSA_CACHE_EXTERNAL */
1073 #endif /* CONFIG_MESH */
1074
1075 unsigned int off_channel_freq;
1076 struct wpabuf *pending_action_tx;
1077 u8 pending_action_src[ETH_ALEN];
1078 u8 pending_action_dst[ETH_ALEN];
1079 u8 pending_action_bssid[ETH_ALEN];
1080 unsigned int pending_action_freq;
1081 int pending_action_no_cck;
1082 int pending_action_without_roc;
1083 unsigned int pending_action_tx_done:1;
1084 void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
1085 unsigned int freq, const u8 *dst,
1086 const u8 *src, const u8 *bssid,
1087 const u8 *data, size_t data_len,
1088 enum offchannel_send_action_result
1089 result);
1090 unsigned int roc_waiting_drv_freq;
1091 int action_tx_wait_time;
1092 int action_tx_wait_time_used;
1093
1094 int p2p_mgmt;
1095
1096 #ifdef CONFIG_P2P
1097 struct p2p_go_neg_results *go_params;
1098 int create_p2p_iface;
1099 u8 pending_interface_addr[ETH_ALEN];
1100 char pending_interface_name[100];
1101 int pending_interface_type;
1102 int p2p_group_idx;
1103 unsigned int pending_listen_freq;
1104 unsigned int pending_listen_duration;
1105 enum {
1106 NOT_P2P_GROUP_INTERFACE,
1107 P2P_GROUP_INTERFACE_PENDING,
1108 P2P_GROUP_INTERFACE_GO,
1109 P2P_GROUP_INTERFACE_CLIENT
1110 } p2p_group_interface;
1111 struct p2p_group *p2p_group;
1112 char p2p_pin[10];
1113 int p2p_wps_method;
1114 u8 p2p_auth_invite[ETH_ALEN];
1115 int p2p_sd_over_ctrl_iface;
1116 int p2p_in_provisioning;
1117 int p2p_in_invitation;
1118 int p2p_retry_limit;
1119 int p2p_invite_go_freq;
1120 int pending_invite_ssid_id;
1121 int show_group_started;
1122 u8 go_dev_addr[ETH_ALEN];
1123 int pending_pd_before_join;
1124 u8 pending_join_iface_addr[ETH_ALEN];
1125 u8 pending_join_dev_addr[ETH_ALEN];
1126 int pending_join_wps_method;
1127 u8 p2p_join_ssid[SSID_MAX_LEN];
1128 size_t p2p_join_ssid_len;
1129 int p2p_join_scan_count;
1130 int auto_pd_scan_retry;
1131 int force_long_sd;
1132 u16 pending_pd_config_methods;
1133 enum {
1134 NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
1135 } pending_pd_use;
1136
1137 /*
1138 * Whether cross connection is disallowed by the AP to which this
1139 * interface is associated (only valid if there is an association).
1140 */
1141 int cross_connect_disallowed;
1142
1143 /*
1144 * Whether this P2P group is configured to use cross connection (only
1145 * valid if this is P2P GO interface). The actual cross connect packet
1146 * forwarding may not be configured depending on the uplink status.
1147 */
1148 int cross_connect_enabled;
1149
1150 /* Whether cross connection forwarding is in use at the moment. */
1151 int cross_connect_in_use;
1152
1153 /*
1154 * Uplink interface name for cross connection
1155 */
1156 char cross_connect_uplink[100];
1157
1158 unsigned int p2p_auto_join:1;
1159 unsigned int p2p_auto_pd:1;
1160 unsigned int p2p_go_do_acs:1;
1161 unsigned int p2p_persistent_group:1;
1162 unsigned int p2p_fallback_to_go_neg:1;
1163 unsigned int p2p_pd_before_go_neg:1;
1164 unsigned int p2p_go_ht40:1;
1165 unsigned int p2p_go_vht:1;
1166 unsigned int p2p_go_edmg:1;
1167 unsigned int p2p_go_he:1;
1168 unsigned int user_initiated_pd:1;
1169 unsigned int p2p_go_group_formation_completed:1;
1170 unsigned int group_formation_reported:1;
1171 unsigned int p2p_go_no_pri_sec_switch:1;
1172 unsigned int waiting_presence_resp;
1173 int p2p_first_connection_timeout;
1174 unsigned int p2p_nfc_tag_enabled:1;
1175 unsigned int p2p_peer_oob_pk_hash_known:1;
1176 unsigned int p2p_disable_ip_addr_req:1;
1177 unsigned int p2ps_method_config_any:1;
1178 unsigned int p2p_cli_probe:1;
1179 unsigned int p2p_go_allow_dfs:1;
1180 enum hostapd_hw_mode p2p_go_acs_band;
1181 int p2p_persistent_go_freq;
1182 int p2p_persistent_id;
1183 int p2p_go_intent;
1184 int p2p_connect_freq;
1185 struct os_reltime p2p_auto_started;
1186 struct wpa_ssid *p2p_last_4way_hs_fail;
1187 struct wpa_radio_work *p2p_scan_work;
1188 struct wpa_radio_work *p2p_listen_work;
1189 struct wpa_radio_work *p2p_send_action_work;
1190
1191 u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
1192 struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
1193 * formation */
1194 u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
1195 u8 p2p_ip_addr_info[3 * 4];
1196
1197 /* group common frequencies */
1198 int *p2p_group_common_freqs;
1199 unsigned int p2p_group_common_freqs_num;
1200 u8 p2ps_join_addr[ETH_ALEN];
1201
1202 unsigned int p2p_go_max_oper_chwidth;
1203 unsigned int p2p_go_vht_center_freq2;
1204 int p2p_lo_started;
1205 #endif /* CONFIG_P2P */
1206
1207 struct wpa_ssid *bgscan_ssid;
1208 const struct bgscan_ops *bgscan;
1209 void *bgscan_priv;
1210
1211 const struct autoscan_ops *autoscan;
1212 struct wpa_driver_scan_params *autoscan_params;
1213 void *autoscan_priv;
1214
1215 struct wpa_ssid *connect_without_scan;
1216
1217 struct wps_ap_info *wps_ap;
1218 size_t num_wps_ap;
1219 int wps_ap_iter;
1220
1221 int after_wps;
1222 int known_wps_freq;
1223 unsigned int wps_freq;
1224 int wps_fragment_size;
1225 int auto_reconnect_disabled;
1226
1227 /* Channel preferences for AP/P2P GO use */
1228 int best_24_freq;
1229 int best_5_freq;
1230 int best_overall_freq;
1231
1232 struct gas_query *gas;
1233 struct gas_server *gas_server;
1234
1235 #ifdef CONFIG_INTERWORKING
1236 unsigned int fetch_anqp_in_progress:1;
1237 unsigned int network_select:1;
1238 unsigned int auto_select:1;
1239 unsigned int auto_network_select:1;
1240 unsigned int interworking_fast_assoc_tried:1;
1241 unsigned int fetch_all_anqp:1;
1242 unsigned int fetch_osu_info:1;
1243 unsigned int fetch_osu_waiting_scan:1;
1244 unsigned int fetch_osu_icon_in_progress:1;
1245 struct wpa_bss *interworking_gas_bss;
1246 unsigned int osu_icon_id;
1247 struct dl_list icon_head; /* struct icon_entry */
1248 struct osu_provider *osu_prov;
1249 size_t osu_prov_count;
1250 struct os_reltime osu_icon_fetch_start;
1251 unsigned int num_osu_scans;
1252 unsigned int num_prov_found;
1253 #endif /* CONFIG_INTERWORKING */
1254 unsigned int drv_capa_known;
1255
1256 struct {
1257 struct hostapd_hw_modes *modes;
1258 u16 num_modes;
1259 u16 flags;
1260 } hw;
1261 enum local_hw_capab {
1262 CAPAB_NO_HT_VHT,
1263 CAPAB_HT,
1264 CAPAB_HT40,
1265 CAPAB_VHT,
1266 } hw_capab;
1267 #ifdef CONFIG_MACSEC
1268 struct ieee802_1x_kay *kay;
1269 #endif /* CONFIG_MACSEC */
1270
1271 int pno;
1272 int pno_sched_pending;
1273
1274 /* WLAN_REASON_* reason codes. Negative if locally generated. */
1275 int disconnect_reason;
1276
1277 /* WLAN_STATUS_* status codes from last received Authentication frame
1278 * from the AP. */
1279 u16 auth_status_code;
1280
1281 /* WLAN_STATUS_* status codes from (Re)Association Response frame. */
1282 u16 assoc_status_code;
1283
1284 struct ext_password_data *ext_pw;
1285
1286 struct wpabuf *last_gas_resp, *prev_gas_resp;
1287 u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
1288 u8 last_gas_dialog_token, prev_gas_dialog_token;
1289
1290 unsigned int no_keep_alive:1;
1291 unsigned int ext_mgmt_frame_handling:1;
1292 unsigned int ext_eapol_frame_io:1;
1293 unsigned int wmm_ac_supported:1;
1294 unsigned int ext_work_in_progress:1;
1295 unsigned int own_disconnect_req:1;
1296 unsigned int own_reconnect_req:1;
1297 unsigned int ignore_post_flush_scan_res:1;
1298
1299 #define MAC_ADDR_RAND_SCAN BIT(0)
1300 #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
1301 #define MAC_ADDR_RAND_PNO BIT(2)
1302 #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
1303 MAC_ADDR_RAND_SCHED_SCAN | \
1304 MAC_ADDR_RAND_PNO)
1305 unsigned int mac_addr_rand_supported;
1306 unsigned int mac_addr_rand_enable;
1307
1308 /* MAC Address followed by mask (2 * ETH_ALEN) */
1309 u8 *mac_addr_scan;
1310 u8 *mac_addr_sched_scan;
1311 u8 *mac_addr_pno;
1312
1313 #ifdef CONFIG_WNM
1314 u8 wnm_dialog_token;
1315 u8 wnm_reply;
1316 u8 wnm_num_neighbor_report;
1317 u8 wnm_mode;
1318 u16 wnm_dissoc_timer;
1319 u8 wnm_bss_termination_duration[12];
1320 struct neighbor_report *wnm_neighbor_report_elements;
1321 struct os_reltime wnm_cand_valid_until;
1322 u8 wnm_cand_from_bss[ETH_ALEN];
1323 enum bss_trans_mgmt_status_code bss_tm_status;
1324 bool bss_trans_mgmt_in_progress;
1325 struct wpabuf *coloc_intf_elems;
1326 u8 coloc_intf_dialog_token;
1327 u8 coloc_intf_auto_report;
1328 u8 coloc_intf_timeout;
1329 #ifdef CONFIG_MBO
1330 unsigned int wnm_mbo_trans_reason_present:1;
1331 unsigned int wnm_mbo_cell_pref_present:1;
1332 unsigned int wnm_mbo_assoc_retry_delay_present:1;
1333 u8 wnm_mbo_transition_reason;
1334 u8 wnm_mbo_cell_preference;
1335 u16 wnm_mbo_assoc_retry_delay_sec;
1336 #endif /* CONFIG_MBO */
1337 #endif /* CONFIG_WNM */
1338
1339 #ifdef CONFIG_TESTING_GET_GTK
1340 u8 last_gtk[32];
1341 size_t last_gtk_len;
1342 #endif /* CONFIG_TESTING_GET_GTK */
1343
1344 unsigned int num_multichan_concurrent;
1345 struct wpa_radio_work *connect_work;
1346
1347 unsigned int ext_work_id;
1348
1349 struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
1350
1351 #ifdef CONFIG_TESTING_OPTIONS
1352 struct l2_packet_data *l2_test;
1353 unsigned int extra_roc_dur;
1354 enum wpa_supplicant_test_failure test_failure;
1355 char *get_pref_freq_list_override;
1356 unsigned int reject_btm_req_reason;
1357 unsigned int p2p_go_csa_on_inv:1;
1358 unsigned int ignore_auth_resp:1;
1359 unsigned int ignore_assoc_disallow:1;
1360 unsigned int disable_sa_query:1;
1361 unsigned int testing_resend_assoc:1;
1362 unsigned int ignore_sae_h2e_only:1;
1363 int ft_rsnxe_used;
1364 struct wpabuf *sae_commit_override;
1365 enum wpa_alg last_tk_alg;
1366 u8 last_tk_addr[ETH_ALEN];
1367 int last_tk_key_idx;
1368 u8 last_tk[WPA_TK_MAX_LEN];
1369 size_t last_tk_len;
1370 struct wpabuf *last_assoc_req_wpa_ie;
1371 int *extra_sae_rejected_groups;
1372 struct wpabuf *rsne_override_eapol;
1373 struct wpabuf *rsnxe_override_assoc;
1374 struct wpabuf *rsnxe_override_eapol;
1375 struct dl_list drv_signal_override;
1376 unsigned int oci_freq_override_eapol;
1377 unsigned int oci_freq_override_saquery_req;
1378 unsigned int oci_freq_override_saquery_resp;
1379 unsigned int oci_freq_override_eapol_g2;
1380 unsigned int oci_freq_override_ft_assoc;
1381 unsigned int oci_freq_override_fils_assoc;
1382 unsigned int oci_freq_override_wnm_sleep;
1383 unsigned int disable_eapol_g2_tx;
1384 #endif /* CONFIG_TESTING_OPTIONS */
1385
1386 struct wmm_ac_assoc_data *wmm_ac_assoc_info;
1387 struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
1388 struct wmm_ac_addts_request *addts_request;
1389 u8 wmm_ac_last_dialog_token;
1390 struct wmm_tspec_element *last_tspecs;
1391 u8 last_tspecs_count;
1392
1393 struct rrm_data rrm;
1394 struct beacon_rep_data beacon_rep_data;
1395
1396 #ifdef CONFIG_FST
1397 struct fst_iface *fst;
1398 const struct wpabuf *fst_ies;
1399 struct wpabuf *received_mb_ies;
1400 #endif /* CONFIG_FST */
1401
1402 #ifdef CONFIG_MBO
1403 /* Multiband operation non-preferred channel */
1404 struct wpa_mbo_non_pref_channel {
1405 enum mbo_non_pref_chan_reason reason;
1406 u8 oper_class;
1407 u8 chan;
1408 u8 preference;
1409 } *non_pref_chan;
1410 size_t non_pref_chan_num;
1411 u8 mbo_wnm_token;
1412 /**
1413 * enable_oce - Enable OCE if it is enabled by user and device also
1414 * supports OCE.
1415 * User can enable OCE with wpa_config's 'oce' parameter as follows -
1416 * - Set BIT(0) to enable OCE in non-AP STA mode.
1417 * - Set BIT(1) to enable OCE in STA-CFON mode.
1418 */
1419 u8 enable_oce;
1420 #endif /* CONFIG_MBO */
1421
1422 /*
1423 * This should be under CONFIG_MBO, but it is left out to allow using
1424 * the bss_temp_disallowed list for other purposes as well.
1425 */
1426 struct dl_list bss_tmp_disallowed;
1427
1428 /*
1429 * Content of a measurement report element with type 8 (LCI),
1430 * own location.
1431 */
1432 struct wpabuf *lci;
1433 struct os_reltime lci_time;
1434
1435 struct os_reltime beacon_rep_scan;
1436
1437 /* FILS HLP requests (struct fils_hlp_req) */
1438 struct dl_list fils_hlp_req;
1439
1440 struct sched_scan_relative_params {
1441 /**
1442 * relative_rssi_set - Enable relatively preferred BSS reporting
1443 *
1444 * 0 = Disable reporting relatively preferred BSSs
1445 * 1 = Enable reporting relatively preferred BSSs
1446 */
1447 int relative_rssi_set;
1448
1449 /**
1450 * relative_rssi - Relative RSSI for reporting better BSSs
1451 *
1452 * Amount of RSSI by which a BSS should be better than the
1453 * current connected BSS so that the new BSS can be reported
1454 * to user space. This applies to sched_scan operations.
1455 */
1456 int relative_rssi;
1457
1458 /**
1459 * relative_adjust_band - Band in which RSSI is to be adjusted
1460 */
1461 enum set_band relative_adjust_band;
1462
1463 /**
1464 * relative_adjust_rssi - RSSI adjustment
1465 *
1466 * An amount of relative_adjust_rssi should be added to the
1467 * BSSs that belong to the relative_adjust_band while comparing
1468 * with other bands for BSS reporting.
1469 */
1470 int relative_adjust_rssi;
1471 } srp;
1472
1473 /* RIC elements for FT protocol */
1474 struct wpabuf *ric_ies;
1475
1476 int last_auth_timeout_sec;
1477
1478 #ifdef CONFIG_DPP
1479 struct dpp_global *dpp;
1480 struct dpp_authentication *dpp_auth;
1481 struct wpa_radio_work *dpp_listen_work;
1482 unsigned int dpp_pending_listen_freq;
1483 unsigned int dpp_listen_freq;
1484 struct os_reltime dpp_listen_end;
1485 u8 dpp_allowed_roles;
1486 int dpp_qr_mutual;
1487 int dpp_netrole;
1488 int dpp_auth_ok_on_ack;
1489 int dpp_in_response_listen;
1490 int dpp_gas_client;
1491 int dpp_gas_server;
1492 int dpp_gas_dialog_token;
1493 u8 dpp_intro_bssid[ETH_ALEN];
1494 void *dpp_intro_network;
1495 u8 dpp_intro_peer_version;
1496 struct dpp_pkex *dpp_pkex;
1497 struct dpp_bootstrap_info *dpp_pkex_bi;
1498 char *dpp_pkex_code;
1499 size_t dpp_pkex_code_len;
1500 char *dpp_pkex_identifier;
1501 enum dpp_pkex_ver dpp_pkex_ver;
1502 char *dpp_pkex_auth_cmd;
1503 char *dpp_configurator_params;
1504 struct os_reltime dpp_last_init;
1505 struct os_reltime dpp_init_iter_start;
1506 unsigned int dpp_init_max_tries;
1507 unsigned int dpp_init_retry_time;
1508 unsigned int dpp_resp_wait_time;
1509 unsigned int dpp_resp_max_tries;
1510 unsigned int dpp_resp_retry_time;
1511 u8 dpp_last_ssid[SSID_MAX_LEN];
1512 size_t dpp_last_ssid_len;
1513 bool dpp_conf_backup_received;
1514 bool dpp_pkex_wait_auth_req;
1515 #ifdef CONFIG_DPP2
1516 struct dpp_pfs *dpp_pfs;
1517 int dpp_pfs_fallback;
1518 struct wpabuf *dpp_presence_announcement;
1519 struct dpp_bootstrap_info *dpp_chirp_bi;
1520 int dpp_chirp_freq;
1521 int *dpp_chirp_freqs;
1522 int dpp_chirp_iter;
1523 int dpp_chirp_round;
1524 int dpp_chirp_scan_done;
1525 int dpp_chirp_listen;
1526 struct wpa_ssid *dpp_reconfig_ssid;
1527 int dpp_reconfig_ssid_id;
1528 struct dpp_reconfig_id *dpp_reconfig_id;
1529 #endif /* CONFIG_DPP2 */
1530 #ifdef CONFIG_DPP3
1531 struct os_reltime dpp_pb_time;
1532 bool dpp_pb_configurator;
1533 int *dpp_pb_freqs;
1534 unsigned int dpp_pb_freq_idx;
1535 unsigned int dpp_pb_announce_count;
1536 struct wpabuf *dpp_pb_announcement;
1537 struct dpp_bootstrap_info *dpp_pb_bi;
1538 unsigned int dpp_pb_resp_freq;
1539 u8 dpp_pb_init_hash[SHA256_MAC_LEN];
1540 int dpp_pb_stop_iter;
1541 bool dpp_pb_discovery_done;
1542 u8 dpp_pb_c_nonce[DPP_MAX_NONCE_LEN];
1543 size_t dpp_pb_c_nonce_len;
1544 bool dpp_pb_result_indicated;
1545 struct os_reltime dpp_pb_announce_time;
1546 struct dpp_pb_info dpp_pb[DPP_PB_INFO_COUNT];
1547 u8 dpp_pb_resp_hash[SHA256_MAC_LEN];
1548 struct os_reltime dpp_pb_last_resp;
1549 char *dpp_pb_cmd;
1550 #endif /* CONFIG_DPP3 */
1551 #ifdef CONFIG_TESTING_OPTIONS
1552 char *dpp_config_obj_override;
1553 char *dpp_discovery_override;
1554 char *dpp_groups_override;
1555 unsigned int dpp_ignore_netaccesskey_mismatch:1;
1556 unsigned int dpp_discard_public_action:1;
1557 #endif /* CONFIG_TESTING_OPTIONS */
1558 #endif /* CONFIG_DPP */
1559
1560 #ifdef CONFIG_FILS
1561 unsigned int disable_fils:1;
1562 #endif /* CONFIG_FILS */
1563 unsigned int ieee80211ac:1;
1564 unsigned int enabled_4addr_mode:1;
1565 unsigned int multi_bss_support:1;
1566 unsigned int drv_authorized_port:1;
1567 unsigned int multi_ap_ie:1;
1568 unsigned int multi_ap_backhaul:1;
1569 unsigned int multi_ap_fronthaul:1;
1570 struct robust_av_data robust_av;
1571 bool mscs_setup_done;
1572
1573 bool wps_scan_done; /* Set upon receiving scan results event */
1574 bool supp_pbc_active; /* Set for interface when PBC is triggered */
1575 bool wps_overlap;
1576
1577 #ifdef CONFIG_PASN
1578 struct pasn_data pasn;
1579 struct wpa_radio_work *pasn_auth_work;
1580 unsigned int pasn_count;
1581 struct pasn_auth *pasn_params;
1582 #endif /* CONFIG_PASN */
1583 struct scs_robust_av_data scs_robust_av_req;
1584 u8 scs_dialog_token;
1585 #ifdef CONFIG_TESTING_OPTIONS
1586 unsigned int disable_scs_support:1;
1587 unsigned int disable_mscs_support:1;
1588 #endif /* CONFIG_TESTING_OPTIONS */
1589 struct dl_list active_scs_ids;
1590 bool ongoing_scs_req;
1591 u8 dscp_req_dialog_token;
1592 u8 dscp_query_dialog_token;
1593 unsigned int enable_dscp_policy_capa:1;
1594 unsigned int connection_dscp:1;
1595 unsigned int wait_for_dscp_req:1;
1596 bool is_6ghz_enabled;
1597 bool crossed_6ghz_dom;
1598 bool last_scan_all_chan;
1599 bool last_scan_non_coloc_6ghz;
1600 bool support_6ghz;
1601
1602 struct wpa_signal_info last_signal_info;
1603
1604 struct wpa_ssid *ml_connect_probe_ssid;
1605 struct wpa_bss *ml_connect_probe_bss;
1606
1607 #ifdef CONFIG_OWE
1608 /* An array of frequencies to scan for OWE transition mode BSSs when
1609 * owe_transition_search == 1 */
1610 int *owe_trans_scan_freq;
1611 #endif /* CONFIG_OWE */
1612 };
1613
1614
1615 /* wpa_supplicant.c */
1616 void wpa_supplicant_apply_ht_overrides(
1617 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1618 struct wpa_driver_associate_params *params);
1619 void wpa_supplicant_apply_vht_overrides(
1620 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1621 struct wpa_driver_associate_params *params);
1622 void wpa_supplicant_apply_he_overrides(
1623 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1624 struct wpa_driver_associate_params *params);
1625 void wpa_supplicant_apply_eht_overrides(
1626 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
1627 struct wpa_driver_associate_params *params);
1628
1629 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1630 int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
1631 struct wpa_ssid *ssid);
1632
1633 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
1634
1635 const char * wpa_supplicant_state_txt(enum wpa_states state);
1636 int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
1637 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
1638 int wpa_supplicant_update_bridge_ifname(struct wpa_supplicant *wpa_s,
1639 const char *bridge_ifname);
1640 void wpas_set_mgmt_group_cipher(struct wpa_supplicant *wpa_s,
1641 struct wpa_ssid *ssid, struct wpa_ie_data *ie);
1642 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
1643 struct wpa_bss *bss, struct wpa_ssid *ssid,
1644 u8 *wpa_ie, size_t *wpa_ie_len,
1645 bool skip_default_rsne);
1646 int wpas_restore_permanent_mac_addr(struct wpa_supplicant *wpa_s);
1647 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
1648 struct wpa_bss *bss,
1649 struct wpa_ssid *ssid);
1650 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
1651 struct wpa_ssid *ssid);
1652 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
1653 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
1654 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
1655 int sec, int usec);
1656 void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff);
1657 void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
1658 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
1659 enum wpa_states state);
1660 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
1661 const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
1662 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
1663 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
1664 u16 reason_code);
1665 void wpa_supplicant_reconnect(struct wpa_supplicant *wpa_s);
1666
1667 struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
1668 int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);
1669 int wpa_supplicant_remove_all_networks(struct wpa_supplicant *wpa_s);
1670 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
1671 struct wpa_ssid *ssid);
1672 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
1673 struct wpa_ssid *ssid);
1674 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
1675 struct wpa_ssid *ssid);
1676 int wpas_remove_cred(struct wpa_supplicant *wpa_s, struct wpa_cred *cred);
1677 int wpas_remove_all_creds(struct wpa_supplicant *wpa_s);
1678 int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
1679 const char *pkcs11_engine_path,
1680 const char *pkcs11_module_path);
1681 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
1682 int ap_scan);
1683 int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
1684 unsigned int expire_age);
1685 int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
1686 unsigned int expire_count);
1687 int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
1688 int scan_interval);
1689 int wpa_supplicant_set_debug_params(struct wpa_global *global,
1690 int debug_level, int debug_timestamp,
1691 int debug_show_keys);
1692 void free_hw_features(struct wpa_supplicant *wpa_s);
1693
1694 void wpa_show_license(void);
1695
1696 struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
1697 const char *ifname);
1698 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
1699 struct wpa_interface *iface,
1700 struct wpa_supplicant *parent);
1701 int wpa_supplicant_remove_iface(struct wpa_global *global,
1702 struct wpa_supplicant *wpa_s,
1703 int terminate);
1704 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
1705 const char *ifname);
1706 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
1707 int wpa_supplicant_run(struct wpa_global *global);
1708 void wpa_supplicant_deinit(struct wpa_global *global);
1709
1710 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
1711 struct wpa_ssid *ssid);
1712 void wpa_supplicant_terminate_proc(struct wpa_global *global);
1713 void wpa_supplicant_rx_eapol(void *ctx, const u8 *own_addr,
1714 const u8 *buf, size_t len,
1715 enum frame_encryption encrypted);
1716 void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
1717 void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
1718 void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
1719 void fils_connection_failure(struct wpa_supplicant *wpa_s);
1720 void fils_pmksa_cache_flush(struct wpa_supplicant *wpa_s);
1721 int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
1722 int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
1723 void wpas_auth_failed(struct wpa_supplicant *wpa_s, const char *reason,
1724 const u8 *bssid);
1725 void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
1726 struct wpa_ssid *ssid, int clear_failures);
1727 int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
1728 int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
1729 size_t ssid_len);
1730 void wpas_request_connection(struct wpa_supplicant *wpa_s);
1731 void wpas_request_disconnection(struct wpa_supplicant *wpa_s);
1732 int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen,
1733 struct wpa_bss *bss);
1734 int wpas_update_random_addr(struct wpa_supplicant *wpa_s,
1735 enum wpas_mac_addr_style style,
1736 struct wpa_ssid *ssid);
1737 int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
1738 void add_freq(int *freqs, int *num_freqs, int freq);
1739
1740 int wpas_get_op_chan_phy(int freq, const u8 *ies, size_t ies_len,
1741 u8 *op_class, u8 *chan, u8 *phy_type);
1742
1743 int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent,
1744 int mantissa, u8 min_twt, int setup_cmd, u64 twt,
1745 bool requestor, bool trigger, bool implicit,
1746 bool flow_type, u8 flow_id, bool protection,
1747 u8 twt_channel, u8 control);
1748 int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags);
1749
1750 void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
1751 void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
1752 const u8 *report, size_t report_len);
1753 int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
1754 const struct wpa_ssid_value *ssid,
1755 int lci, int civic,
1756 void (*cb)(void *ctx,
1757 struct wpabuf *neighbor_rep),
1758 void *cb_ctx);
1759 void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
1760 const u8 *src, const u8 *dst,
1761 const u8 *frame, size_t len);
1762 void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
1763 const u8 *src,
1764 const u8 *frame, size_t len,
1765 int rssi);
1766 void wpas_rrm_refuse_request(struct wpa_supplicant *wpa_s);
1767 int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s,
1768 struct wpa_scan_results *scan_res,
1769 struct scan_info *info);
1770 void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s);
1771 void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
1772 void wpas_clear_disabled_interface(void *eloop_ctx, void *timeout_ctx);
1773 void wpa_supplicant_reset_bgscan(struct wpa_supplicant *wpa_s);
1774
1775
1776 /* MBO functions */
1777 int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len,
1778 int add_oce_capa);
1779 const u8 * mbo_attr_from_mbo_ie(const u8 *mbo_ie, enum mbo_attr_id attr);
1780 const u8 * wpas_mbo_check_assoc_disallow(struct wpa_bss *bss);
1781 void wpas_mbo_check_pmf(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
1782 struct wpa_ssid *ssid);
1783 const u8 * mbo_get_attr_from_ies(const u8 *ies, size_t ies_len,
1784 enum mbo_attr_id attr);
1785 int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
1786 const char *non_pref_chan);
1787 void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
1788 void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie,
1789 size_t len);
1790 size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos,
1791 size_t len,
1792 enum mbo_transition_reject_reason reason);
1793 void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa);
1794 struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
1795 struct wpa_bss *bss, u32 mbo_subtypes);
1796 void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
1797 struct wpa_bss *bss, const u8 *sa,
1798 const u8 *data, size_t slen);
1799 void wpas_update_mbo_connect_params(struct wpa_supplicant *wpa_s);
1800
1801 /* op_classes.c */
1802 enum chan_allowed {
1803 NOT_ALLOWED, NO_IR, RADAR, ALLOWED
1804 };
1805
1806 enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 op_class,
1807 u8 channel, u8 bw);
1808 size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s,
1809 struct wpa_ssid *ssid,
1810 struct wpa_bss *bss, u8 *pos, size_t len);
1811 int * wpas_supp_op_classes(struct wpa_supplicant *wpa_s);
1812
1813 int wpas_enable_mac_addr_randomization(struct wpa_supplicant *wpa_s,
1814 unsigned int type, const u8 *addr,
1815 const u8 *mask);
1816 int wpas_disable_mac_addr_randomization(struct wpa_supplicant *wpa_s,
1817 unsigned int type);
1818
1819 /**
1820 * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
1821 * @wpa_s: Pointer to wpa_supplicant data
1822 * @ssid: Pointer to the network block the reply is for
1823 * @field: field the response is a reply for
1824 * @value: value (ie, password, etc) for @field
1825 * Returns: 0 on success, non-zero on error
1826 *
1827 * Helper function to handle replies to control interface requests.
1828 */
1829 int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
1830 struct wpa_ssid *ssid,
1831 const char *field,
1832 const char *value);
1833 /**
1834 * wpa_supplicant_ctrl_rsp_handle - Handle a control response
1835 * @wpa_s: Pointer to wpa_supplicant data
1836 * @ssid: Pointer to the network block the reply is for
1837 * @field: field the response is a reply for
1838 * @value: value (ie, password, etc) for @field
1839 * Returns: 0 on success, non-zero on error
1840 *
1841 * Helper function to handle replies to control interface requests.
1842 */
1843 int wpa_supplicant_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
1844 struct wpa_ssid *ssid,
1845 enum wpa_ctrl_req_type rtype,
1846 const char *value, int len);
1847
1848 void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
1849 const struct wpa_ssid *ssid,
1850 struct hostapd_freq_params *freq);
1851
1852 /* events.c */
1853 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
1854 int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
1855 struct wpa_bss *selected,
1856 struct wpa_ssid *ssid);
1857 void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
1858 void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
1859 void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
1860 int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
1861 int wpa_wps_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
1862 struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
1863 struct wpa_ssid **selected_ssid);
1864 int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1865 void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s,
1866 struct channel_list_changed *info);
1867 int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
1868 struct wpa_bss *current_bss,
1869 struct wpa_bss *seleceted);
1870 void wpas_reset_mlo_info(struct wpa_supplicant *wpa_s);
1871
1872 /* eap_register.c */
1873 int eap_register_methods(void);
1874
1875 /**
1876 * Utility method to tell if a given network is for persistent group storage
1877 * @ssid: Network object
1878 * Returns: 1 if network is a persistent group, 0 otherwise
1879 */
network_is_persistent_group(struct wpa_ssid * ssid)1880 static inline int network_is_persistent_group(struct wpa_ssid *ssid)
1881 {
1882 return ssid->disabled == 2 && ssid->p2p_persistent_group;
1883 }
1884
wpas_mode_to_ieee80211_mode(enum wpas_mode mode)1885 static inline int wpas_mode_to_ieee80211_mode(enum wpas_mode mode)
1886 {
1887 switch (mode) {
1888 default:
1889 case WPAS_MODE_INFRA:
1890 return IEEE80211_MODE_INFRA;
1891 case WPAS_MODE_IBSS:
1892 return IEEE80211_MODE_IBSS;
1893 case WPAS_MODE_AP:
1894 case WPAS_MODE_P2P_GO:
1895 case WPAS_MODE_P2P_GROUP_FORMATION:
1896 return IEEE80211_MODE_AP;
1897 case WPAS_MODE_MESH:
1898 return IEEE80211_MODE_MESH;
1899 }
1900 }
1901
1902
1903 int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1904 int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
1905 int pmf_in_use(struct wpa_supplicant *wpa_s, const u8 *addr);
1906 void wpa_s_setup_sae_pt(struct wpa_config *conf, struct wpa_ssid *ssid,
1907 bool force);
1908
1909 bool wpas_is_sae_avoided(struct wpa_supplicant *wpa_s,
1910 struct wpa_ssid *ssid,
1911 const struct wpa_ie_data *ie);
1912
1913 int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
1914
1915 void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
1916 struct wpa_used_freq_data *freqs_data,
1917 unsigned int len);
1918
1919 int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
1920 struct wpa_used_freq_data *freqs_data,
1921 unsigned int len, bool exclude_current);
1922 int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
1923 int *freq_array, unsigned int len,
1924 bool exclude_current);
1925 int disabled_freq(struct wpa_supplicant *wpa_s, int freq);
1926
1927 void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
1928
1929 void wpas_vendor_elem_update(struct wpa_supplicant *wpa_s);
1930 struct wpa_supplicant * wpas_vendor_elem(struct wpa_supplicant *wpa_s,
1931 enum wpa_vendor_elem_frame frame);
1932 int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
1933 const u8 *elem, size_t len);
1934
1935 #ifdef CONFIG_FST
1936
1937 struct fst_wpa_obj;
1938
1939 void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
1940 struct fst_wpa_obj *iface_obj);
1941
1942 #endif /* CONFIG_FST */
1943
1944 int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd);
1945
1946 struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
1947 u16 num_modes, enum hostapd_hw_mode mode,
1948 bool is_6ghz);
1949 struct hostapd_hw_modes * get_mode_with_freq(struct hostapd_hw_modes *modes,
1950 u16 num_modes, int freq);
1951
1952 void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
1953 unsigned int sec, int rssi_threshold);
1954 int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s,
1955 struct wpa_bss *bss);
1956 void free_bss_tmp_disallowed(struct wpa_supplicant *wpa_s);
1957
1958 struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
1959 int i, struct wpa_bss *bss,
1960 struct wpa_ssid *group,
1961 int only_first_ssid, int debug_print);
1962
1963 int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
1964 enum wpa_driver_if_type if_type,
1965 unsigned int *num,
1966 struct weighted_pcl *freq_list);
1967
1968 int wpa_is_fils_supported(struct wpa_supplicant *wpa_s);
1969 int wpa_is_fils_sk_pfs_supported(struct wpa_supplicant *wpa_s);
1970
1971 void wpas_clear_driver_signal_override(struct wpa_supplicant *wpa_s);
1972
1973 int wpas_send_mscs_req(struct wpa_supplicant *wpa_s);
1974 void wpas_populate_mscs_descriptor_ie(struct robust_av_data *robust_av,
1975 struct wpabuf *buf);
1976 void wpas_handle_robust_av_recv_action(struct wpa_supplicant *wpa_s,
1977 const u8 *src, const u8 *buf,
1978 size_t len);
1979 void wpas_handle_assoc_resp_mscs(struct wpa_supplicant *wpa_s, const u8 *bssid,
1980 const u8 *ies, size_t ies_len);
1981 int wpas_send_scs_req(struct wpa_supplicant *wpa_s);
1982 void free_up_tclas_elem(struct scs_desc_elem *elem);
1983 void free_up_scs_desc(struct scs_robust_av_data *data);
1984 void wpas_handle_robust_av_scs_recv_action(struct wpa_supplicant *wpa_s,
1985 const u8 *src, const u8 *buf,
1986 size_t len);
1987 void wpas_scs_deinit(struct wpa_supplicant *wpa_s);
1988 void wpas_handle_qos_mgmt_recv_action(struct wpa_supplicant *wpa_s,
1989 const u8 *src,
1990 const u8 *buf, size_t len);
1991 void wpas_dscp_deinit(struct wpa_supplicant *wpa_s);
1992 int wpas_send_dscp_response(struct wpa_supplicant *wpa_s,
1993 struct dscp_resp_data *resp_data);
1994 void wpas_handle_assoc_resp_qos_mgmt(struct wpa_supplicant *wpa_s,
1995 const u8 *ies, size_t ies_len);
1996 int wpas_send_dscp_query(struct wpa_supplicant *wpa_s, const char *domain_name,
1997 size_t domain_name_length);
1998
1999 int wpas_pasn_auth_start(struct wpa_supplicant *wpa_s, const u8 *own_addr,
2000 const u8 *bssid, int akmp, int cipher,
2001 u16 group, int network_id,
2002 const u8 *comeback, size_t comeback_len);
2003 void wpas_pasn_auth_stop(struct wpa_supplicant *wpa_s);
2004 int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
2005 const u8 *data, size_t data_len, u8 acked);
2006 int wpas_pasn_auth_rx(struct wpa_supplicant *wpa_s,
2007 const struct ieee80211_mgmt *mgmt, size_t len);
2008 int disabled_freq(struct wpa_supplicant *wpa_s, int freq);
2009
2010 int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr,
2011 const u8 *bssid);
2012 void wpas_pasn_auth_trigger(struct wpa_supplicant *wpa_s,
2013 struct pasn_auth *pasn_auth);
2014 void wpas_pasn_auth_work_done(struct wpa_supplicant *wpa_s, int status);
2015 bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled);
2016
2017 bool wpa_is_non_eht_scs_traffic_desc_supported(struct wpa_bss *bss);
2018
2019 #endif /* WPA_SUPPLICANT_I_H */
2020