Merge branch 'bugfix/connect_issue_for_zero_rssi_v4.3' into 'release/v4.3'

fix(esp_wifi): Fix issue of station disconnecting immediately after scanning (Backport v4.3)

See merge request espressif/esp-idf!26748
This commit is contained in:
Jiang Jiang Jian 2023-11-21 10:50:23 +08:00
commit 0e493db2fe
8 changed files with 19 additions and 38 deletions

View File

@ -1168,7 +1168,8 @@ esp_err_t esp_wifi_statis_dump(uint32_t modules);
* *
* @attention This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received. * @attention This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.
* *
* @param rssi threshold value in dbm between -100 to 0 * @param rssi threshold value in dbm between -100 to 10
* Note that in some rare cases where signal strength is very strong, rssi values can be slightly positive.
* *
* @return * @return
* - ESP_OK: succeed * - ESP_OK: succeed

View File

@ -193,7 +193,7 @@ typedef struct {
uint8_t ssid[33]; /**< SSID of AP */ uint8_t ssid[33]; /**< SSID of AP */
uint8_t primary; /**< channel of AP */ uint8_t primary; /**< channel of AP */
wifi_second_chan_t second; /**< secondary channel of AP */ wifi_second_chan_t second; /**< secondary channel of AP */
int8_t rssi; /**< signal strength of AP */ int8_t rssi; /**< signal strength of AP. Note that in some rare cases where signal strength is very strong, rssi values can be slightly positive */
wifi_auth_mode_t authmode; /**< authmode of AP */ wifi_auth_mode_t authmode; /**< authmode of AP */
wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */ wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */
wifi_cipher_type_t group_cipher; /**< group cipher of AP */ wifi_cipher_type_t group_cipher; /**< group cipher of AP */

@ -1 +1 @@
Subproject commit 0d32ed16f0671cdff0b5be6335c378ae3c593c2d Subproject commit 3c8d0d5a09f31a3b1f8288d0e66dc202c5dcbcc9

View File

@ -31,7 +31,7 @@ static void *s_supplicant_api_lock = NULL;
static bool s_supplicant_task_init_done; static bool s_supplicant_task_init_done;
static int handle_action_frm(u8 *frame, size_t len, static int handle_action_frm(u8 *frame, size_t len,
u8 *sender, u32 rssi, u8 channel) u8 *sender, int8_t rssi, u8 channel)
{ {
struct ieee_mgmt_frame *frm = os_malloc(sizeof(struct ieee_mgmt_frame) + len); struct ieee_mgmt_frame *frm = os_malloc(sizeof(struct ieee_mgmt_frame) + len);
@ -55,7 +55,7 @@ static int handle_action_frm(u8 *frame, size_t len,
} }
static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender, static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender,
u8 *payload, size_t len, u32 rssi) u8 *payload, size_t len, int8_t rssi)
{ {
if (payload[0] == WLAN_RRM_NEIGHBOR_REPORT_RESPONSE) { if (payload[0] == WLAN_RRM_NEIGHBOR_REPORT_RESPONSE) {
/* neighbor report parsing */ /* neighbor report parsing */
@ -71,7 +71,7 @@ static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender,
} }
} }
static int mgmt_rx_action(u8 *sender, u8 *payload, size_t len, u8 channel, u32 rssi) static int mgmt_rx_action(u8 *sender, u8 *payload, size_t len, u8 channel, int8_t rssi)
{ {
u8 category; u8 category;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
@ -194,7 +194,7 @@ void esp_supplicant_unset_all_appie(void)
} }
static int ieee80211_handle_rx_frm(u8 type, u8 *frame, size_t len, u8 *sender, static int ieee80211_handle_rx_frm(u8 type, u8 *frame, size_t len, u8 *sender,
u32 rssi, u8 channel, u64 current_tsf) int8_t rssi, u8 channel, u64 current_tsf)
{ {
int ret = 0; int ret = 0;

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -15,7 +15,7 @@ struct wpa_funcs;
struct ieee_mgmt_frame { struct ieee_mgmt_frame {
u8 sender[ETH_ALEN]; u8 sender[ETH_ALEN];
u8 channel; u8 channel;
u32 rssi; int8_t rssi;
size_t len; size_t len;
u8 payload[0]; u8 payload[0];
}; };

View File

@ -1,17 +1,7 @@
/** /*
* Copyright 2020 Espressif Systems (Shanghai) PTE LTD * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * SPDX-License-Identifier: Apache-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include "utils/includes.h" #include "utils/includes.h"
@ -117,7 +107,7 @@ void esp_scan_deinit(struct wpa_supplicant *wpa_s)
} }
int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender, int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender,
u32 rssi, u8 channel, u64 current_tsf) int8_t rssi, u8 channel, u64 current_tsf)
{ {
struct wpa_supplicant *wpa_s = &g_wpa_supp; struct wpa_supplicant *wpa_s = &g_wpa_supp;
struct os_reltime now; struct os_reltime now;

View File

@ -1,17 +1,7 @@
/** /*
* Copyright 2020 Espressif Systems (Shanghai) PTE LTD * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * SPDX-License-Identifier: Apache-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#ifndef ESP_SCAN_I_H #ifndef ESP_SCAN_I_H
@ -19,7 +9,7 @@
void esp_scan_init(struct wpa_supplicant *wpa_s); void esp_scan_init(struct wpa_supplicant *wpa_s);
void esp_scan_deinit(struct wpa_supplicant *wpa_s); void esp_scan_deinit(struct wpa_supplicant *wpa_s);
int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender, int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender,
u32 rssi, u8 channel, u64 current_tsf); int8_t rssi, u8 channel, u64 current_tsf);
void esp_supplicant_handle_scan_done_evt(void); void esp_supplicant_handle_scan_done_evt(void);
#endif #endif

View File

@ -137,7 +137,7 @@ struct wpa_funcs {
int (*wpa_michael_mic_failure)(u16 is_unicast); int (*wpa_michael_mic_failure)(u16 is_unicast);
uint8_t *(*wpa3_build_sae_msg)(uint8_t *bssid, uint32_t type, size_t *len); uint8_t *(*wpa3_build_sae_msg)(uint8_t *bssid, uint32_t type, size_t *len);
int (*wpa3_parse_sae_msg)(uint8_t *buf, size_t len, uint32_t type, uint16_t status); int (*wpa3_parse_sae_msg)(uint8_t *buf, size_t len, uint32_t type, uint16_t status);
int (*wpa_sta_rx_mgmt)(u8 type, u8 *frame, size_t len, u8 *sender, u32 rssi, u8 channel, u64 current_tsf); int (*wpa_sta_rx_mgmt)(u8 type, u8 *frame, size_t len, u8 *sender, int8_t rssi, u8 channel, u64 current_tsf);
void (*wpa_config_done)(void); void (*wpa_config_done)(void);
int (*wpa_sta_set_ap_rsnxe)(const u8 *rsnxe, size_t rsnxe_ie_len); int (*wpa_sta_set_ap_rsnxe)(const u8 *rsnxe, size_t rsnxe_ie_len);
}; };