feat(lwip): Hardcode NETIF_API=1 to support POSIX netif API

This commit is contained in:
David Cermak 2024-12-20 08:16:25 +01:00 committed by David Čermák
parent 7bb6c67efe
commit 86089be928
4 changed files with 24 additions and 22 deletions

View File

@ -100,11 +100,8 @@ if(CONFIG_LWIP_ENABLE)
"port/hooks/lwip_default_hooks.c"
"port/debug/lwip_debug.c"
"port/sockets_ext.c"
"port/freertos/sys_arch.c")
if(CONFIG_LWIP_NETIF_API)
list(APPEND srcs "port/if_index.c")
endif()
"port/freertos/sys_arch.c"
"port/if_index.c")
if(CONFIG_LWIP_PPP_SUPPORT)
list(APPEND srcs

View File

@ -18,14 +18,6 @@ menu "LWIP"
The default name this device will report to other devices on the network.
Could be updated at runtime with esp_netif_set_hostname()
config LWIP_NETIF_API
bool "Enable usage of standard POSIX APIs in LWIP"
default n
help
If this feature is enabled, standard POSIX APIs: if_indextoname(), if_nametoindex()
could be used to convert network interface index to name
instead of IDF specific esp-netif APIs (such as esp_netif_get_netif_impl_name())
config LWIP_TCPIP_TASK_PRIO
int "LWIP TCP/IP Task Priority"
default 18

View File

@ -709,18 +709,11 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
* LWIP_DHCP_DISCOVER_ADD_HOSTNAME==1: include hostname opt in discover packets.
* If the hostname is not set in the DISCOVER packet, then some servers might issue
* an OFFER with hostname configured and consequently reject the REQUEST with any other hostname.
* LWIP_NETIF_API==1: Support netif APIs (if_nametoindex and if_indextoname)
*/
#define LWIP_NETIF_HOSTNAME 1
#define LWIP_DHCP_DISCOVER_ADD_HOSTNAME 1
/**
* LWIP_NETIF_API==1: Support netif api (in netifapi.c)
*/
#ifdef CONFIG_LWIP_NETIF_API
#define LWIP_NETIF_API 1
#else
#define LWIP_NETIF_API 0
#endif
/**
* LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface

View File

@ -1,6 +1,26 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
// Need to provide declarations of if_nametoindex and if_indextoname functions
// as we don't want to bring lwip specific defines
// (since we're on linux target and likely using linux tcp/ip stack)
/**
* @brief Get the interface index for the given interface name.
* @param ifname The interface name.
* @return The interface index.
*/
unsigned int if_nametoindex(const char *ifname);
/**
* @brief Get the interface name for the given interface index.
*
* @param ifindex The interface index.
* @param ifname The buffer to store the interface name.
* @return char* The interface name.
*/
char *if_indextoname(unsigned int ifindex, char *ifname);