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