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