Skip to content

feat(examples): Add esp_netif examples demonstrating network interface configurations#1013

Open
abhik-roy85 wants to merge 1 commit intoespressif:masterfrom
abhik-roy85:esp_netif_examples
Open

feat(examples): Add esp_netif examples demonstrating network interface configurations#1013
abhik-roy85 wants to merge 1 commit intoespressif:masterfrom
abhik-roy85:esp_netif_examples

Conversation

@abhik-roy85
Copy link
Copy Markdown
Collaborator

@abhik-roy85 abhik-roy85 commented Feb 17, 2026

Description

This commit adds new examples showcasing different esp_netif network interface configurations and use cases.

Added examples:

  • eth_gateway: Ethernet Access Point example that runs a DHCP server on a single Ethernet interface, allowing connected devices to obtain IP addresses automatically
  • eth_gateway_wifi_ap: Dual AP configuration example that simultaneously operates both Ethernet and Wi-Fi interfaces as Access Points with DHCP servers, enabling the ESP to act as a multi-interface router providing both wired (192.168.5.x) and wireless (192.168.4.x) network access simultaneously. Includes configurable DHCP pools, DNS support, NAPT routing, and client management for both interfaces."
  • eth_gateway_wifi_sta: Hybrid configuration example that operates Ethernet as an Access Point with DHCP server while simultaneously running Wi-Fi as a Station connecting to an external access point, enabling network bridging between wired and wireless networks
  • eth_endpoint_wifi_sta: Dual interface example that simultaneously operates both Ethernet STA and Wi-Fi STA interfaces as DHCP clients
  • eth_endpoint_wifi_ap: Hybrid configuration example that operates Ethernet as a Station with DHCP client while simultaneously running Wi-Fi as an Access Point with DHCP server, enabling network bridging between wired upstream connection and local wireless network

Related

Testing


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Note

Low Risk
New code is isolated to examples and a .gitignore tweak, with no changes to production components or security-sensitive logic.

Overview
Adds two new esp_netif example projects under examples/esp_netif: EthAp configures a single Ethernet interface with a static IP and runs an on-device DHCP server (including configurable lease time, address pool, and optional DNS offers), and EthStaWifiSta brings up Ethernet STA and Wi‑Fi STA concurrently as DHCP clients while logging IP/DNS info and waiting for Wi‑Fi to obtain an address.

Also updates .gitignore to ignore clangd cache/index artifacts (.cache/, *.idx).

Written by Cursor Bugbot for commit bc8bb2d. This will update automatically on new commits. Configure here.

@abhik-roy85 abhik-roy85 marked this pull request as draft February 17, 2026 12:51
@abhik-roy85 abhik-roy85 self-assigned this Feb 17, 2026
cursor[bot]

This comment was marked as outdated.

@abhik-roy85 abhik-roy85 changed the title feat(examples): Add esp_netif examples demonstrating network interfac… feat(examples): Add esp_netif examples demonstrating network interface Feb 18, 2026
@abhik-roy85 abhik-roy85 changed the title feat(examples): Add esp_netif examples demonstrating network interface feat(examples): Add esp_netif examples demonstrating network interface configurations Feb 18, 2026
@abhik-roy85 abhik-roy85 force-pushed the esp_netif_examples branch 2 times, most recently from 6186ceb to b9cacf0 Compare February 27, 2026 13:10
@abhik-roy85 abhik-roy85 marked this pull request as ready for review February 27, 2026 13:14
@@ -0,0 +1,7 @@
dependencies:
idf:
version: '>=5.4.3,!=5.5.0,!=5.5.1'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the reason for constraints be clarified?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this is due to Ethernet Init component. However, is it needed to be explicitly redefined for this example? Wouldn't be better to let it on version resolver based on Ethernet init?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified to
idf: "*"

