configure: remove check for if_nametoindex

if_nametoindex is present in both POSIX and Windows (since Vista)

+ print the error message as error_msg - debug_msg there was rather a mistake
This commit is contained in:
Martin Pulec
2023-08-09 16:43:24 +02:00
parent eef553d9aa
commit 34c48a15ca
2 changed files with 1 additions and 22 deletions

View File

@@ -299,23 +299,6 @@ AC_DEFUN([DEFINE_CUDA], [
])
AC_SUBST(DLL_LIBS)
if test $system = Windows
then
AC_MSG_CHECKING([if_nametoindex])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <windows.h>
#include <iphlpapi.h>
]], [[
if_nametoindex("eth");]]
)], HAVE_IF_NAMETOINDEX=yes, HAVE_IF_NAMETOINDEX=no)
AC_MSG_RESULT([$HAVE_IF_NAMETOINDEX])
if test $HAVE_IF_NAMETOINDEX = yes; then
AC_DEFINE([HAVE_IF_TONAMEINDEX], 1, [Function if_nametoindex is present.])
fi
else
AC_CHECK_FUNCS(if_nametoindex)
fi
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNCS(strtok_r)
AC_CHECK_FUNCS(timespec_get)

View File

@@ -810,14 +810,10 @@ socket_udp *udp_init_if(const char *addr, const char *iface, uint16_t rx_port,
goto error;
}
if (iface != NULL) {
#ifdef HAVE_IF_NAMETOINDEX
if ((s->ifindex = if_nametoindex(iface)) == 0) {
debug_msg("Illegal interface specification\n");
error_msg("Illegal interface specification\n");
goto error;
}
#else
log_msg(LOG_LEVEL_ERROR, "Cannot set interface name, if_nametoindex not supported.\n");
#endif
} else {
s->ifindex = 0;
}