feat(lws): bump submodule for mbedTLS 4 support; allow IDF v6.0#1070
feat(lws): bump submodule for mbedTLS 4 support; allow IDF v6.0#1070vikramdattu wants to merge 10 commits into
Conversation
|
Hi @david-cermak — heads up on the clang-tidy failure: it's not the At the SHA we pin ( I've filed the upstream fix: warmcat/libwebsockets#3597. Two paths:
Which do you prefer? |
231032f to
98a9ac5
Compare
Both options are fine with me. If the upstream fix gets merged within days, I would wait. |
| @@ -1,5 +1,5 @@ | |||
| version: "4.3.3~1" | |||
| version: "4.3.3~2" | |||
There was a problem hiding this comment.
@david-cermak the version and the changelog above will pick the commit title automatically?
There was a problem hiding this comment.
@vikramdattu see https://github.com/espressif/esp-protocols/blob/master/CONTRIBUTING.md#release-process
the commit (when created by the bump command) will update the version files and changelog (based on commit delta from the previous tag)
There was a problem hiding this comment.
when created by the bump command
but that doesn't support these ~postfix numbers (yet), so you'd need to edit the commit.
Here's an example #1071
PS: If you like, we can merge #1071 to release v4.3.3~2 for now, and after the upstream maintainers fix the above, we can merge this one to release v4.3.3~3
|
Rebase needed once warmcat/libwebsockets#3600 and warmcat/libwebsockets#3601 and warmcat/libwebsockets#3602 are merged |
c144d26 to
617e107
Compare
| _mbedtls_major REGEX "^#define MBEDTLS_VERSION_MAJOR[ \t]+[0-9]+") | ||
| if(_mbedtls_major MATCHES "[ \t]+([0-9]+)" AND CMAKE_MATCH_1 GREATER_EQUAL 4) | ||
| set(LWS_HAVE_MBEDTLS_V4 1 CACHE INTERNAL "mbedtls 4 detected on IDF") | ||
| endif() |
There was a problem hiding this comment.
MBTLS v4 CMake cache stale
Medium Severity
LWS_HAVE_MBEDTLS_V4 is written with CACHE INTERNAL only when mbedTLS major is at least 4, and never reset when it is not. Reconfiguring the same build directory after switching from IDF v6 to v5.x can leave the flag at 1, so libwebsockets still takes the mbedTLS 4 path against mbedTLS 3 headers.
Reviewed by Cursor Bugbot for commit 49985d5. Configure here.
Pin the libwebsockets submodule at warmcat main (mbedTLS 4 + the FreeRTOS/ESP-IDF v6 build fixes), allow IDF v6.0, and force lws's mbedTLS 4 code path on IDF: lws's own V4 probe doesn't run on FreeRTOS, so detect the version from the IDF mbedtls component and inject the tf-psa-crypto include dirs.
…upstream) The mbedTLS 4 / ESP-IDF v6 build support (warmcat/libwebsockets#3603) is now on libwebsockets main, so point the submodule at upstream main instead of the PR branch. Verified: examples/client builds clean on ESP-IDF v6.0 (esp32, stock mbedtls).
Make the component + client example build under ESP-IDF v6 (mbedTLS 4): - keep upstream lws warnings non-fatal under IDF's global -Werror (-Wno-error) so harmless format/redefinition warnings in lws sources don't fail the build - expose tf-psa-crypto/include + the split-out v6 component includes lws needs - point lwip errno at <sys/errno.h> and prefer esp_libc TLS errno (picolibc) - set LWS_HAVE_MBEDTLS_V4 when IDF mbedtls is v4 so lws takes the v4 code paths - example: add espressif/cjson (left IDF built-ins in v6) + large single-app partition All additions are EXISTS-guarded / version-gated, so IDF v5.x is unaffected.
idf_component_get_property() hard-errors when the component isn't in the build, so the esp_hal_mspi / esp_blockdev / esp_libc include workarounds broke CMake configure on IDF v5.x (those components are v6-only). Check BUILD_COMPONENTS membership before each lookup; v6 still picks them up by bare name (verified), v5.x cleanly skips them.
The previous pin (b4f9c5cb 'h2-h3-happy-eyeballs') introduced an
unrelated format-specifier warning in lib/core-net/client/connect3.c
('%u' vs uint32_t) that is fatal under -Werror on the v5.3/v5.4
toolchains (where uint32_t is 'long unsigned int'). Its parent
906de57a0 still carries the mbedTLS 4 / IDF v6 support (e6f4d0ec) and
the wrapper-removal refactor, without the QUIC regression. Upstream fix
to be filed separately.
warmcat/libwebsockets#3618 (cast uint32_t grace_us for the %u format specifier in connect3.c) is now on main, so move the pin forward from the temporary parent-commit pin to current main (00130694a). Verified: examples/client builds clean on ESP-IDF v6.0 (esp32).
Recent libwebsockets uses if_nametoindex() in lws_get_addr_scope(). ESP-IDF <= v5.3 builds lwip with LWIP_NETIF_API==0, so if_api.c isn't compiled and the symbol - declared in newlib's <net/if.h> - is never defined, breaking the link. Provide a fallback in the port shim that mirrors lwip's own implementation (the ungated core netif_name_to_index helper), gated on !LWIP_NETIF_API so v5.4+ (where lwip supplies it) is untouched. Verified no regression on v6.0.
…F v6 IDF v6's mbedtls port esp_config.h redefines MBEDTLS_PSA_BUILTIN_ALG_HMAC (and siblings) that tf-psa-crypto already defines. The build compiles and links fine (our -Wno-error keeps it non-fatal), but idf-build-apps' check_warnings flags the 'warning: redefined' line and fails the job. It's a harmless IDF-side redefinition; add it to the CI ignore list.
…6/mbedTLS-4 lws-freertos.h pulls <driver/gpio.h> (esp_driver_gpio) into every consumer, and the mbedTLS-4 PSA header chain needs esp_security/esp_hal_security include dirs that mbedtls links PRIVATE. Add them so the add_subdirectory websockets target and consumers resolve on IDF v6.
c08f08a to
e816078
Compare
|
@david-cermak heads-up for when you set the component version on this PR — it'll be a minor bump + a The lws submodule is pinned to a warmcat (We pinned an older/settled main commit deliberately — warmcat force-pushes |
Replaces the moving-main churn pins with a single settled warmcat main commit (v4.5.0-590-gda5d6f5f9, 2026-07-13) that carries the mbedTLS-4/IDF-v6 support the v4.5.x release tags lack. Older, so likelier to survive warmcat's main force-pushes. (Version bump is the maintainer's call — see PR discussion.)
e816078 to
9bbf1ab
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9bbf1ab. Configure here.
| warning: unknown kconfig symbol 'EXAMPLE_ETH_PHY_IP101' | ||
| WARNING: The following Kconfig variables were used in "if" clauses, but not | ||
| warning: unknown kconfig symbol 'LIBC_NEWLIB' | ||
| warning: 'MBEDTLS_PSA_BUILTIN_[A-Z0-9_]+' redefined |
There was a problem hiding this comment.
CI ignore pattern quote mismatch
Medium Severity
The new ignore entry wraps the macro name in single quotes, but GCC emits this redefinition diagnostic with double quotes ("MBEDTLS_PSA_BUILTIN_..."). idf-build-apps regex-matches warning lines, so the pattern will not suppress the IDF v6 PSA redefinition warnings that -Wno-error still leaves in the build log, and the new release-v6.0 CI matrix entry can fail check_warnings.
Reviewed by Cursor Bugbot for commit 9bbf1ab. Configure here.


