forked from espressif/esp-idf
feat(lwip): Hardcode NETIF_API=1 to support POSIX netif API
This commit is contained in:
committed by
David Čermák
parent
7bb6c67efe
commit
86089be928
@@ -100,11 +100,8 @@ if(CONFIG_LWIP_ENABLE)
|
|||||||
"port/hooks/lwip_default_hooks.c"
|
"port/hooks/lwip_default_hooks.c"
|
||||||
"port/debug/lwip_debug.c"
|
"port/debug/lwip_debug.c"
|
||||||
"port/sockets_ext.c"
|
"port/sockets_ext.c"
|
||||||
"port/freertos/sys_arch.c")
|
"port/freertos/sys_arch.c"
|
||||||
|
"port/if_index.c")
|
||||||
if(CONFIG_LWIP_NETIF_API)
|
|
||||||
list(APPEND srcs "port/if_index.c")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_LWIP_PPP_SUPPORT)
|
if(CONFIG_LWIP_PPP_SUPPORT)
|
||||||
list(APPEND srcs
|
list(APPEND srcs
|
||||||
|
@@ -18,14 +18,6 @@ menu "LWIP"
|
|||||||
The default name this device will report to other devices on the network.
|
The default name this device will report to other devices on the network.
|
||||||
Could be updated at runtime with esp_netif_set_hostname()
|
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
|
config LWIP_TCPIP_TASK_PRIO
|
||||||
int "LWIP TCP/IP Task Priority"
|
int "LWIP TCP/IP Task Priority"
|
||||||
default 18
|
default 18
|
||||||
|
@@ -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.
|
* 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
|
* 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.
|
* 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_NETIF_HOSTNAME 1
|
||||||
#define LWIP_DHCP_DISCOVER_ADD_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
|
#define LWIP_NETIF_API 1
|
||||||
#else
|
|
||||||
#define LWIP_NETIF_API 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
|
* LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
|
||||||
|
@@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#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);
|
||||||
|
Reference in New Issue
Block a user