mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
Merge branch 'bugfix/fix_some_wifi_bugs_240221_v5.2' into 'release/v5.2'
fix(lwip): fixed some wifi bugs(Backport v5.2) See merge request espressif/esp-idf!29147
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ static void dbg_lwip_tcp_pcb_one_show(struct tcp_pcb* pcb)
|
||||
ESP_LWIP_LOGI("local_port=%d, remote_port=%d", pcb->local_port, pcb->remote_port);
|
||||
ESP_LWIP_LOGI("flags=%x", pcb->flags);
|
||||
ESP_LWIP_LOGI("pooltmr=%d pollinterval=%d, last_tmr=%d tmr=%" PRIu32 " rtmer=%d", pcb->polltmr, pcb->pollinterval, pcb->last_timer, pcb->tmr, pcb->rtime);
|
||||
ESP_LWIP_LOGI("recv_nxt=%" PRIu32 " recv_wnd=%d recv_ann_wnd=%d recv_ann_right_edge=%" PRIu32, pcb->rcv_nxt, pcb->rcv_wnd, pcb->rcv_ann_wnd, pcb->rcv_ann_right_edge);
|
||||
ESP_LWIP_LOGI("recv_nxt=%" PRIu32 " recv_wnd=%"TCPWNDSIZE_F" recv_ann_wnd=%"TCPWNDSIZE_F" recv_ann_right_edge=%" PRIu32, pcb->rcv_nxt, pcb->rcv_wnd, pcb->rcv_ann_wnd, pcb->rcv_ann_right_edge);
|
||||
ESP_LWIP_LOGI("mss=%d", pcb->mss);
|
||||
ESP_LWIP_LOGI("rttest=%" PRIu32 " rtseq=%" PRIu32 " sa=%d sv=%d", pcb->rttest, pcb->rtseq, pcb->sa, pcb->sv);
|
||||
ESP_LWIP_LOGI("rto=%d nrtx=%d", pcb->rto, pcb->nrtx);
|
||||
@@ -90,11 +90,11 @@ static void dbg_lwip_tcp_pcb_one_show(struct tcp_pcb* pcb)
|
||||
#if ESP_PER_SOC_TCP_WND
|
||||
ESP_LWIP_LOGI("per_soc_window=%d per_soc_snd_buf=%d", pcb->per_soc_tcp_wnd, pcb->per_soc_tcp_snd_buf);
|
||||
#endif
|
||||
ESP_LWIP_LOGI("cwnd=%d ssthreash=%d", pcb->cwnd, pcb->ssthresh);
|
||||
ESP_LWIP_LOGI("cwnd=%"TCPWNDSIZE_F" ssthreash=%"TCPWNDSIZE_F, pcb->cwnd, pcb->ssthresh);
|
||||
ESP_LWIP_LOGI("snd_next=%" PRIu32 " snd_wl1=%" PRIu32 " snd_wl2=%" PRIu32, pcb->snd_nxt, pcb->snd_wl1, pcb->snd_wl2);
|
||||
ESP_LWIP_LOGI("snd_lbb=%" PRIu32 " snd_wnd=%d snd_wnd_max=%d", pcb->snd_lbb, pcb->snd_wnd, pcb->snd_wnd_max);
|
||||
ESP_LWIP_LOGI("snd_lbb=%" PRIu32 " snd_wnd=%"TCPWNDSIZE_F" snd_wnd_max=%"TCPWNDSIZE_F, pcb->snd_lbb, pcb->snd_wnd, pcb->snd_wnd_max);
|
||||
//ESP_LWIP_LOGI("acked=%d", pcb->acked);
|
||||
ESP_LWIP_LOGI("snd_buf=%d snd_queuelen=%d", pcb->snd_buf, pcb->snd_queuelen);
|
||||
ESP_LWIP_LOGI("snd_buf=%"TCPWNDSIZE_F" snd_queuelen=%d", pcb->snd_buf, pcb->snd_queuelen);
|
||||
ESP_LWIP_LOGI("unsent_oversize=%d", pcb->unsent_oversize);
|
||||
ESP_LWIP_LOGI("keep_idle=%" PRIu32 " keep_intvl=%" PRIu32 " keep_cnt=%" PRIu32, pcb->keep_idle, pcb->keep_intvl, pcb->keep_cnt);
|
||||
ESP_LWIP_LOGI("persist_cnt=%d persist_backoff=%d", pcb->persist_cnt, pcb->persist_backoff);
|
||||
|
@@ -802,6 +802,7 @@ static esp_err_t update_wifi_scan_results(void)
|
||||
prov_ctx->ap_list[curr_channel] = (wifi_ap_record_t *) calloc(get_count, sizeof(wifi_ap_record_t));
|
||||
if (!prov_ctx->ap_list[curr_channel]) {
|
||||
ESP_LOGE(TAG, "Failed to allocate memory for AP list");
|
||||
esp_wifi_clear_ap_list();
|
||||
goto exit;
|
||||
}
|
||||
if (esp_wifi_scan_get_ap_records(&get_count, prov_ctx->ap_list[curr_channel]) != ESP_OK) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -66,13 +66,10 @@ static void handle_wnm_scan_done(struct wpa_supplicant *wpa_s)
|
||||
|
||||
static void scan_done_cleanup(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
uint16_t number = 1;
|
||||
wifi_ap_record_t ap_records;
|
||||
|
||||
wpa_s->scanning = 0;
|
||||
wpa_s->scan_reason = 0;
|
||||
/* clean scan list from net80211 */
|
||||
esp_wifi_scan_get_ap_records(&number, &ap_records);
|
||||
esp_wifi_clear_ap_list();
|
||||
}
|
||||
|
||||
void esp_supplicant_handle_scan_done_evt(void)
|
||||
|
@@ -210,6 +210,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
|
||||
wifi_ap_record_t *ap_list = (wifi_ap_record_t *)malloc(sizeof(wifi_ap_record_t) * apCount);
|
||||
if (!ap_list) {
|
||||
BLUFI_ERROR("malloc error, ap_list is NULL");
|
||||
esp_wifi_clear_ap_list();
|
||||
break;
|
||||
}
|
||||
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&apCount, ap_list));
|
||||
|
@@ -67,6 +67,7 @@ static void scan_done_handler(void)
|
||||
ap_list_buffer = malloc(sta_number * sizeof(wifi_ap_record_t));
|
||||
if (ap_list_buffer == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to malloc buffer to print scan results");
|
||||
esp_wifi_clear_ap_list();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -304,6 +304,7 @@ static bool wifi_perform_scan(const char *ssid, bool internal)
|
||||
g_ap_list_buffer = malloc(g_scan_ap_num * sizeof(wifi_ap_record_t));
|
||||
if (g_ap_list_buffer == NULL) {
|
||||
ESP_LOGE(TAG_STA, "Failed to malloc buffer to print scan results");
|
||||
esp_wifi_clear_ap_list();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -79,6 +79,7 @@ static void scan_done_handler(void *arg, esp_event_base_t event_base,
|
||||
ap_list_buffer = malloc(sta_number * sizeof(wifi_ap_record_t));
|
||||
if (ap_list_buffer == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to malloc buffer to print scan results");
|
||||
esp_wifi_clear_ap_list();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -305,9 +305,7 @@ void neighbor_report_recv_cb(void *ctx, const uint8_t *report, size_t report_len
|
||||
goto cleanup;
|
||||
}
|
||||
/* cleanup from net802.11 */
|
||||
uint16_t number = 1;
|
||||
wifi_ap_record_t ap_records;
|
||||
esp_wifi_scan_get_ap_records(&number, &ap_records);
|
||||
esp_wifi_clear_ap_list();
|
||||
cand_list = 1;
|
||||
}
|
||||
/* send AP btm query, this will cause STA to roam as well */
|
||||
|
7
examples/wifi/smart_config/main/Kconfig.projbuild
Normal file
7
examples/wifi/smart_config/main/Kconfig.projbuild
Normal file
@@ -0,0 +1,7 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config SET_MAC_ADDRESS_OF_TARGET_AP
|
||||
bool "whether set MAC address of target AP or not"
|
||||
default y
|
||||
|
||||
endmenu
|
@@ -13,13 +13,14 @@
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_wpa2.h"
|
||||
#include "esp_eap_client.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_system.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_netif.h"
|
||||
#include "esp_smartconfig.h"
|
||||
#include "esp_mac.h"
|
||||
|
||||
/* FreeRTOS event group to signal when we are connected & ready to make a request */
|
||||
static EventGroupHandle_t s_wifi_event_group;
|
||||
@@ -59,10 +60,14 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
bzero(&wifi_config, sizeof(wifi_config_t));
|
||||
memcpy(wifi_config.sta.ssid, evt->ssid, sizeof(wifi_config.sta.ssid));
|
||||
memcpy(wifi_config.sta.password, evt->password, sizeof(wifi_config.sta.password));
|
||||
|
||||
#ifdef CONFIG_SET_MAC_ADDRESS_OF_TARGET_AP
|
||||
wifi_config.sta.bssid_set = evt->bssid_set;
|
||||
if (wifi_config.sta.bssid_set == true) {
|
||||
ESP_LOGI(TAG, "Set MAC address of target AP: "MACSTR" ", MAC2STR(evt->bssid));
|
||||
memcpy(wifi_config.sta.bssid, evt->bssid, sizeof(wifi_config.sta.bssid));
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(ssid, evt->ssid, sizeof(evt->ssid));
|
||||
memcpy(password, evt->password, sizeof(evt->password));
|
||||
|
Reference in New Issue
Block a user