From b6d95bf9f5713c62286851c1782ac95b2eb2fa21 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 5 Apr 2010 16:22:30 +0200 Subject: [PATCH] Build system: Check for the "if_indextoname" function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use this information rather than hard-coding "if Linux …" --- configure.in | 2 +- src/network.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index b5ce7812..f3206cb6 100644 --- a/configure.in +++ b/configure.in @@ -477,7 +477,7 @@ AC_HEADER_TIME # Checks for library functions. # AC_PROG_GCC_TRADITIONAL -AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf) +AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf if_indextoname) AC_FUNC_STRERROR_R diff --git a/src/network.c b/src/network.c index 6d0381b7..9cb8c38e 100644 --- a/src/network.c +++ b/src/network.c @@ -1653,7 +1653,7 @@ static int network_set_interface (const sockent_t *se, const struct addrinfo *ai } } -#if KERNEL_LINUX +#if defined(HAVE_IF_INDEXTONAME) && HAVE_IF_INDEXTONAME && defined(SO_BINDTODEVICE) if (se->interface != 0) { char interface_name[IFNAMSIZ]; @@ -1673,7 +1673,7 @@ static int network_set_interface (const sockent_t *se, const struct addrinfo *ai return (-1); } } -#endif +#endif /* HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */ return (0); } /* }}} network_set_interface */ @@ -1798,7 +1798,7 @@ static int network_bind_socket (int fd, const struct addrinfo *ai, const int int } } -#if KERNEL_LINUX +#if defined(HAVE_IF_INDEXTONAME) && HAVE_IF_INDEXTONAME && defined(SO_BINDTODEVICE) /* if a specific interface was set, bind the socket to it. But to avoid * possible problems with multicast routing, only do that for non-multicast * addresses */ @@ -1821,7 +1821,7 @@ static int network_bind_socket (int fd, const struct addrinfo *ai, const int int return (-1); } } -#endif +#endif /* HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */ return (0); } /* int network_bind_socket */ -- 2.30.2