diff --git a/config.h.in b/config.h.in index 65844b472f..83a1e8a99e 100644 --- a/config.h.in +++ b/config.h.in @@ -251,7 +251,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_IDN2_H -/* Define to 1 if you have the if_nametoindex function. */ +/* Define to 1 if you have the `if_nametoindex' function. */ #undef HAVE_IF_NAMETOINDEX /* Define to 1 if you have the header file. */ diff --git a/configure b/configure index 121f37f778..53ab9f8d13 100755 --- a/configure +++ b/configure @@ -706,7 +706,6 @@ DNSTAPSRCS DNSTAP FSTRM_CAPTURE PROTOC_C -ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVESTRINGSH IRS_PLATFORM_USEDECLSPEC ISC_PLATFORM_USEDECLSPEC @@ -18157,24 +18156,16 @@ done # # Check for if_nametoindex() for IPv6 scoped addresses support # -ac_fn_c_check_func "$LINENO" "if_nametoindex" "ac_cv_func_if_nametoindex" +for ac_func in if_nametoindex +do : + ac_fn_c_check_func "$LINENO" "if_nametoindex" "ac_cv_func_if_nametoindex" if test "x$ac_cv_func_if_nametoindex" = xyes; then : - ac_cv_have_if_nametoindex=yes -else - ac_cv_have_if_nametoindex=no + cat >>confdefs.h <<_ACEOF +#define HAVE_IF_NAMETOINDEX 1 +_ACEOF + fi - -case $ac_cv_have_if_nametoindex in -yes) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" - -$as_echo "#define HAVE_IF_NAMETOINDEX 1" >>confdefs.h - - ;; -*) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX" - ;; -esac +done for ac_func in nanosleep usleep explicit_bzero diff --git a/configure.in b/configure.in index b490c9a43d..87e1d6efb6 100644 --- a/configure.in +++ b/configure.in @@ -2154,19 +2154,7 @@ AC_SUBST(ISC_PLATFORM_HAVESTRINGSH) # # Check for if_nametoindex() for IPv6 scoped addresses support # -AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes, - ac_cv_have_if_nametoindex=no) -case $ac_cv_have_if_nametoindex in -yes) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" - AC_DEFINE(HAVE_IF_NAMETOINDEX, 1, - [Define to 1 if you have the if_nametoindex function.]) - ;; -*) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX" - ;; -esac -AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX) +AC_CHECK_FUNCS([if_nametoindex]) AC_CHECK_FUNCS(nanosleep usleep explicit_bzero) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 7609253e81..05fe3071bf 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -42,11 +42,6 @@ */ @ISC_PLATFORM_HAVELIFCONF@ -/*! \brief - * Define if the system supports if_nametoindex. - */ -@ISC_PLATFORM_HAVEIFNAMETOINDEX@ - /*! \brief * Define if the system has TCP_FASTOPEN socket option. */ diff --git a/lib/isc/netscope.c b/lib/isc/netscope.c index 7fed44ecc1..da0046398a 100644 --- a/lib/isc/netscope.c +++ b/lib/isc/netscope.c @@ -24,7 +24,7 @@ isc_result_t isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { char *ep; -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX unsigned int ifid; struct in6_addr *in6; #endif @@ -43,7 +43,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { * interface names as link names, assuming one to one mapping between * interfaces and links. */ -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX in6 = (struct in6_addr *)addr; if (IN6_IS_ADDR_LINKLOCAL(in6) && (ifid = if_nametoindex((const char *)scopename)) != 0) @@ -58,7 +58,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { zone = (uint32_t)(llz & 0xffffffffUL); if (zone != llz) return (ISC_R_FAILURE); -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX } #endif diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index 0e7712a77e..3f0f1053c2 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -62,7 +62,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, { struct sockaddr_in6 *sa6; -#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) +#if !defined(HAVE_IF_NAMETOINDEX) UNUSED(ifname); #endif @@ -106,7 +106,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, (uint32_t)zone16); dst->type.in6.s6_addr[2] = 0; dst->type.in6.s6_addr[3] = 0; -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX } else if (ifname != NULL) { unsigned int zone;