From 4e2e2b2c5310e2d0026f0c5d3481f57f303a9d83 Mon Sep 17 00:00:00 2001 From: Abhik Roy Date: Mon, 29 Apr 2024 20:07:33 +1000 Subject: [PATCH] fix(lwip): Fixed compilation error referencing undefined POSIX interface API Closes https://github.com/espressif/esp-idf/issues/13577 --- components/lwip/CMakeLists.txt | 4 ++++ components/lwip/port/if_index.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 components/lwip/port/if_index.c diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index 671da81e2069..cae89d7c52fc 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -131,6 +131,10 @@ if(CONFIG_LWIP_PPP_SUPPORT) "lwip/src/netif/ppp/polarssl/md4.c" "lwip/src/netif/ppp/polarssl/md5.c" "lwip/src/netif/ppp/polarssl/sha1.c") + + if(CONFIG_LWIP_NETIF_API) + list(APPEND srcs "port/if_index.c") + endif() endif() if(NOT ${target} STREQUAL "linux") diff --git a/components/lwip/port/if_index.c b/components/lwip/port/if_index.c new file mode 100644 index 000000000000..d7dcf25e7175 --- /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); +}