Comment thread examples/esp_netif/EthStaWifiSta/main/EthStaWifiSta.c
Comment thread examples/esp_netif/EthApWifiAp/CMakeLists.txt Outdated
Comment thread examples/esp_netif/EthStaWifiSta/main/EthStaWifiSta.c
Comment thread examples/esp_netif/EthAp/main/EthAp.c Outdated
@alisitsyn alisitsyn self-requested a review March 19, 2026 09:28
Comment thread examples/esp_netif/EthAp/README.md Outdated
@@ -0,0 +1,7 @@
dependencies:
idf:
version: '>=5.4.3,!=5.5.0,!=5.5.1'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this is due to Ethernet Init component. However, is it needed to be explicitly redefined for this example? Wouldn't be better to let it on version resolver based on Ethernet init?

Comment thread examples/esp_netif/EthAp/main/EthAp.c Outdated
Comment thread examples/esp_netif/EthAp/main/EthAp.c
Comment thread examples/esp_netif/EthApWifiAp/README.md Outdated

## Overview

This example initializes **two network interfaces simultaneously**: an **Ethernet interface** operating as a **Station (STA)** with DHCP client, and a **Wi-Fi interface** operating as an **Access Point (AP)** with a DHCP server. The Ethernet Station connects to an external network via DHCP, while the Wi-Fi AP provides network access to connected devices via DHCP (e.g. in the `192.168.5.x` range). This hybrid configuration enables the ESP to bridge between a wired upstream connection and a local wireless network.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the only difference to EthAPWifiAP the fact that Ethernet is set as DHCP Client? If so, I would merge the examples where it makes sense together and rename them to something more common and make DHCP Server/Client as configurable option in the menuconfig. Otherwise, it will be nightmare to maintain.

Comment thread examples/esp_netif/EthStaWifiSta/main/EthStaWifiSta.c
Comment thread examples/esp_netif/EthAp/README.md Outdated
Comment thread examples/esp_netif/EthAp/main/EthAp.c Outdated
@@ -0,0 +1,15 @@
# This file was generated using idf.py save-defconfig. It can be edited manually.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file necessary? Seems to me that all items are defaults from Kconfig.project

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the skdconfig.defaults as a configuration file for easier parameter modification.

Comment thread examples/esp_netif/EthApWifiAp/main/EthApWifiAp.c Outdated
Comment thread examples/esp_netif/EthApWifiAp/main/EthApWifiAp.c
Comment thread examples/esp_netif/EthStaWifiAp/main/EthStaWifiAp.c
Comment thread examples/esp_netif/EthStaWifiAp/README.md Outdated
Comment thread examples/esp_netif/EthStaWifiSta/main/EthStaWifiSta.c Outdated
Comment thread examples/esp_netif/EthStaWifiSta/README.md Outdated
Comment thread examples/esp_netif/WifiApWifiSta/README.md Outdated
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 31, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@abhik-roy85 abhik-roy85 force-pushed the esp_netif_examples branch 3 times, most recently from 9febe1e to 9c4dde0 Compare April 1, 2026 11:26
…e configurations

This commit adds new examples showcasing different esp_netif network
interface configurations and use cases.

Added examples:
- eth_gateway: Ethernet Access Point example that runs a DHCP server on a
  single Ethernet interface, allowing connected devices to obtain IP
  addresses automatically
- eth_endpoint_wifi_sta: Dual interface example that simultaneously operates
  both Ethernet STA and Wi-Fi STA interfaces as DHCP clients
- eth_gateway_wifi_sta: Hybrid configuration example that operates Ethernet as
  an Access Point with DHCP server while simultaneously running Wi-Fi
  as a Station connecting to an external access point, enabling network
  bridging between wired and wireless networks
- eth_endpoint_wifi_ap: Hybrid configuration example that operates Ethernet as
  a Station with DHCP client while simultaneously running Wi-Fi as an
  Access Point with DHCP server, enabling network bridging between
  wired upstream connection and local wireless network
- eth_gateway_wifi_ap: Dual AP configuration example that simultaneously operates
  both Ethernet and Wi-Fi interfaces as Access Points with DHCP servers,
  enabling the ESP to act as a multi-interface router providing both
  wired (192.168.5.x) and wireless (192.168.4.x) network access
  simultaneously. Includes configurable DHCP pools, DNS support, NAPT
  routing, and client management for both interfaces."
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.

4 participants