Summary
1` → `4.3.32`.Verification
Notes
Note
Medium Risk
Substantial CMake and TLS/errno linkage workarounds for IDF v6; mistakes could affect v5.x builds despite guards, or TLS/HTTP behavior on v6 targets.
Overview
Enables libwebsockets on ESP-IDF v6.0 by lifting the
idf <6.0dependency cap and adding release-v6.0 to the libwebsockets CI build and on-target matrices.The ESP-IDF port gains mbedTLS 4–aware CMake: it forces
LWS_HAVE_MBEDTLS_V4when IDF’s mbedTLS major is ≥4, adds tf-psa-crypto and v6-only include paths (flash/PSA/security/gpio), fixes picolibc TLSerrnoviaLWIP_ERRNO_INCLUDEandesp_libcprepend, and relaxes-Werrorfor known v6 header noise.esp_driver_gpiois a publicREQUIRESsolws-freertos.hconsumers getdriver/gpio.h.port/lws_port.csuppliesif_nametoindexwhenLWIP_NETIF_API==0(IDF ≤5.3) for newer lws link requirements. The client example pulls espressif/cjson for v6, defaults to a large app partition, and CI ignores MBEDTLS_PSA_BUILTIN redefinition warnings.Reviewed by Cursor Bugbot for commit 9bbf1ab. Bugbot is set up for automated code reviews on this repo. Configure here.