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