Skip to content
Skills Library
Programming · Analysis

esp32-lwip-network-diagnostics

/esp32-lwip-network-diagnostics

Use when an ESP32 connects to Wi-Fi or Ethernet but DNS, DHCP, TCP sockets or long-running network sessions fail; especially when reconnects leak resources or packet loss appears only under load.

Licence
MIT
Last repository change
11.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
3
Deprecation

No signals detected. Repository changed on 11.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when an ESP32 connects to Wi-Fi or Ethernet but DNS, DHCP, TCP sockets or long-running network sessions fail; especially when reconnects leak resources or packet loss appears only under load.

Original author description

Use when an ESP32 connects to Wi-Fi or Ethernet but DNS, DHCP, TCP sockets or long-running network sessions fail; especially when reconnects leak resources or packet loss appears only under load.

How it works

  1. Capture the environment
  2. DHCP and address lifecycle
  3. DNS diagnosis
  4. Socket lifecycle and resource bounds
  5. Observability
  6. Verification
  7. Acceptance criteria
  8. References
Original SKILL.md headings · 71 lines, 580 words
SKILL.md preview
---
name: esp32-lwip-network-diagnostics
description: Use when an ESP32 connects to Wi-Fi or Ethernet but DNS, DHCP, TCP sockets or long-running network sessions fail; especially when reconnects leak resources or packet loss appears only under load.
license: MIT
---

# lwIP and network lifecycle diagnostics

A connected Wi-Fi station is not proof that the IP layer or application socket is healthy.
Diagnose link, address configuration, DNS, route, TCP and application protocol as separate layers.

## Capture the environment

- Record SoC, ESP-IDF or Arduino core version, lwIP configuration and Wi-Fi/Ethernet driver.
- Record AP/router model, DHCP lease behavior, DNS server, VLAN and IPv4/IPv6 assumptions.
- Capture timestamps for link-up, DHCP completion, DNS lookup, connect, TLS handshake and first payload.
- Distinguish a Wi-Fi association event from an IP-ready event.
- Avoid assuming that a private LAN uses one fixed gateway or DNS address.

## DHCP and address lifecycle

- Treat DHCP lease acquisition, renewal and address loss as explicit state transitions.
- Clear stale application connections when the local address changes.
- Do not start cloud clients before the network stack reports a usable IP configuration.
- For static addresses, validate subnet, gateway and DNS independently; an IP address alone does not provide a route.
- Log the assigned address, netmask, gateway and DNS servers without exposing credentials.
- Test router restart, lease renewal, AP roam and Ethernet cable removal.

## DNS diagnosis

- Separate hostname resolution failures from TCP connect timeouts.
- Record the queried hostname, resolver result and elapsed time; do not log secrets embedded in URLs.
- Test multiple DNS servers only as a controlled diagnostic, not as an unexplained hardcoded fallback.
- Respect DNS TTL and avoid caching an address forever.
- Validate IPv4/IPv6 assumptions and the address family returned by the resolver.
- A successful ping to an IP does not prove DNS works.

## Socket lifecycle and resource bounds

- Give every socket a single clear owner and close it on every success and error path.
- Bound connect, send and receive timeouts; a blocking socket must not monopolize a control task.
- Handle partial sends and receives; TCP is a byte stream, not a message protocol.
- Define reconnect backoff with jitter to avoid synchronized reconnect storms.
- Limit concurrent sockets and queued payload bytes; report backpressure instead of allocating indefinitely.
- Distinguish application heap loss from TCP states such as TIME_WAIT and from driver-owned buffers.

## Observability

- Track counts for DNS failures, connect failures, resets, timeouts, bytes and active sockets.
- Log state transitions, not every packet; high-volume logs can change timing and hide the fault.
- Capture lwIP statistics only when the relevant build configuration enables them.
- Use packet capture at the AP/router or Ethernet switch to separate device behavior from network behavior.
- Redact tokens, passwords, session cookies and private payloads before sharing traces.

## Verification

1. Test DNS success, NXDOMAIN, timeout and resolver loss.
2. Restart the AP/router while requests are active.
3. Drop the Ethernet link or force Wi-Fi roam during a TCP transfer.
4. Send payloads larger than one TCP segment and verify framing handles partial reads.
5. Run a long-duration reconnect soak and track heap, largest free block and socket count.
6. Verify backoff remains bounded and the control loop continues to meet its deadline.

## Acceptance criteria

- Host tests cover TCP stream reassembly, retry backoff and connection-state transitions.
- Hardware tests name the AP/router, DHCP/DNS setup, framework version and test duration.
- Resource graphs distinguish free heap, largest block and socket lifecycle.
- No issue is called a memory leak until socket and TCP-state evidence is checked.

## References

- ESP-IDF lwIP: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/lwip.html
- ESP-IDF Wi-Fi: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/wifi.html
- lwIP documentation: https://www.nongnu.org/lwip/2_1_x/
Files in this package (2)
  • LICENSE.txt 1 KB
  • SKILL.md 4 KB

Versions

The database has no other skills named esp32-lwip-network-diagnostics.

Database snapshot: 13.11.2026 · package version 4e2a6d140677 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100lwip-integration
    Use when integrating, porting, configuring, or debugging lwIP TCP/IP stack, netif drivers, memory pools, sys_arch, DHCP, TCP, UDP, or embedded networking issues
  • 90esp32-w5500-ethernet
    Use when using W5500 SPI Ethernet with ESP32, diagnosing DHCP, socket failures, link loss, SPI timing or Ethernet/Wi-Fi coexistence.
  • 100freertos-plus-tcp-integration
    Use when integrating, porting, configuring, or debugging FreeRTOS+TCP networking, network interface drivers, buffer management, DHCP, sockets, or embedded TCP/IP issues
  • 90esp32-enc28j60-ethernet
    Use when an ESP32 uses an ENC28J60 for wired Ethernet - no link, DHCP that never completes, a connection that dies under load, or 2 Mbit/s where 100 was expected. Covers its 8 KB buffer, missing auto-negotiation and SPI limits.
  • 100homelab-network-setup
    Practical home and homelab network planning for gateways, switches, access points, IP ranges, DHCP reservations, DNS, cabling, and common beginner mistakes. Use when planning or fixing a home or homelab network — gateway, switch, AP, IP ranges, DHCP, DNS, or cabling.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.