Skip to content

Conversation

@sayacom
Copy link

@sayacom sayacom commented Jul 14, 2025

Summary

This PR migrates the WireGuard interface from the raw lwIP netif API to esp_netif, the officially supported network abstraction in ESP-IDF ≥ 4.4.
It also exposes an esp_netif_t* netif() accessor so that user code can subscribe to events (e.g. IP acquisition) or tweak DHCP/IPv6 settings.

Motivation

  • Newer Arduino-ESP32 cores (3.x, IDF 5.x) recommend esp_netif; direct netif_* calls are considered internal.
  • Using esp_netif makes it easier to:
    • inter-operate with other stacks (PPP/LTE, Ethernet).
    • register event handlers with esp_event,

Key changes

  • Add ESP-NETIF support – create a dedicated esp_netif inside WireGuard::begin() and register it with lwIP
  • Public accessor esp_netif_t *netif() and a new begin() overload that takes Subnet / Gateway

Testing

  • Platform: ESP32 (M5Stack Core 2), ESP32-S3 (M5Stack AtomS3Cam) / Arduino-ESP32 v3.2.0 (IDF 5.4)
  • Verified: handshake + data transfer to a SORACOM Arc endpoint, ICMP ping, HTTPS download through tunnel.

Note on overlapping pull requests

I'm aware that some of the changes in this PR overlap with other pull requests that have already been submitted. If those PRs are merged first, I'm happy to re-base or split this patch so that only the remaining changes are applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant