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