From bd19f9c5aac20a633215760d1dea2ce4e4cd957c Mon Sep 17 00:00:00 2001 From: muhaidong Date: Tue, 17 Oct 2023 17:55:54 +0800 Subject: [PATCH 1/4] fix(wifi): update scan example for scan get ap records --- examples/wifi/scan/main/scan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/wifi/scan/main/scan.c b/examples/wifi/scan/main/scan.c index 34b88a24ff..ea3a5a892d 100644 --- a/examples/wifi/scan/main/scan.c +++ b/examples/wifi/scan/main/scan.c @@ -125,10 +125,11 @@ static void wifi_scan(void) ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_start()); esp_wifi_scan_start(NULL, true); + ESP_LOGI(TAG, "Max AP number ap_info can hold = %u", number); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count)); - ESP_LOGI(TAG, "Total APs scanned = %u", ap_count); - for (int i = 0; (i < DEFAULT_SCAN_LIST_SIZE) && (i < ap_count); i++) { + ESP_LOGI(TAG, "Total APs scanned = %u, actual AP number ap_info holds = %u", ap_count, number); + for (int i = 0; i < number; i++) { ESP_LOGI(TAG, "SSID \t\t%s", ap_info[i].ssid); ESP_LOGI(TAG, "RSSI \t\t%d", ap_info[i].rssi); print_auth_mode(ap_info[i].authmode); From 59ff3f12fcf18648404fc17479ef8d36bd88f90c Mon Sep 17 00:00:00 2001 From: muhaidong Date: Mon, 25 Sep 2023 15:12:44 +0800 Subject: [PATCH 2/4] fix(wifi): fix some wifi issues 1. fix enable psram wapi dhcp fail issue 3. fix wrong wifi mode connect crash issue --- components/esp_rom/esp32c3/ld/esp32c3.rom.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld index b1daaff049..eb8b8ce8ce 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld @@ -1803,7 +1803,7 @@ ieee80211_ampdu_start_age_timer = 0x40001858; ieee80211_encap_esfbuf = 0x4000185c; ieee80211_is_tx_allowed = 0x40001860; ieee80211_output_pending_eb = 0x40001864; -ieee80211_output_process = 0x40001868; +/*ieee80211_output_process = 0x40001868;*/ ieee80211_set_tx_desc = 0x4000186c; rom_sta_input = 0x40001870; wifi_get_macaddr = 0x40001874; From 5eb31b6bd18d2139ca4aecfffb731334246df7d1 Mon Sep 17 00:00:00 2001 From: muhaidong Date: Thu, 16 Nov 2023 20:20:08 +0800 Subject: [PATCH 3/4] fix(wifi): allow some special igtk keyindx to workaround faulty APs --- components/wpa_supplicant/src/rsn_supp/wpa.c | 54 ++++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index bb3a3df1cc..15a5fc57d1 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -997,37 +997,37 @@ int wpa_supplicant_pairwise_gtk(struct wpa_sm *sm, static int wpa_supplicant_install_igtk(struct wpa_sm *sm, const wifi_wpa_igtk_t *igtk) { - size_t len = wpa_cipher_key_len(sm->mgmt_group_cipher); - u16 keyidx = WPA_GET_LE16(igtk->keyid); + size_t len = wpa_cipher_key_len(sm->mgmt_group_cipher); + u16 keyidx = WPA_GET_LE16(igtk->keyid); - /* Detect possible key reinstallation */ - if (sm->igtk.igtk_len == len && - os_memcmp(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len) == 0) { - wpa_printf(MSG_DEBUG, - "WPA: Not reinstalling already in-use IGTK to the driver (keyidx=%d)", - keyidx); - return 0; - } + /* Detect possible key reinstallation */ + if (sm->igtk.igtk_len == len && + os_memcmp(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len) == 0) { + wpa_printf(MSG_DEBUG, + "WPA: Not reinstalling already in-use IGTK to the driver (keyidx=%d)", + keyidx); + return 0; + } - wpa_printf(MSG_DEBUG, - "WPA: IGTK keyid %d pn %02x%02x%02x%02x%02x%02x", - keyidx, MAC2STR(igtk->pn)); - wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK", igtk->igtk, len); - if (keyidx > 4095) { - wpa_printf(MSG_WARNING, - "WPA: Invalid IGTK KeyID %d", keyidx); - return -1; - } - if (esp_wifi_set_igtk_internal(WIFI_IF_STA, igtk) < 0) { - wpa_printf(MSG_WARNING, - "WPA: Failed to configure IGTK to the driver"); - return -1; - } + wpa_printf(MSG_DEBUG, + "WPA: IGTK keyid %d pn %02x%02x%02x%02x%02x%02x", + keyidx, MAC2STR(igtk->pn)); + wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK", igtk->igtk, len); - sm->igtk.igtk_len = len; - os_memcpy(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len); + if (esp_wifi_set_igtk_internal(WIFI_IF_STA, igtk) < 0) { + if (keyidx > 4095) { + wpa_printf(MSG_WARNING, + "WPA: Invalid IGTK KeyID %d", keyidx); + } + wpa_printf(MSG_WARNING, + "WPA: Failed to configure IGTK to the driver"); + return -1; + } - return 0; + sm->igtk.igtk_len = len; + os_memcpy(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len); + + return 0; } #endif /* CONFIG_IEEE80211W */ From fb38539ea98c7cfa755a00b5c3175cf4abd0fe69 Mon Sep 17 00:00:00 2001 From: muhaidong Date: Fri, 24 Nov 2023 10:17:51 +0800 Subject: [PATCH 4/4] fix(wifi): fix some wifi bugs 1. fix ccmp pn became large issue 2. sta not pmf capable when requires should reject profile 3. fix softap set config issue 4. allow some special igtk keyindex to workaround faulty APs 5. remove target_power_backoff 6. remove FreqCalCntforScan 7. fix enable psram wapi dhcp fail issue --- components/esp_wifi/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 04e943cf33..d0159b0764 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 04e943cf332d14fa4c503d9756ee3660c0f9421b +Subproject commit d0159b07641b8fbc929c9ce9f88313756a9369f2