espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.61k stars 7.27k forks source link

esp_supplicant: build failure when CONFIG_SAE is disabled (IDFGH-12549) #13553

Closed xobs closed 6 months ago

xobs commented 6 months ago

Answers checklist.

IDF version.

v5.3-dev-3220-g9c99a385ad

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

Project should build

What is the actual behavior?

C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c: In function 'hostap_sta_join':
C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c:359:26: warning: unused variable 'old_sta' [-Wunused-variable]
  359 |         struct sta_info *old_sta = *sta;
      |                          ^~~~~~~
C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c:395:1: error: label 'process_old_sta' defined but not used [-Werror=unused-label]
  395 | process_old_sta:
      | ^~~~~~~~~~~~~~~

Steps to reproduce.

  1. Attempt to build without SAE

Build or installation Logs.

[112/113] Generating binary image from built executable
esptool.py v4.8.dev3
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
Generated E:/Code/Farpatch/farpatch/build/bootloader/bootloader.bin
[113/113] cmd.exe /C "cd /D E:\Code\Farpatch\farpatch\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf5.3_...nts/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 E:/Code/Farpatch/farpatch/build/bootloader/bootloader.bin
Bootloader binary size 0x5780 bytes. 0x2880 bytes (32%) free.
[695/1122] Building C object esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/esp_supplicant/src/esp_wpa_main.c.obj
FAILED: esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/esp_supplicant/src/esp_wpa_main.c.obj
ccache C:\Espressif\tools\xtensa-esp-elf\esp-13.2.0_20240305\xtensa-esp-elf\bin\xtensa-esp32s3-elf-gcc.exe -DCONFIG_CRYPTO_MBEDTLS -DCONFIG_ECC -DCONFIG_FAST_PBKDF2 -DCONFIG_IEEE80211W -DCONFIG_NO_RADIUS -DCONFIG_OWE_STA -DCONFIG_SHA256 -DCONFIG_TLSV11 -DCONFIG_TLSV12 -DCONFIG_TLS_INTERNAL_CLIENT -DCONFIG_WPS -DEAP_FAST -DEAP_MSCHAPv2 -DEAP_PEAP -DEAP_PEER_METHOD -DEAP_TLS -DEAP_TTLS -DESPRESSIF_USE -DESP_PLATFORM -DESP_SUPPLICANT -DIDF_VER=\"v5.3-dev-3220-g9c99a385ad\" -DIEEE8021X_EAPOL -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -DUSE_WPA2_TASK -DUSE_WPS_TASK -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -D__ets__ -IE:/Code/Farpatch/farpatch/build/config -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/include -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/port/include -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/include -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/src -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/src/utils -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src -IC:/Users/Sean/esp/esp-idf/components/wpa_supplicant/src/crypto -IC:/Users/Sean/esp/esp-idf/components/esp_wifi/wifi_apps/roaming_app/include -IC:/Users/Sean/esp/esp-idf/components/newlib/platform_include -IC:/Users/Sean/esp/esp-idf/components/freertos/config/include -IC:/Users/Sean/esp/esp-idf/components/freertos/config/include/freertos -IC:/Users/Sean/esp/esp-idf/components/freertos/config/xtensa/include -IC:/Users/Sean/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Users/Sean/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Users/Sean/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -IC:/Users/Sean/esp/esp-idf/components/freertos/esp_additions/include -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/include -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/include/soc -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/include/soc/esp32s3 -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/dma/include -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/ldo/include -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/port/esp32s3/. -IC:/Users/Sean/esp/esp-idf/components/esp_hw_support/port/esp32s3/include -IC:/Users/Sean/esp/esp-idf/components/heap/include -IC:/Users/Sean/esp/esp-idf/components/log/include -IC:/Users/Sean/esp/esp-idf/components/soc/include -IC:/Users/Sean/esp/esp-idf/components/soc/esp32s3 -IC:/Users/Sean/esp/esp-idf/components/soc/esp32s3/include -IC:/Users/Sean/esp/esp-idf/components/hal/platform_port/include -IC:/Users/Sean/esp/esp-idf/components/hal/esp32s3/include -IC:/Users/Sean/esp/esp-idf/components/hal/include -IC:/Users/Sean/esp/esp-idf/components/esp_rom/include -IC:/Users/Sean/esp/esp-idf/components/esp_rom/include/esp32s3 -IC:/Users/Sean/esp/esp-idf/components/esp_rom/esp32s3 -IC:/Users/Sean/esp/esp-idf/components/esp_common/include -IC:/Users/Sean/esp/esp-idf/components/esp_system/include -IC:/Users/Sean/esp/esp-idf/components/esp_system/port/soc -IC:/Users/Sean/esp/esp-idf/components/esp_system/port/include/private -IC:/Users/Sean/esp/esp-idf/components/xtensa/esp32s3/include -IC:/Users/Sean/esp/esp-idf/components/xtensa/include -IC:/Users/Sean/esp/esp-idf/components/xtensa/deprecated_include -IC:/Users/Sean/esp/esp-idf/components/esp_timer/include -IC:/Users/Sean/esp/esp-idf/components/lwip/include -IC:/Users/Sean/esp/esp-idf/components/lwip/include/apps -IC:/Users/Sean/esp/esp-idf/components/lwip/include/apps/sntp -IC:/Users/Sean/esp/esp-idf/components/lwip/lwip/src/include -IC:/Users/Sean/esp/esp-idf/components/lwip/port/include -IC:/Users/Sean/esp/esp-idf/components/lwip/port/freertos/include -IC:/Users/Sean/esp/esp-idf/components/lwip/port/esp32xx/include -IC:/Users/Sean/esp/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Users/Sean/esp/esp-idf/components/lwip/port/esp32xx/include/sys -IC:/Users/Sean/esp/esp-idf/components/mbedtls/port/include -IC:/Users/Sean/esp/esp-idf/components/mbedtls/mbedtls/include -IC:/Users/Sean/esp/esp-idf/components/mbedtls/mbedtls/library -IC:/Users/Sean/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -IC:/Users/Sean/esp/esp-idf/components/mbedtls/mbedtls/3rdparty/everest/include -IC:/Users/Sean/esp/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m -IC:/Users/Sean/esp/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m -IC:/Users/Sean/esp/esp-idf/components/esp_wifi/include -IC:/Users/Sean/esp/esp-idf/components/esp_wifi/wifi_apps/include -IC:/Users/Sean/esp/esp-idf/components/esp_wifi/wifi_apps/nan_app/include -IC:/Users/Sean/esp/esp-idf/components/esp_wifi/include/local -IC:/Users/Sean/esp/esp-idf/components/esp_event/include -IC:/Users/Sean/esp/esp-idf/components/esp_phy/include -IC:/Users/Sean/esp/esp-idf/components/esp_phy/esp32s3/include -IC:/Users/Sean/esp/esp-idf/components/esp_netif/include -mlongcalls  -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -O2 -fstack-protector-strong -fmacro-prefix-map=E:/Code/Farpatch/farpatch=. -fmacro-prefix-map=C:/Users/Sean/esp/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -Wno-strict-aliasing -Wno-write-strings -Werror -Wno-format -MD -MT esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/esp_supplicant/src/esp_wpa_main.c.obj -MF esp-idf\wpa_supplicant\CMakeFiles\__idf_wpa_supplicant.dir\esp_supplicant\src\esp_wpa_main.c.obj.d -o esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/esp_supplicant/src/esp_wpa_main.c.obj -c C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c: In function 'hostap_sta_join':
C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c:359:26: warning: unused variable 'old_sta' [-Wunused-variable]
  359 |         struct sta_info *old_sta = *sta;
      |                          ^~~~~~~
