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