Skip to content

Commit

Permalink
configure: remove check for if_nametoindex
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MartinPulec committed Aug 10, 2023
1 parent eef553d commit 34c48a1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
17 changes: 0 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions src/rtp/net_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 34c48a1

Please sign in to comment.