From c3f1c3fcdef2b14a358e494d5beb9a36a252f0bd Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Fri, 29 Mar 2024 17:58:12 +0530 Subject: [PATCH] feat(esp_wifi): Add channel bitmaps to the scan config - Add the ability to specify the specific channels and the in wifi_config_t. - Adds warning that discourages setting bssid and channel in sta_config when btm/mbo is enabled and supported by the network. - Fix issues with reporting authmodes of FT supporting APs during scanning. - Additional typo fixes in the public header files --- .../esp_wifi/include/esp_wifi_types_generic.h | 53 ++++++++++++------- components/esp_wifi/lib | 2 +- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 83e0043d7c..7f0a1b40ab 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -164,15 +164,24 @@ typedef struct { cause station to disconnect from AP and are not recommended. */ } wifi_scan_time_t; +typedef struct { + uint16_t ghz_2_channels; /**< Represents 2.4 GHz channels */ + uint8_t unii1_channels; /**< UNII-1 channels */ + uint8_t unii2_channels; /**< UNII-2 channels */ + uint16_t unii2e_channels; /**< UNII-2 Extended channels */ + uint8_t unii3_channels; /**< UNII-3 channels */ +} wifi_scan_channel_bitmap_t; + /** @brief Parameters for an SSID scan. */ typedef struct { - uint8_t *ssid; /**< SSID of AP */ - uint8_t *bssid; /**< MAC address of AP */ - uint8_t channel; /**< channel, scan the specific channel */ - bool show_hidden; /**< enable to scan AP whose SSID is hidden */ - wifi_scan_type_t scan_type; /**< scan type, active or passive */ - wifi_scan_time_t scan_time; /**< scan time per channel */ - uint8_t home_chan_dwell_time;/**< time spent at home channel between scanning consecutive channels.*/ + uint8_t *ssid; /**< SSID of AP */ + uint8_t *bssid; /**< MAC address of AP */ + uint8_t channel; /**< channel, scan the specific channel */ + bool show_hidden; /**< enable to scan AP whose SSID is hidden */ + wifi_scan_type_t scan_type; /**< scan type, active or passive */ + wifi_scan_time_t scan_time; /**< scan time per channel */ + uint8_t home_chan_dwell_time; /**< time spent at home channel between scanning consecutive channels. */ + wifi_scan_channel_bitmap_t channel_bitmap; /**< Channel bitmap for setting specific channels to be scanned. For 2.4ghz channels set ghz_2_channels from BIT(1) to BIT(14) from LSB to MSB order to indicate channels to be scanned. Currently scanning in 5ghz channels is not supported. Please note that the 'channel' parameter above needs to be set to 0 to allow scanning by bitmap. */ } wifi_scan_config_t; typedef enum { @@ -247,7 +256,7 @@ typedef enum { typedef struct { int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */ wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode - Note: Incase this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks */ + Note: In case this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks */ }wifi_scan_threshold_t; typedef enum { @@ -269,8 +278,8 @@ typedef enum { /** Configuration structure for Protected Management Frame */ typedef struct { - bool capable; /**< Deprecated variable. Device will always connect in PMF mode if other device also advertizes PMF capability. */ - bool required; /**< Advertizes that Protected Management Frame is required. Device will not associate to non-PMF capable devices. */ + bool capable; /**< Deprecated variable. Device will always connect in PMF mode if other device also advertises PMF capability. */ + bool required; /**< Advertises that Protected Management Frame is required. Device will not associate to non-PMF capable devices. */ } wifi_pmf_config_t; /** Configuration for SAE PWE derivation */ @@ -318,8 +327,8 @@ typedef struct { wifi_scan_threshold_t threshold; /**< When scan_threshold is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used. */ wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame. Will be advertised in RSN Capabilities in RSN IE. */ uint32_t rm_enabled:1; /**< Whether Radio Measurements are enabled for the connection */ - uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection */ - uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection */ + uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection. Note that when btm is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a BTM supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when BTM is enabled. */ + uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection. Note that when mbo is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a MBO supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when MBO is enabled. Enabling mbo here, automatically enables btm and rm above.*/ uint32_t ft_enabled:1; /**< Whether FT is enabled for the connection */ uint32_t owe_enabled:1; /**< Whether OWE is enabled for the connection */ uint32_t transition_disable:1; /**< Whether to enable transition disable feature */ @@ -327,7 +336,7 @@ typedef struct { wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */ wifi_sae_pk_mode_t sae_pk_mode; /**< Configuration for SAE-PK (Public Key) Authentication method */ uint8_t failure_retry_cnt; /**< Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config. - Note: Enabling this may cause connection time to increase incase best AP doesn't behave properly. */ + Note: Enabling this may cause connection time to increase in case best AP doesn't behave properly. */ uint32_t he_dcm_set:1; /**< Whether DCM max.constellation for transmission and reception is set. */ uint32_t he_dcm_max_constellation_tx:2; /**< Indicate the max.constellation for DCM in TB PPDU the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3. */ uint32_t he_dcm_max_constellation_rx:2; /**< Indicate the max.constellation for DCM in both Data field and HE-SIG-B field the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3. */ @@ -441,7 +450,7 @@ typedef struct { typedef enum { WIFI_PKT_MGMT, /**< Management frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */ WIFI_PKT_CTRL, /**< Control frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */ - WIFI_PKT_DATA, /**< Data frame, indiciates 'buf' argument is wifi_promiscuous_pkt_t */ + WIFI_PKT_DATA, /**< Data frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */ WIFI_PKT_MISC, /**< Other type, such as MIMO etc. 'buf' argument is wifi_promiscuous_pkt_t but the payload is zero length. */ } wifi_promiscuous_pkt_type_t; @@ -565,10 +574,10 @@ typedef struct { #define ESP_WIFI_NDP_ROLE_INITIATOR 1 #define ESP_WIFI_NDP_ROLE_RESPONDER 2 -#define ESP_WIFI_MAX_SVC_NAME_LEN 256 -#define ESP_WIFI_MAX_FILTER_LEN 256 -#define ESP_WIFI_MAX_SVC_INFO_LEN 64 - +#define ESP_WIFI_MAX_SVC_NAME_LEN 256 +#define ESP_WIFI_MAX_FILTER_LEN 256 +#define ESP_WIFI_MAX_SVC_INFO_LEN 64 +#define ESP_WIFI_MAX_NEIGHBOR_REP_LEN 64 /** * @brief NAN Services types * @@ -781,6 +790,8 @@ typedef enum { WIFI_EVENT_NDP_TERMINATED, /**< NAN Datapath terminated indication */ WIFI_EVENT_HOME_CHANNEL_CHANGE, /**< WiFi home channel change,doesn't occur when scanning */ + WIFI_EVENT_STA_NEIGHBOR_REP, /**< Received Neighbor Report response */ + WIFI_EVENT_MAX, /**< Invalid WiFi event ID */ } wifi_event_t; @@ -1009,6 +1020,12 @@ typedef struct { uint8_t init_ndi[6]; /**< Initiator's NAN Data Interface MAC */ } wifi_event_ndp_terminated_t; +/** Argument structure for WIFI_EVENT_STA_NEIGHBOR_REP event */ +typedef struct { + uint8_t report[ESP_WIFI_MAX_NEIGHBOR_REP_LEN]; /**< Neighbor Report received from the AP*/ + uint16_t report_len; /**< Length of the report*/ +} wifi_event_neighbor_report_t; + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 5ae2e01957..8fde018db0 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 5ae2e01957e3d1e38f5e423a25bd241d3a6ef339 +Subproject commit 8fde018db003c7918802d31d14a22eea58c9ba86