[wifi] Guard lwIP-internal socket registration to LibreTiny only

DHCP/DNS raw UDP PCBs only need tracking on LibreTiny where we directly
set MEMP_NUM_UDP_PCB. On ESP32, CONFIG_LWIP_MAX_SOCKETS controls the
POSIX socket layer — DHCP/DNS use raw udp_new() bypassing it entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
J. Nick Koston
2026-02-21 14:11:19 -06:00
parent 38984b61c9
commit f55387b323

View File

@@ -271,7 +271,15 @@ def final_validate(config):
def _consume_wifi_sockets(config: ConfigType) -> ConfigType:
"""Register UDP PCBs used internally by lwIP for DHCP and DNS."""
"""Register UDP PCBs used internally by lwIP for DHCP and DNS.
Only needed on LibreTiny where we directly set MEMP_NUM_UDP_PCB (the raw
PCB pool shared by both application sockets and lwIP internals like DHCP/DNS).
On ESP32, CONFIG_LWIP_MAX_SOCKETS only controls the POSIX socket layer —
DHCP/DNS use raw udp_new() which bypasses it entirely.
"""
if not (CORE.is_bk72xx or CORE.is_rtl87xx or CORE.is_ln882x):
return config
from esphome.components import socket
# lwIP allocates UDP PCBs for DHCP client and DNS resolver internally.