C:/Users/Sean/esp/esp-idf/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c:395:1: error: label 'process_old_sta' defined but not used [-Werror=unused-label]
  395 | process_old_sta:
      | ^~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
[719/1122] Building C object esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/src/tls/x509v3.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the E:\Code\Farpatch\farpatch\build\log\idf_py_stderr_output_25064 and E:\Code\Farpatch\farpatch\build\log\idf_py_stdout_output_25064

### More Information.

This patch fixes the issue:

```patch
diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
index 483bd7cc84..7dcb792df6 100644
--- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
+++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
@@ -356,8 +356,8 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
     }

     if (*sta) {
-        struct sta_info *old_sta = *sta;
 #ifdef CONFIG_SAE
+        struct sta_info *old_sta = *sta;
         if (old_sta->lock && os_semphr_take(old_sta->lock, 0) != TRUE) {
             wpa_printf(MSG_INFO, "Ignore assoc request as softap is busy with sae calculation for station "MACSTR, MAC2STR(bssid));
             if (esp_send_assoc_resp(hapd, bssid, WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY, rsnxe ? false : true, subtype) != WLAN_STATUS_SUCCESS) {
@@ -392,7 +392,9 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
     }
 #endif /* CONFIG_SAE */

+#ifdef CONFIG_SAE
 process_old_sta:
+#endif /* CONFIG_SAE */

 #ifdef CONFIG_WPS_REGISTRAR
     if (check_n_add_wps_sta(hapd, sta_info, wpa_ie, wpa_ie_len, pmf_enable, subtype) == 0) {
xobs commented 6 months ago

It looks like the bug report got mangled, but this patch fixes the issue for me:

diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
index 483bd7cc84..7dcb792df6 100644
--- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
+++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
@@ -356,8 +356,8 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
     }

     if (*sta) {
-        struct sta_info *old_sta = *sta;
 #ifdef CONFIG_SAE
+        struct sta_info *old_sta = *sta;
         if (old_sta->lock && os_semphr_take(old_sta->lock, 0) != TRUE) {
             wpa_printf(MSG_INFO, "Ignore assoc request as softap is busy with sae calculation for station "MACSTR, MAC2STR(bssid));
             if (esp_send_assoc_resp(hapd, bssid, WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY, rsnxe ? false : true, subtype) != WLAN_STATUS_SUCCESS) {
@@ -392,7 +392,9 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
     }
 #endif /* CONFIG_SAE */

+#ifdef CONFIG_SAE
 process_old_sta:
+#endif /* CONFIG_SAE */

 #ifdef CONFIG_WPS_REGISTRAR
     if (check_n_add_wps_sta(hapd, sta_info, wpa_ie, wpa_ie_len, pmf_enable, subtype) == 0) {