From 94536cb51283bfb6e87b790f9b23a61e89867338 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 29 Oct 2024 17:01:11 +0100 Subject: [PATCH] fix(sta2eth): Make some Ethernet options configurable --- .../network/sta2eth/main/Kconfig.projbuild | 22 +++++++++++++++++++ .../network/sta2eth/main/ethernet_iface.c | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/examples/network/sta2eth/main/Kconfig.projbuild b/examples/network/sta2eth/main/Kconfig.projbuild index 44b8c32b09..23e90de006 100644 --- a/examples/network/sta2eth/main/Kconfig.projbuild +++ b/examples/network/sta2eth/main/Kconfig.projbuild @@ -86,4 +86,26 @@ menu "Example Configuration" the reconfiguration mode, i.e. to restart provisioning or manual configuration of Wi-Fi settings (ssid, password) + if EXAMPLE_WIRED_INTERFACE_IS_ETHERNET + + config EXAMPLE_MODIFY_DHCP_MESSAGES + bool "Modify DHCP messages" + default y + help + This is needed if the client uses 61 option and the DHCP server applies strict rules + on assigning addresses. + Set this to 'n' if you don't need DHCP or you're using simplified DHCP workflow + without HW address options in DHCP messages. + + config EXAMPLE_ETHERNET_USE_PROMISCUOUS + bool "Enable promiscuous mode on Ethernet interface" + default n + help + Enable promiscuous mode on the Ethernet interface. + Note: Enabling promiscuous mode results in better throughput as MAC addresses + in frames are not rewritten with the Ethernet interface's actual MAC address. + Note: Enabling promiscuous mode may cause ARP conflicts if the PC + is also connected to the same network with another NIC. + endif + endmenu diff --git a/examples/network/sta2eth/main/ethernet_iface.c b/examples/network/sta2eth/main/ethernet_iface.c index edc451a0c3..e67fd70097 100644 --- a/examples/network/sta2eth/main/ethernet_iface.c +++ b/examples/network/sta2eth/main/ethernet_iface.c @@ -20,13 +20,13 @@ * - this results in better throughput * - might cause ARP conflicts if the PC is also connected to the same AP with another NIC */ -#define ETH_BRIDGE_PROMISCUOUS 0 +#define ETH_BRIDGE_PROMISCUOUS CONFIG_EXAMPLE_ETHERNET_USE_PROMISCUOUS /** * Set this to 1 to runtime update HW addresses in DHCP messages * (this is needed if the client uses 61 option and the DHCP server applies strict rules on assigning addresses) */ -#define MODIFY_DHCP_MSGS 0 +#define MODIFY_DHCP_MSGS CONFIG_EXAMPLE_MODIFY_DHCP_MESSAGES static const char *TAG = "example_wired_ethernet"; static esp_eth_handle_t s_eth_handle = NULL;