diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index d0526fd4ba..4485886153 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -102,6 +102,10 @@ if(CONFIG_LWIP_ENABLE) "port/sockets_ext.c" "port/freertos/sys_arch.c") + if(CONFIG_LWIP_NETIF_API) + list(APPEND srcs "port/if_index.c") + endif() + if(CONFIG_LWIP_PPP_SUPPORT) list(APPEND srcs "lwip/src/netif/ppp/auth.c" diff --git a/components/lwip/port/if_index.c b/components/lwip/port/if_index.c new file mode 100644 index 0000000000..d7dcf25e71 --- /dev/null +++ b/components/lwip/port/if_index.c @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "lwip/if_api.h" + +unsigned int if_nametoindex(const char *ifname) +{ + return lwip_if_nametoindex(ifname); +} + +char *if_indextoname(unsigned int ifindex, char *ifname) +{ + return lwip_if_indextoname(ifindex, ifname); +}