feat(lwip): Add support for netif link callback

This commit is contained in:
David Cermak
2025-09-22 17:04:22 +02:00
committed by David Čermák
parent 8939bdad63
commit 16b02aeb7a
4 changed files with 29 additions and 1 deletions

View File

@@ -560,6 +560,12 @@ menu "LWIP"
help
Enable callbacks when the network interface is up/down and addresses are changed.
config LWIP_NETIF_LINK_CALLBACK
bool "Enable link callback for network interfaces"
default n
help
Enable callbacks when the physical network link is up/down.
menuconfig LWIP_NETIF_LOOPBACK
bool "Support per-interface loopback"
default y

View File

@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*
* SPDX-FileContributor: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2015-2025 Espressif Systems (Shanghai) CO LTD
*/
#ifndef LWIP_HDR_ESP_LWIPOPTS_H
#define LWIP_HDR_ESP_LWIPOPTS_H
@@ -725,6 +725,16 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
#define LWIP_NETIF_STATUS_CALLBACK 0
#endif
/**
* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
* whenever the link changes its up/down status.
*/
#ifdef CONFIG_LWIP_NETIF_LINK_CALLBACK
#define LWIP_NETIF_LINK_CALLBACK 1
#else
#define LWIP_NETIF_LINK_CALLBACK 0
#endif
/**
* LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function
* for several netif related event that supports multiple subscribers.