From e53a72a649405f0a383e415cdf714215a29b44cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 10:23:28 +0200 Subject: [PATCH 01/30] Remove legacy UnixWare support (sigwait, ipv6) --- config.h.in | 5 ++- configure | 75 ------------------------------- configure.in | 53 ---------------------- lib/isc/include/isc/platform.h.in | 12 ----- lib/isc/unix/include/isc/net.h | 24 ---------- 5 files changed, 4 insertions(+), 165 deletions(-) diff --git a/config.h.in b/config.h.in index 35ffb1141d..c6e6ff1779 100644 --- a/config.h.in +++ b/config.h.in @@ -639,8 +639,11 @@ int sigwait(const unsigned int *set, int *sig); /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define to empty if your compiler does not support "static inline". */ +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus #undef inline +#endif /* Define to `unsigned int' if does not define. */ #undef size_t diff --git a/configure b/configure index 548e569f8a..32875c8c8e 100755 --- a/configure +++ b/configure @@ -755,13 +755,11 @@ ISC_ISCIPV6_O ISC_IPV6_O ISC_IPV6_H ISC_PLATFORM_HAVESOCKADDRSTORAGE -ISC_PLATFORM_FIXIN6ISADDR ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_HAVEINADDR6 ISC_PLATFORM_NEEDNETINET6IN6H -ISC_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_HAVEIPV6 BIND9_CO_RULE LIBTOOL_IN_MAIN @@ -13908,43 +13906,6 @@ fi done -# -# UnixWare 7.1.1 with the feature supplement to the UDK compiler -# is reported to not support "static inline" (RT #1212). -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for static inline breakage" >&5 -$as_echo_n "checking for static inline breakage... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - static inline int foo1() { - return 0; - } - - static inline int foo2() { - return foo1(); - } - -int -main () -{ -foo1(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define inline /**/" >>confdefs.h - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : @@ -15791,13 +15752,6 @@ if test "x$ac_cv_func_pthread_setconcurrency" = xyes; then : fi - ;; - # - # UnixWare does things its own way. - # - *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) - $as_echo "#define HAVE_UNIXWARE_SIGWAIT 1" >>confdefs.h - ;; esac @@ -17614,10 +17568,6 @@ else *-solaris*) MKDEPCFLAGS="-xM" ;; - *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) - # UnixWare - CC="$CC -w" - ;; esac fi @@ -18099,23 +18049,6 @@ case "$host" in esac -# -# This is similar to the netinet6/in6.h issue. -# -case "$host" in -*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) - # UnixWare - ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1" - ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1" - isc_netinetin6_hack="#include " - ;; -*) - ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H" - ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR" - isc_netinetin6_hack="" - ;; -esac - # # Now delve deeper into the suitability of the IPv6 support. # @@ -18131,7 +18064,6 @@ $as_echo_n "checking for in6_addr... " >&6; } #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack int @@ -18163,7 +18095,6 @@ $as_echo_n "checking for in6addr_any... " >&6; } #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack $isc_in_addr6_hack @@ -18195,7 +18126,6 @@ $as_echo_n "checking for in6addr_loopback... " >&6; } #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack $isc_in_addr6_hack @@ -18227,7 +18157,6 @@ $as_echo_n "checking for sin6_scope_id in struct sockaddr_in6... " >&6; } #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack int @@ -18257,7 +18186,6 @@ $as_echo_n "checking for in6_pktinfo... " >&6; } #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack int @@ -18298,7 +18226,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack int @@ -18333,8 +18260,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index da283583a8..5c94dae572 100644 --- a/configure.in +++ b/configure.in @@ -520,24 +520,6 @@ AC_CHECK_FUNCS(mmap) AC_CHECK_FUNCS(seteuid setresuid) AC_CHECK_FUNCS(setegid setresgid) -# -# UnixWare 7.1.1 with the feature supplement to the UDK compiler -# is reported to not support "static inline" (RT #1212). -# -AC_MSG_CHECKING(for static inline breakage) -AC_TRY_COMPILE([ - static inline int foo1() { - return 0; - } - - static inline int foo2() { - return foo1(); - } - ], [foo1();], - [AC_MSG_RESULT(no)], - [AC_MSG_RESULT(yes) - AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])]) - AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINTPTR_T @@ -950,12 +932,6 @@ case "$host" in AC_CHECK_FUNC(pthread_setconcurrency, AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY)) ;; - # - # UnixWare does things its own way. - # - *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) - AC_DEFINE(HAVE_UNIXWARE_SIGWAIT) - ;; esac # Look for functions relating to thread naming @@ -1848,10 +1824,6 @@ else *-solaris*) MKDEPCFLAGS="-xM" ;; - *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) - # UnixWare - CC="$CC -w" - ;; esac fi @@ -2134,23 +2106,6 @@ case "$host" in esac changequote([, ]) -# -# This is similar to the netinet6/in6.h issue. -# -case "$host" in -*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*) - # UnixWare - ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1" - ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1" - isc_netinetin6_hack="#include " - ;; -*) - ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H" - ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR" - isc_netinetin6_hack="" - ;; -esac - # # Now delve deeper into the suitability of the IPv6 support. # @@ -2163,7 +2118,6 @@ case "$found_ipv6" in #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack ], [struct in6_addr in6; return (0);], @@ -2179,7 +2133,6 @@ $isc_netinet6in6_hack #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack $isc_in_addr6_hack ], @@ -2194,7 +2147,6 @@ $isc_in_addr6_hack #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack $isc_in_addr6_hack ], @@ -2209,7 +2161,6 @@ $isc_in_addr6_hack #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack ], [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);], @@ -2223,7 +2174,6 @@ $isc_netinet6in6_hack #include #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack ], [struct in6_pktinfo xyzzy; return (0);], @@ -2248,7 +2198,6 @@ AC_MSG_CHECKING(for struct sockaddr_storage) AC_TRY_COMPILE([ #include #include -$isc_netinetin6_hack $isc_netinet6in6_hack ], [struct sockaddr_storage storage; return (0);], @@ -2258,13 +2207,11 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) AC_SUBST(ISC_PLATFORM_HAVEIPV6) -AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H) AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H) AC_SUBST(ISC_PLATFORM_HAVEINADDR6) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) -AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR) AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) AC_SUBST(ISC_IPV6_H) AC_SUBST(ISC_IPV6_O) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index dfc06e48bb..ce3f1a6f13 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -30,12 +30,6 @@ *** Network. ***/ -/*! \brief - * Define if this system needs the header file included - * for full IPv6 support (pretty much only UnixWare). - */ -@ISC_PLATFORM_NEEDNETINETIN6H@ - /*! \brief * Define if this system needs the header file included * to support in6_pkinfo (pretty much only BSD/OS). @@ -125,12 +119,6 @@ */ @ISC_PLATFORM_HAVEIFNAMETOINDEX@ -/*! \brief - * Define on some UnixWare systems to fix erroneous definitions of various - * IN6_IS_ADDR_* macros. - */ -@ISC_PLATFORM_FIXIN6ISADDR@ - /*! \brief * Define if the system has struct sockaddr_storage. */ diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index a30e7ef84e..f66c3818b9 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -76,9 +76,6 @@ #include /* Contractual promise. */ #include /* Contractual promise. */ -#ifdef ISC_PLATFORM_NEEDNETINETIN6H -#include /* Required on UnixWare. */ -#endif #ifdef ISC_PLATFORM_NEEDNETINET6IN6H #include /* Required on BSD/OS for in6_pktinfo. */ #endif @@ -237,27 +234,6 @@ extern const struct in6_addr isc_net_in6addrloop; #define in6addr_loopback isc_net_in6addrloop #endif -#ifdef ISC_PLATFORM_FIXIN6ISADDR -#undef IN6_IS_ADDR_GEOGRAPHIC -/*! - * \brief - * Fix UnixWare 7.1.1's broken IN6_IS_ADDR_* definitions. - */ -#define IN6_IS_ADDR_GEOGRAPHIC(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x80) -#undef IN6_IS_ADDR_IPX -#define IN6_IS_ADDR_IPX(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x04) -#undef IN6_IS_ADDR_LINKLOCAL -#define IN6_IS_ADDR_LINKLOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0x80FE) -#undef IN6_IS_ADDR_MULTICAST -#define IN6_IS_ADDR_MULTICAST(a) (((a)->S6_un.S6_l[0] & 0xFF) == 0xFF) -#undef IN6_IS_ADDR_NSAP -#define IN6_IS_ADDR_NSAP(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x02) -#undef IN6_IS_ADDR_PROVIDER -#define IN6_IS_ADDR_PROVIDER(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x40) -#undef IN6_IS_ADDR_SITELOCAL -#define IN6_IS_ADDR_SITELOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0xC0FE) -#endif /* ISC_PLATFORM_FIXIN6ISADDR */ - #ifdef ISC_PLATFORM_NEEDPORTT /*% * Ensure type in_port_t is defined. From 9a8da1e25aae4f0d0a60e431e3b518ebffbfdf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 10:33:36 +0200 Subject: [PATCH 02/30] Remove legacy BSD/OS support (ipv6,various hacks) --- acconfig.h | 32 ----- config.h.in | 32 ----- config.threads.in | 5 - configure | 194 ------------------------------ configure.in | 120 ------------------ lib/isc/include/isc/platform.h.in | 11 -- lib/isc/unix/include/isc/net.h | 3 - lib/isc/unix/resource.c | 12 +- 8 files changed, 6 insertions(+), 403 deletions(-) diff --git a/acconfig.h b/acconfig.h index a280733e35..9edd8e30c7 100644 --- a/acconfig.h +++ b/acconfig.h @@ -77,38 +77,6 @@ /** define if getc_unlocked() is available */ #undef HAVE_GETCUNLOCKED -/** Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */ -#undef SHUTUP_SPUTAUX -#ifdef SHUTUP_SPUTAUX -struct __sFILE; -extern __inline int __sputaux(int _c, struct __sFILE *_p); -#endif - -/** Shut up warnings about missing sigwait prototype on BSD/OS 4.0* */ -#undef SHUTUP_SIGWAIT -#ifdef SHUTUP_SIGWAIT -int sigwait(const unsigned int *set, int *sig); -#endif - -/** Shut up warnings from gcc -Wcast-qual on BSD/OS 4.1. */ -#undef SHUTUP_STDARG_CAST -#if defined(SHUTUP_STDARG_CAST) && defined(__GNUC__) -#include /** Grr. Must be included *every time*. */ -/** - * The silly continuation line is to keep configure from - * commenting out the #undef. - */ - -#undef \ - va_start -#define va_start(ap, last) \ - do { \ - union { const void *konst; long *var; } _u; \ - _u.konst = &(last); \ - ap = (va_list)(_u.var + __va_words(__typeof(last))); \ - } while (0) -#endif /** SHUTUP_STDARG_CAST && __GNUC__ */ - /** define if the system has a random number generating device */ #undef PATH_RANDOMDEV diff --git a/config.h.in b/config.h.in index c6e6ff1779..c4c801f1ac 100644 --- a/config.h.in +++ b/config.h.in @@ -77,38 +77,6 @@ /** define if getc_unlocked() is available */ #undef HAVE_GETCUNLOCKED -/** Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */ -#undef SHUTUP_SPUTAUX -#ifdef SHUTUP_SPUTAUX -struct __sFILE; -extern __inline int __sputaux(int _c, struct __sFILE *_p); -#endif - -/** Shut up warnings about missing sigwait prototype on BSD/OS 4.0* */ -#undef SHUTUP_SIGWAIT -#ifdef SHUTUP_SIGWAIT -int sigwait(const unsigned int *set, int *sig); -#endif - -/** Shut up warnings from gcc -Wcast-qual on BSD/OS 4.1. */ -#undef SHUTUP_STDARG_CAST -#if defined(SHUTUP_STDARG_CAST) && defined(__GNUC__) -#include /** Grr. Must be included *every time*. */ -/** - * The silly continuation line is to keep configure from - * commenting out the #undef. - */ - -#undef \ - va_start -#define va_start(ap, last) \ - do { \ - union { const void *konst; long *var; } _u; \ - _u.konst = &(last); \ - ap = (va_list)(_u.var + __va_words(__typeof(last))); \ - } while (0) -#endif /** SHUTUP_STDARG_CAST && __GNUC__ */ - /** define if the system has a random number generating device */ #undef PATH_RANDOMDEV diff --git a/config.threads.in b/config.threads.in index 30cf7cda52..a9bcd2023f 100644 --- a/config.threads.in +++ b/config.threads.in @@ -50,11 +50,6 @@ case $host in use_threads=false ;; *-freebsd*) use_threads=true ;; -[*-bsdi[234]*]) - # Thread signals do not work reliably on some versions of BSD/OS. - use_threads=false ;; -*-bsdi5*) - use_threads=true ;; *-linux*) use_threads=true ;; *-darwin[[123456789]].*) diff --git a/configure b/configure index 32875c8c8e..27f4eb5c14 100755 --- a/configure +++ b/configure @@ -723,7 +723,6 @@ ISC_PLATFORM_HAVESTRINGSH ISC_PLATFORM_BRACEPTHREADONCEINIT IRS_PLATFORM_USEDECLSPEC ISC_PLATFORM_USEDECLSPEC -ISC_PLATFORM_RLIMITTYPE ISC_PLATFORM_HAVESTATNSEC ISC_PLATFORM_HAVESYSUNH LIBCAP_LIBS @@ -759,7 +758,6 @@ ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_HAVEINADDR6 -ISC_PLATFORM_NEEDNETINET6IN6H ISC_PLATFORM_HAVEIPV6 BIND9_CO_RULE LIBTOOL_IN_MAIN @@ -981,7 +979,6 @@ with_readline enable_isc_spnego enable_chroot enable_linux_caps -with_rlimtype enable_atomic enable_fixed_rrset enable_rpz_nsip @@ -1721,7 +1718,6 @@ Optional Packages: use gperftools CPU profiler --with-kame=PATH use Kame IPv6 [default path /usr/local/v6] --with-readline=LIBSPEC specify readline library [default auto] - --with-dnsrps-libname DNSRPS provider library name (librpz.so) --with-dnsrps-dir path to DNSRPS provider library --with-protobuf-c=path Path where protobuf-c is installed, for dnstap @@ -15723,15 +15719,6 @@ fi esac ;; # - # BSDI 3.0 through 4.0.1 needs pthread_init() to be - # called before certain pthreads calls. This is deprecated - # in BSD/OS 4.1. - # - *-bsdi3.*|*-bsdi4.0*) - $as_echo "#define NEED_PTHREAD_INIT 1" >>confdefs.h - - ;; - # # LinuxThreads requires some changes to the way we # deal with signals. # @@ -18028,27 +18015,6 @@ Please choose the proper path with the following command: ;; esac -# -# Whether netinet6/in6.h is needed has to be defined in isc/platform.h. -# Including it on Kame-using platforms is very bad, though, because -# Kame uses #error against direct inclusion. So include it on only -# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1. -# This is done before the in6_pktinfo check because that's what -# netinet6/in6.h is needed for. -# - -case "$host" in -*-bsdi4.[01]*) - ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1" - isc_netinet6in6_hack="#include " - ;; -*) - ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H" - isc_netinet6in6_hack="" - ;; -esac - - # # Now delve deeper into the suitability of the IPv6 support. # @@ -18064,7 +18030,6 @@ $as_echo_n "checking for in6_addr... " >&6; } #include #include #include -$isc_netinet6in6_hack int main () @@ -18095,7 +18060,6 @@ $as_echo_n "checking for in6addr_any... " >&6; } #include #include #include -$isc_netinet6in6_hack $isc_in_addr6_hack int @@ -18126,7 +18090,6 @@ $as_echo_n "checking for in6addr_loopback... " >&6; } #include #include #include -$isc_netinet6in6_hack $isc_in_addr6_hack int @@ -18157,7 +18120,6 @@ $as_echo_n "checking for sin6_scope_id in struct sockaddr_in6... " >&6; } #include #include #include -$isc_netinet6in6_hack int main () @@ -18186,7 +18148,6 @@ $as_echo_n "checking for in6_pktinfo... " >&6; } #include #include #include -$isc_netinet6in6_hack int main () @@ -18226,7 +18187,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #include #include -$isc_netinet6in6_hack int main () @@ -19270,120 +19230,6 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# BSD/OS, and perhaps some others, don't define rlim_t. -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type rlim_t" >&5 -$as_echo_n "checking for type rlim_t... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -int -main () -{ -rlim_t rl = 19671212; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of rlim_cur" >&5 -$as_echo_n "checking type of rlim_cur... " >&6; } -if test "$cross_compiling" = yes; then : - - -# Check whether --with-rlimtype was given. -if test "${with_rlimtype+set}" = set; then : - withval=$with_rlimtype; rlimtype="$withval" -else - rlimtype="long long int" -fi - -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot determine type of rlim_cur when cross compiling - assuming $rlimtype" >&5 -$as_echo "cannot determine type of rlim_cur when cross compiling - assuming $rlimtype" >&6; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: int" >&5 -$as_echo "int" >&6; } -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int" -else - -if test "$cross_compiling" = yes; then : - as_fn_error $? "this cannot happen" "$LINENO" 5 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: long int" >&5 -$as_echo "long int" >&6; } -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int" -else - -if test "$cross_compiling" = yes; then : - as_fn_error $? "this cannot happen" "$LINENO" 5 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: long long int" >&5 -$as_echo "long long int" >&6; } -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int" -else - as_fn_error $? "unable to determine sizeof rlim_cur" "$LINENO" 5 - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - # # Older HP-UX doesn't have gettune # @@ -19496,16 +19342,6 @@ case "$host" in *-aix5.[123].*) hack_shutup_pthreadonceinit=yes ;; - *-bsdi3.1*) - hack_shutup_sputaux=yes - ;; - *-bsdi4.0*) - hack_shutup_sigwait=yes - hack_shutup_sputaux=yes - ;; - *-bsdi4.[12]*) - hack_shutup_stdargcast=yes - ;; *-solaris2.[89]) hack_shutup_pthreadonceinit=yes ;; @@ -19537,36 +19373,6 @@ case "$hack_shutup_pthreadonceinit" in ;; esac -case "$hack_shutup_sigwait" in - yes) - # - # Shut up a -Wmissing-prototypes warning for sigwait(). - # - $as_echo "#define SHUTUP_SIGWAIT 1" >>confdefs.h - - ;; -esac - -case "$hack_shutup_sputaux" in - yes) - # - # Shut up a -Wmissing-prototypes warning from . - # - $as_echo "#define SHUTUP_SPUTAUX 1" >>confdefs.h - - ;; -esac - -case "$hack_shutup_stdargcast" in - yes) - # - # Shut up a -Wcast-qual warning from va_start(). - # - $as_echo "#define SHUTUP_STDARG_CAST 1" >>confdefs.h - - ;; -esac - for ac_header in strings.h do : ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" diff --git a/configure.in b/configure.in index 5c94dae572..6e5e4cd07f 100644 --- a/configure.in +++ b/configure.in @@ -909,14 +909,6 @@ case "$host" in esac ;; # - # BSDI 3.0 through 4.0.1 needs pthread_init() to be - # called before certain pthreads calls. This is deprecated - # in BSD/OS 4.1. - # - *-bsdi3.*|*-bsdi4.0*) - AC_DEFINE(NEED_PTHREAD_INIT) - ;; - # # LinuxThreads requires some changes to the way we # deal with signals. # @@ -2085,27 +2077,6 @@ Please choose the proper path with the following command: ;; esac -# -# Whether netinet6/in6.h is needed has to be defined in isc/platform.h. -# Including it on Kame-using platforms is very bad, though, because -# Kame uses #error against direct inclusion. So include it on only -# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1. -# This is done before the in6_pktinfo check because that's what -# netinet6/in6.h is needed for. -# -changequote({, }) -case "$host" in -*-bsdi4.[01]*) - ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1" - isc_netinet6in6_hack="#include " - ;; -*) - ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H" - isc_netinet6in6_hack="" - ;; -esac -changequote([, ]) - # # Now delve deeper into the suitability of the IPv6 support. # @@ -2118,7 +2089,6 @@ case "$found_ipv6" in #include #include #include -$isc_netinet6in6_hack ], [struct in6_addr in6; return (0);], [AC_MSG_RESULT(yes) @@ -2133,7 +2103,6 @@ $isc_netinet6in6_hack #include #include #include -$isc_netinet6in6_hack $isc_in_addr6_hack ], [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);], @@ -2147,7 +2116,6 @@ $isc_in_addr6_hack #include #include #include -$isc_netinet6in6_hack $isc_in_addr6_hack ], [struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);], @@ -2161,7 +2129,6 @@ $isc_in_addr6_hack #include #include #include -$isc_netinet6in6_hack ], [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);], [AC_MSG_RESULT(yes) @@ -2174,7 +2141,6 @@ $isc_netinet6in6_hack #include #include #include -$isc_netinet6in6_hack ], [struct in6_pktinfo xyzzy; return (0);], [AC_MSG_RESULT(yes) @@ -2198,7 +2164,6 @@ AC_MSG_CHECKING(for struct sockaddr_storage) AC_TRY_COMPILE([ #include #include -$isc_netinet6in6_hack ], [struct sockaddr_storage storage; return (0);], [AC_MSG_RESULT(yes) @@ -2207,7 +2172,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) AC_SUBST(ISC_PLATFORM_HAVEIPV6) -AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H) AC_SUBST(ISC_PLATFORM_HAVEINADDR6) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) @@ -2708,53 +2672,6 @@ AC_TRY_COMPILE([#include ],[struct stat s; return(s.st_mtim.tv_nsec ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"]) AC_SUBST(ISC_PLATFORM_HAVESTATNSEC) -# -# BSD/OS, and perhaps some others, don't define rlim_t. -# -AC_MSG_CHECKING(for type rlim_t) -AC_TRY_COMPILE([ -#include -#include -#include ], -[rlim_t rl = 19671212; return (0);], -[AC_MSG_RESULT(yes) - ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"], -[AC_MSG_RESULT(no) - -AC_MSG_CHECKING(type of rlim_cur) -AC_TRY_RUN([ -#include -#include -#include -main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}], -[AC_MSG_RESULT(int) -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"], -[ -AC_TRY_RUN([ -#include -#include -#include -main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}], -[AC_MSG_RESULT(long int) -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"], -[ -AC_TRY_RUN([ -#include -#include -#include -main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}], -[AC_MSG_RESULT(long long int) -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"], -[AC_MSG_ERROR([unable to determine sizeof rlim_cur]) -],[AC_MSG_ERROR(this cannot happen)]) -],[AC_MSG_ERROR(this cannot happen)]) -],[ -AC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int") -ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype" -AC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)]) -]) -AC_SUBST(ISC_PLATFORM_RLIMITTYPE) - # # Older HP-UX doesn't have gettune # @@ -2812,16 +2729,6 @@ case "$host" in *-aix5.[[123]].*) hack_shutup_pthreadonceinit=yes ;; - *-bsdi3.1*) - hack_shutup_sputaux=yes - ;; - *-bsdi4.0*) - hack_shutup_sigwait=yes - hack_shutup_sputaux=yes - ;; - [*-bsdi4.[12]*]) - hack_shutup_stdargcast=yes - ;; [*-solaris2.[89]]) hack_shutup_pthreadonceinit=yes ;; @@ -2839,33 +2746,6 @@ case "$hack_shutup_pthreadonceinit" in ;; esac -case "$hack_shutup_sigwait" in - yes) - # - # Shut up a -Wmissing-prototypes warning for sigwait(). - # - AC_DEFINE(SHUTUP_SIGWAIT) - ;; -esac - -case "$hack_shutup_sputaux" in - yes) - # - # Shut up a -Wmissing-prototypes warning from . - # - AC_DEFINE(SHUTUP_SPUTAUX) - ;; -esac - -case "$hack_shutup_stdargcast" in - yes) - # - # Shut up a -Wcast-qual warning from va_start(). - # - AC_DEFINE(SHUTUP_STDARG_CAST) - ;; -esac - AC_CHECK_HEADERS(strings.h, ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1" , diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index ce3f1a6f13..807ca9f3c6 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -30,12 +30,6 @@ *** Network. ***/ -/*! \brief - * Define if this system needs the header file included - * to support in6_pkinfo (pretty much only BSD/OS). - */ -@ISC_PLATFORM_NEEDNETINET6IN6H@ - /*! \brief * If sockaddrs on this system have an sa_len field, ISC_PLATFORM_HAVESALEN * will be defined. @@ -210,11 +204,6 @@ */ @ISC_PLATFORM_HAVESTATNSEC@ -/* - * Type used for resource limits. - */ -@ISC_PLATFORM_RLIMITTYPE@ - /* * Define if your compiler supports "long long int". */ diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index f66c3818b9..68e73a8166 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -76,9 +76,6 @@ #include /* Contractual promise. */ #include /* Contractual promise. */ -#ifdef ISC_PLATFORM_NEEDNETINET6IN6H -#include /* Required on BSD/OS for in6_pktinfo. */ -#endif #ifndef ISC_PLATFORM_HAVEIPV6 #include /* Contractual promise. */ diff --git a/lib/isc/unix/resource.c b/lib/isc/unix/resource.c index 6d5c5aae24..a212386bc3 100644 --- a/lib/isc/unix/resource.c +++ b/lib/isc/unix/resource.c @@ -100,7 +100,7 @@ resource2rlim(isc_resource_t resource, int *rlim_resource) { isc_result_t isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) { struct rlimit rl; - ISC_PLATFORM_RLIMITTYPE rlim_value; + rlim_t rlim_value; int unixresult; int unixresource; isc_result_t result; @@ -118,17 +118,17 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) { * integer so that it could contain the maximum range of * reasonable values. Unfortunately, this exceeds the typical * range on Unix systems. Ensure the range of - * ISC_PLATFORM_RLIMITTYPE is not overflowed. + * rlim_t is not overflowed. */ isc_resourcevalue_t rlim_max; bool rlim_t_is_signed = - (((double)(ISC_PLATFORM_RLIMITTYPE)-1) < 0); + (((double)(rlim_t)-1) < 0); if (rlim_t_is_signed) - rlim_max = ~((ISC_PLATFORM_RLIMITTYPE)1 << - (sizeof(ISC_PLATFORM_RLIMITTYPE) * 8 - 1)); + rlim_max = ~((rlim_t)1 << + (sizeof(rlim_t) * 8 - 1)); else - rlim_max = (ISC_PLATFORM_RLIMITTYPE)-1; + rlim_max = (rlim_t)-1; if (value > rlim_max) value = rlim_max; From f0f71420c8eb49fa67eb7a28ad0972f5f1a59113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 10:45:29 +0200 Subject: [PATCH 03/30] Remove legacy support for AIX --- README.md | 2 +- bin/dnssec/dnssec-cds.c | 2 +- bin/dnssec/dnssec-dsfromkey.c | 2 +- bin/dnssec/dnssec-importkey.c | 2 +- bin/dnssec/dnssec-signzone.c | 2 +- bin/dnssec/dnssectool.c | 2 +- bin/named/main.c | 4 +- config.threads.in | 8 +-- configure | 80 +-------------------- configure.in | 48 +------------ contrib/dlz/drivers/dlz_filesystem_driver.c | 14 ++-- doc/dev/tests | 3 +- doc/misc/ipv6 | 6 -- lib/dns/dnssec.c | 4 +- lib/dns/dst_api.c | 6 +- lib/dns/dst_parse.c | 2 +- lib/isc/log.c | 2 +- lib/isc/powerpc/include/isc/atomic.h | 58 +-------------- lib/isc/unix/include/isc/dir.h | 23 +++--- lib/isc/unix/socket.c | 34 --------- lib/isc/win32/include/isc/dir.h | 13 ++-- lib/isccfg/parser.c | 2 +- 22 files changed, 48 insertions(+), 271 deletions(-) diff --git a/README.md b/README.md index e06941f40d..0d9bf0f1d8 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ Minimally, BIND requires a UNIX or Linux system with an ANSI C compiler, basic POSIX support, and a 64-bit integer type. Successful builds have been observed on many versions of Linux and UNIX, including RedHat, Fedora, Debian, Ubuntu, SuSE, Slackware, FreeBSD, NetBSD, OpenBSD, Mac OS X, -Solaris, HP-UX, AIX, SCO OpenServer, and OpenWRT. +Solaris, HP-UX, and OpenWRT. BIND requires a cryptography provider library such as OpenSSL or a hardware service module supporting PKCS#11. On Linux, BIND requires diff --git a/bin/dnssec/dnssec-cds.c b/bin/dnssec/dnssec-cds.c index 7c8577a45a..b1449b6933 100644 --- a/bin/dnssec/dnssec-cds.c +++ b/bin/dnssec/dnssec-cds.c @@ -62,7 +62,7 @@ #include "dnssectool.h" #ifndef PATH_MAX -#define PATH_MAX 1024 /* AIX, WIN32, and others don't define this. */ +#define PATH_MAX 1024 /* WIN32, and others don't define this. */ #endif const char *program = "dnssec-cds"; diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index af7f3b11a8..49e04f7af0 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -50,7 +50,7 @@ #include "dnssectool.h" #ifndef PATH_MAX -#define PATH_MAX 1024 /* AIX, WIN32, and others don't define this. */ +#define PATH_MAX 1024 /* WIN32, and others don't define this. */ #endif const char *program = "dnssec-dsfromkey"; diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c index add4289d31..067aeb81b4 100644 --- a/bin/dnssec/dnssec-importkey.c +++ b/bin/dnssec/dnssec-importkey.c @@ -49,7 +49,7 @@ #include "dnssectool.h" #ifndef PATH_MAX -#define PATH_MAX 1024 /* AIX, WIN32, and others don't define this. */ +#define PATH_MAX 1024 /* WIN32, and others don't define this. */ #endif const char *program = "dnssec-importkey"; diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 8e93fa87b5..45dc753c1c 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -89,7 +89,7 @@ #include "dnssectool.h" #ifndef PATH_MAX -#define PATH_MAX 1024 /* AIX, WIN32, and others don't define this. */ +#define PATH_MAX 1024 /* WIN32, and others don't define this. */ #endif const char *program = "dnssec-signzone"; diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index 42cd1da2e7..41da5eb71d 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -410,7 +410,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, uint16_t id, oldid; uint32_t rid, roldid; dns_secalg_t alg; - char filename[ISC_DIR_NAMEMAX]; + char filename[NAME_MAX]; isc_buffer_t fileb; isc_stdtime_t now; diff --git a/bin/named/main.c b/bin/named/main.c index e193a50e42..4cb4846310 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -110,8 +110,8 @@ LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_day; LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_month; static bool want_stats = false; -static char program_name[ISC_DIR_NAMEMAX] = "named"; -static char absolute_conffile[ISC_DIR_PATHMAX]; +static char program_name[NAME_MAX] = "named"; +static char absolute_conffile[PATH_MAX]; static char saved_command_line[512]; static char version[512]; static unsigned int maxsocks = 0; diff --git a/config.threads.in b/config.threads.in index a9bcd2023f..2c007ecaf6 100644 --- a/config.threads.in +++ b/config.threads.in @@ -19,8 +19,6 @@ case $host in use_threads=false ;; *-solaris*) use_threads=true ;; -*-ibm-aix*) - use_threads=true ;; *-hp-hpux10*) use_threads=false ;; *-hp-hpux11*) @@ -51,7 +49,7 @@ case $host in *-freebsd*) use_threads=true ;; *-linux*) - use_threads=true ;; + use_threads=true ;; *-darwin[[123456789]].*) use_threads=false ;; *-darwin*.*) @@ -81,7 +79,7 @@ if $use_threads then AC_MSG_RESULT(yes) else - AC_MSG_RESULT(no) + AC_MSG_RESULT(no) fi if $use_threads @@ -94,7 +92,7 @@ then # We don't want to set -lpthread as that break # the ability to choose threads library at final # link time and is not valid for all architectures. - + PTHREAD= if test "X$GCC" = "Xyes"; then saved_cc="$CC" diff --git a/configure b/configure index 27f4eb5c14..b3241709a8 100755 --- a/configure +++ b/configure @@ -760,7 +760,6 @@ ISC_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_HAVEINADDR6 ISC_PLATFORM_HAVEIPV6 BIND9_CO_RULE -LIBTOOL_IN_MAIN LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL LIBTOOL_MODE_LINK @@ -15808,10 +15807,6 @@ $as_echo "yes" >&6; } case "$host" in *) LIBTOOL_ALLOW_UNDEFINED= ;; esac - case "$host" in - *-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;; - *) LIBTOOL_IN_MAIN= ;; - esac; ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -15826,7 +15821,6 @@ $as_echo "no" >&6; } LIBTOOL_MODE_LINK= LIBTOOL_MODE_UNINSTALL= LIBTOOL_ALLOW_UNDEFINED= - LIBTOOL_IN_MAIN= INSTALL_LIBRARY='${INSTALL_DATA}' ;; esac @@ -17910,7 +17904,6 @@ SA=a - BIND9_CO_RULE=".c.$O:" @@ -19339,9 +19332,6 @@ IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT" case "$host" in - *-aix5.[123].*) - hack_shutup_pthreadonceinit=yes - ;; *-solaris2.[89]) hack_shutup_pthreadonceinit=yes ;; @@ -19519,70 +19509,7 @@ fi case "$enable_atomic" in yes|''|autodetect) - case "$host" in - powerpc-ibm-aix*) - if test "X$GCC" = "Xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"ics\"); works" >&5 -$as_echo_n "checking if asm(\"ics\"); works... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - main() { asm("ics"); exit(0); } - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - use_atomic=yes -else - - saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wa,-many" - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross compile, assume yes" >&5 -$as_echo "cross compile, assume yes" >&6; } - CFLAGS="$saved_cflags" - use_atomic=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - main() { asm("ics"); exit(0); } - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, required -Wa,-many" >&5 -$as_echo "yes, required -Wa,-many" >&6; } - use_atomic=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, use_atomic disabled" >&5 -$as_echo "no, use_atomic disabled" >&6; } - CFLAGS="$saved_cflags" - use_atomic=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else - use_atomic=yes - fi - ;; - *) - use_atomic=yes - ;; - esac + use_atomic=yes ;; no) have_stdatomic=no @@ -19776,9 +19703,6 @@ if ac_fn_c_try_compile "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; - powerpc-ibm-aix*) - compiler=aix - ;; esac fi case "$compiler" in @@ -19788,8 +19712,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext osf) ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1" ;; - aix) - ;; mac) ;; *) diff --git a/configure.in b/configure.in index 6e5e4cd07f..f3e1f521de 100644 --- a/configure.in +++ b/configure.in @@ -956,10 +956,6 @@ case $use_libtool in case "$host" in *) LIBTOOL_ALLOW_UNDEFINED= ;; esac - case "$host" in - *-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;; - *) LIBTOOL_IN_MAIN= ;; - esac; ;; *) AC_MSG_RESULT(no) @@ -973,7 +969,6 @@ case $use_libtool in LIBTOOL_MODE_LINK= LIBTOOL_MODE_UNINSTALL= LIBTOOL_ALLOW_UNDEFINED= - LIBTOOL_IN_MAIN= INSTALL_LIBRARY='${INSTALL_DATA}' ;; esac @@ -1998,7 +1993,6 @@ AC_SUBST(LIBTOOL_MODE_INSTALL) AC_SUBST(LIBTOOL_MODE_LINK) AC_SUBST(LIBTOOL_MODE_UNINSTALL) AC_SUBST(LIBTOOL_ALLOW_UNDEFINED) -AC_SUBST(LIBTOOL_IN_MAIN) BIND9_CO_RULE=".c.$O:" AC_SUBST(BIND9_CO_RULE) @@ -2726,9 +2720,6 @@ AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT) ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT" case "$host" in - *-aix5.[[123]].*) - hack_shutup_pthreadonceinit=yes - ;; [*-solaris2.[89]]) hack_shutup_pthreadonceinit=yes ;; @@ -2808,39 +2799,7 @@ AC_ARG_ENABLE(atomic, enable_atomic="autodetect") case "$enable_atomic" in yes|''|autodetect) - case "$host" in - powerpc-ibm-aix*) - if test "X$GCC" = "Xyes"; then - AC_MSG_CHECKING([if asm("ics"); works]) - AC_TRY_COMPILE(,[ - main() { asm("ics"); exit(0); } - ], - [AC_MSG_RESULT(yes) - use_atomic=yes], - [ - saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wa,-many" - AC_TRY_RUN([ - main() { asm("ics"); exit(0); } - ], - [AC_MSG_RESULT([yes, required -Wa,-many]) - use_atomic=yes], - [AC_MSG_RESULT([no, use_atomic disabled]) - CFLAGS="$saved_cflags" - use_atomic=no], - [AC_MSG_RESULT([cross compile, assume yes]) - CFLAGS="$saved_cflags" - use_atomic=yes]) - ] - ) - else - use_atomic=yes - fi - ;; - *) - use_atomic=yes - ;; - esac + use_atomic=yes ;; no) have_stdatomic=no @@ -2951,9 +2910,6 @@ if test "yes" = "$have_atomic"; then return (0);], [compiler=osf],) ;; - powerpc-ibm-aix*) - compiler=aix - ;; esac fi case "$compiler" in @@ -2963,8 +2919,6 @@ if test "yes" = "$have_atomic"; then osf) ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1" ;; - aix) - ;; mac) ;; *) diff --git a/contrib/dlz/drivers/dlz_filesystem_driver.c b/contrib/dlz/drivers/dlz_filesystem_driver.c index 30da06cc11..0b1c4ab076 100644 --- a/contrib/dlz/drivers/dlz_filesystem_driver.c +++ b/contrib/dlz/drivers/dlz_filesystem_driver.c @@ -35,7 +35,7 @@ /* * Copyright (C) 1999-2001, 2016 Internet Systems Consortium, Inc. ("ISC") - * + * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -84,7 +84,7 @@ typedef struct config_data { typedef struct dir_entry dir_entry_t; struct dir_entry { - char dirpath[ISC_DIR_PATHMAX]; + char dirpath[PATH_MAX]; ISC_LINK(dir_entry_t) link; }; @@ -361,7 +361,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, dlist_t *dir_list, unsigned int basedirlen) { - char tmp[ISC_DIR_PATHMAX + ISC_DIR_NAMEMAX]; + char tmp[PATH_MAX + NAME_MAX]; int astPos; struct stat sb; isc_result_t result = ISC_R_FAILURE; @@ -369,7 +369,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, char *type; char *ttlStr; char *data; - char host[ISC_DIR_NAMEMAX]; + char host[NAME_MAX]; char *tmpString; char *tmpPtr; int ttl; @@ -408,7 +408,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, { if ((strlen(host) + strlen(tmpPtr + 1) + 2) - > ISC_DIR_NAMEMAX) + > NAME_MAX) continue; strcat(host, tmpPtr + 1); strcat(host, "."); @@ -416,7 +416,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, } if ((strlen(host) + strlen(tmpString) + 1) - <= ISC_DIR_NAMEMAX) + <= NAME_MAX) strcat(host, tmpString); } @@ -443,7 +443,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, strncpy(host, (char *) &dir->entry.name[6], sizeof(host) - 1); - host[255] = '\0'; + host[NAME_MAX-1] = '\0'; } foundHost = true; break; diff --git a/doc/dev/tests b/doc/dev/tests index 5cccc28a8f..50a1ad10e8 100644 --- a/doc/dev/tests +++ b/doc/dev/tests @@ -17,7 +17,7 @@ The sources are checked out, and the web reports are generated, on bb, as driven by the following cron jobs: # Check out the current bind 9 version and make the source tarball. - # Argument to maketar.sh should be v9_0 for 9.0 release branch, + # Argument to maketar.sh should be v9_0 for 9.0 release branch, # HEAD for mainline. 35 2-22 * * * PLATFORM=BSD-3.1 && . $HOME/b9t/hosts/$PLATFORM/env && \ nice sh $HOME/b9t/bin/maketar.sh HEAD \ @@ -57,7 +57,6 @@ The current test schedule is as follows: :00 Most tests begin :45 Status report generator runs (was :30) - aix: I can't seem to access that machine; it appears to be down. bb: Build starts at top of hour, 0300 to 2200 durango: Build starts at top of hour, 0300 to 2200 trantor: Build starts at top of hour, 0300 to 2100, odd-numbered hours diff --git a/doc/misc/ipv6 b/doc/misc/ipv6 index 02cd19a2e1..95cf9bb4e3 100644 --- a/doc/misc/ipv6 +++ b/doc/misc/ipv6 @@ -17,11 +17,6 @@ socket API to be usable. The systems which do not follow this will currently not get any warnings or errors, but ipv6 will simply not function on them. -These systems currently include, but are not limited to: - - AIX 3.4 (with ipv6 patches) - - RUN-TIME ISSUES --------------- @@ -108,4 +103,3 @@ RELEVANT RFCs 3493: Basic Socket Interface Extensions for IPv6 3542: Advanced Sockets Application Program Interface (API) for IPv6 - diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index 7a3b59f32d..ff7396f3c9 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -784,7 +784,7 @@ dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, isc_result_t result2; isc_buffer_t buf; - isc_buffer_init(&buf, filename, ISC_DIR_NAMEMAX); + isc_buffer_init(&buf, filename, NAME_MAX); result2 = dst_key_getfilename(dst_key_name(pubkey), dst_key_id(pubkey), dst_key_alg(pubkey), @@ -1676,7 +1676,7 @@ dns_dnssec_keylistfromrdataset(const dns_name_t *origin, isc_result_t result2; isc_buffer_t buf; - isc_buffer_init(&buf, filename, ISC_DIR_NAMEMAX); + isc_buffer_init(&buf, filename, NAME_MAX); result2 = dst_key_getfilename(dst_key_name(pubkey), dst_key_id(pubkey), dst_key_alg(pubkey), diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index 583be7aee1..7207d0cf53 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -484,7 +484,7 @@ dst_key_fromfile(dns_name_t *name, dns_keytag_t id, isc_mem_t *mctx, dst_key_t **keyp) { isc_result_t result; - char filename[ISC_DIR_NAMEMAX]; + char filename[NAME_MAX]; isc_buffer_t buf; dst_key_t *key; @@ -498,7 +498,7 @@ dst_key_fromfile(dns_name_t *name, dns_keytag_t id, key = NULL; - isc_buffer_init(&buf, filename, ISC_DIR_NAMEMAX); + isc_buffer_init(&buf, filename, NAME_MAX); result = dst_key_getfilename(name, id, alg, type, NULL, mctx, &buf); if (result != ISC_R_SUCCESS) goto out; @@ -1605,7 +1605,7 @@ write_public_key(const dst_key_t *key, int type, const char *directory) { FILE *fp; isc_buffer_t keyb, textb, fileb, classb; isc_region_t r; - char filename[ISC_DIR_NAMEMAX]; + char filename[NAME_MAX]; unsigned char key_array[DST_KEY_MAXSIZE]; char text_array[DST_KEY_MAXTEXTSIZE]; char class_array[10]; diff --git a/lib/dns/dst_parse.c b/lib/dns/dst_parse.c index 25314840a5..105a7df6d0 100644 --- a/lib/dns/dst_parse.c +++ b/lib/dns/dst_parse.c @@ -624,7 +624,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv, { FILE *fp; isc_result_t result; - char filename[ISC_DIR_NAMEMAX]; + char filename[NAME_MAX]; char buffer[MAXFIELDSIZE * 2]; isc_fsaccess_t access; isc_stdtime_t when; diff --git a/lib/isc/log.c b/lib/isc/log.c index 44fff8f837..e34ab1b732 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -47,7 +47,7 @@ #define LOG_BUFFER_SIZE (8 * 1024) #ifndef PATH_MAX -#define PATH_MAX 1024 /* AIX and others don't define this. */ +#define PATH_MAX 1024 /* WIN32 and others don't define this. */ #endif /*! diff --git a/lib/isc/powerpc/include/isc/atomic.h b/lib/isc/powerpc/include/isc/atomic.h index 9899934a75..66913d31b4 100644 --- a/lib/isc/powerpc/include/isc/atomic.h +++ b/lib/isc/powerpc/include/isc/atomic.h @@ -38,63 +38,7 @@ * case. */ -#if defined(_AIX) - -#include - -#define isc_atomic_store(p, v) _clear_lock(p, v) - -#ifdef __GNUC__ -static inline int32_t -#else -static int32_t -#endif -isc_atomic_xadd(int32_t *p, int32_t val) { - int ret; - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - - ret = fetch_and_add((atomic_p)p, (int)val); - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - - return (ret); -} - -#ifdef __GNUC__ -static inline int -#else -static int -#endif -isc_atomic_cmpxchg(atomic_p p, int old, int replacement) { - int orig = old; - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - if (compare_and_swap(p, &orig, replacement)) - orig = old; - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - - return (orig); -} - -#elif defined(ISC_PLATFORM_USEGCCASM) || defined(ISC_PLATFORM_USEMACASM) +#if defined(ISC_PLATFORM_USEGCCASM) || defined(ISC_PLATFORM_USEMACASM) static inline int32_t isc_atomic_xadd(int32_t *p, int32_t val) { int32_t orig; diff --git a/lib/isc/unix/include/isc/dir.h b/lib/isc/unix/include/isc/dir.h index 36d0aad289..5a147b89f3 100644 --- a/lib/isc/unix/include/isc/dir.h +++ b/lib/isc/unix/include/isc/dir.h @@ -20,29 +20,24 @@ #include #include -#define ISC_DIR_NAMEMAX 256 -#define ISC_DIR_PATHMAX 1024 +#ifndef NAME_MAX +#define NAME_MAX 256 +#endif + +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif /*% Directory Entry */ typedef struct isc_direntry { - /*! - * Ideally, this should be NAME_MAX, but AIX does not define it by - * default and dynamically allocating the space based on pathconf() - * complicates things undesirably, as does adding special conditionals - * just for AIX. So a comfortably sized buffer is chosen instead. - */ - char name[ISC_DIR_NAMEMAX]; + char name[NAME_MAX]; unsigned int length; } isc_direntry_t; /*% Directory */ typedef struct isc_dir { unsigned int magic; - /*! - * As with isc_direntry_t->name, making this "right" for all systems - * is slightly problematic because AIX does not define PATH_MAX. - */ - char dirname[ISC_DIR_PATHMAX]; + char dirname[PATH_MAX]; isc_direntry_t entry; DIR * handle; } isc_dir_t; diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index efb4c13c0c..b28b8ef1cc 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -823,39 +823,6 @@ socket_log(isc__socket_t *sock, const isc_sockaddr_t *address, } } -#if defined(_AIX) && defined(ISC_NET_BSD44MSGHDR) && \ - defined(USE_CMSG) && defined(IPV6_RECVPKTINFO) -/* - * AIX has a kernel bug where IPV6_RECVPKTINFO gets cleared by - * setting IPV6_V6ONLY. - */ -static void -FIX_IPV6_RECVPKTINFO(isc__socket_t *sock) -{ - char strbuf[ISC_STRERRORSIZE]; - int on = 1; - - if (sock->pf != AF_INET6 || sock->type != isc_sockettype_udp) - return; - - if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, - (void *)&on, sizeof(on)) < 0) { - - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d, IPV6_RECVPKTINFO) " - "%s: %s", sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - } -} -#else -#define FIX_IPV6_RECVPKTINFO(sock) (void)0 -#endif - /*% * Increment socket-related statistics counters. */ @@ -6168,7 +6135,6 @@ isc__socket_ipv6only(isc_socket_t *sock0, bool yes) { strbuf); } } - FIX_IPV6_RECVPKTINFO(sock); /* AIX */ #endif } diff --git a/lib/isc/win32/include/isc/dir.h b/lib/isc/win32/include/isc/dir.h index 7370fa6e18..7ec8e0c1e9 100644 --- a/lib/isc/win32/include/isc/dir.h +++ b/lib/isc/win32/include/isc/dir.h @@ -19,18 +19,23 @@ #include #include -#define ISC_DIR_NAMEMAX _MAX_FNAME -#define ISC_DIR_PATHMAX _MAX_PATH +#ifndef NAME_MAX +#define NAME_MAX _MAX_FNAME +#endif + +#ifndef PATH_MAX +#define PATH_MAX _MAX_PATH +#endif typedef struct { - char name[ISC_DIR_NAMEMAX]; + char name[NAME_MAX]; unsigned int length; WIN32_FIND_DATA find_data; } isc_direntry_t; typedef struct { unsigned int magic; - char dirname[ISC_DIR_PATHMAX]; + char dirname[PATH_MAX]; isc_direntry_t entry; bool entry_filled; HANDLE search_handle; diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index af7755c40a..dc46bdb8cd 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -2965,7 +2965,7 @@ parser_complain(cfg_parser_t *pctx, bool is_warning, va_list args) { char tokenbuf[MAX_LOG_TOKEN + 10]; - static char where[ISC_DIR_PATHMAX + 100]; + static char where[PATH_MAX + 100]; static char message[2048]; int level = ISC_LOG_ERROR; const char *prep = ""; From 18e3c8d2321dc0fb09f908e40f53dbe7560fcdf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 10:53:38 +0200 Subject: [PATCH 04/30] Remove legacy support for Tru64 --- configure | 35 ----------------- configure.in | 21 ---------- lib/isc/alpha/include/isc/atomic.h | 62 +----------------------------- lib/isc/include/isc/platform.h.in | 5 --- lib/isc/timer.c | 33 ---------------- 5 files changed, 1 insertion(+), 155 deletions(-) diff --git a/configure b/configure index b3241709a8..29c9233fb9 100755 --- a/configure +++ b/configure @@ -710,7 +710,6 @@ ISC_PLATFORM_BUSYWAITNOP ISC_ARCH_DIR ISC_PLATFORM_USEMACASM ISC_PLATFORM_USESTDASM -ISC_PLATFORM_USEOSFASM ISC_PLATFORM_USEGCCASM ISC_PLATFORM_HAVEATOMICSTOREQ ISC_PLATFORM_HAVEATOMICSTORE @@ -19550,7 +19549,6 @@ fi -ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM" ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM" ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM" ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM" @@ -19608,9 +19606,6 @@ _ACEOF arch=x86_32 fi ;; - alpha*-*) - arch=alpha - ;; powerpc-*|powerpc64-*) arch=powerpc ;; @@ -19678,40 +19673,11 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - else - case "$host" in - alpha*-dec-osf*) - # Tru64 compiler has its own syntax for inline - # assembly. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - -#ifndef __DECC -#error "unexpected compiler" -#endif - return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - compiler=osf -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - esac fi case "$compiler" in gcc) ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1" ;; - osf) - ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1" - ;; mac) ;; *) @@ -19776,7 +19742,6 @@ fi - ISC_ARCH_DIR=$arch diff --git a/configure.in b/configure.in index f3e1f521de..fa2125e305 100644 --- a/configure.in +++ b/configure.in @@ -2824,7 +2824,6 @@ fi AC_SUBST(ISC_PLATFORM_HAVESTDATOMIC) -ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM" ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM" ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM" ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM" @@ -2850,9 +2849,6 @@ if test "yes" = "$use_atomic"; then arch=x86_32 fi ;; - alpha*-*) - arch=alpha - ;; powerpc-*|powerpc64-*) arch=powerpc ;; @@ -2898,27 +2894,11 @@ if test "yes" = "$have_atomic"; then ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1" ], [AC_MSG_RESULT(no)]) fi - else - case "$host" in - alpha*-dec-osf*) - # Tru64 compiler has its own syntax for inline - # assembly. - AC_TRY_COMPILE(, [ -#ifndef __DECC -#error "unexpected compiler" -#endif - return (0);], - [compiler=osf],) - ;; - esac fi case "$compiler" in gcc) ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1" ;; - osf) - ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1" - ;; mac) ;; *) @@ -2964,7 +2944,6 @@ AC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE) AC_SUBST(ISC_PLATFORM_HAVEATOMICSTOREQ) AC_SUBST(ISC_PLATFORM_USEGCCASM) -AC_SUBST(ISC_PLATFORM_USEOSFASM) AC_SUBST(ISC_PLATFORM_USESTDASM) AC_SUBST(ISC_PLATFORM_USEMACASM) diff --git a/lib/isc/alpha/include/isc/atomic.h b/lib/isc/alpha/include/isc/atomic.h index e704fef042..9e60912047 100644 --- a/lib/isc/alpha/include/isc/atomic.h +++ b/lib/isc/alpha/include/isc/atomic.h @@ -51,67 +51,7 @@ #include #include -#ifdef ISC_PLATFORM_USEOSFASM -#include - -#pragma intrinsic(asm) - -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. Memory access ordering around this function - * can be critical, so we add explicit memory block instructions at the - * beginning and the end of it (same for other functions). - */ -static inline int32_t -isc_atomic_xadd(int32_t *p, int32_t val) { - return (asm("mb;" - "1:" - "ldl_l %t0, 0(%a0);" /* load old value */ - "mov %t0, %v0;" /* copy the old value */ - "addl %t0, %a1, %t0;" /* calculate new value */ - "stl_c %t0, 0(%a0);" /* attempt to store */ - "beq %t0, 1b;" /* spin if failed */ - "mb;", - p, val)); -} - -/* - * This routine atomically stores the value 'val' in 'p'. - */ -static inline void -isc_atomic_store(int32_t *p, int32_t val) { - (void)asm("mb;" - "1:" - "ldl_l %t0, 0(%a0);" /* load old value */ - "mov %a1, %t0;" /* value to store */ - "stl_c %t0, 0(%a0);" /* attempt to store */ - "beq %t0, 1b;" /* spin if failed */ - "mb;", - p, val); -} - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -static inline int32_t -isc_atomic_cmpxchg(int32_t *p, int32_t cmpval, int32_t val) { - - return(asm("mb;" - "1:" - "ldl_l %t0, 0(%a0);" /* load old value */ - "mov %t0, %v0;" /* copy the old value */ - "cmpeq %t0, %a1, %t0;" /* compare */ - "beq %t0, 2f;" /* exit if not equal */ - "mov %a2, %t0;" /* value to store */ - "stl_c %t0, 0(%a0);" /* attempt to store */ - "beq %t0, 1b;" /* if it failed, spin */ - "2:" - "mb;", - p, cmpval, val)); -} -#elif defined (ISC_PLATFORM_USEGCCASM) +#if defined (ISC_PLATFORM_USEGCCASM) static inline int32_t isc_atomic_xadd(int32_t *p, int32_t val) { int32_t temp, prev; diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 807ca9f3c6..5f10e621fe 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -266,11 +266,6 @@ */ @ISC_PLATFORM_USEGCCASM@ -/* - * Define if Tru64 style ASM syntax must be used. - */ -@ISC_PLATFORM_USEOSFASM@ - /* * Define if the standard __asm function must be used. */ diff --git a/lib/isc/timer.c b/lib/isc/timer.c index d85fe97069..65b72b882b 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -161,7 +161,6 @@ schedule(isc__timer_t *timer, isc_time_t *now, bool signal_ok) { isc__timermgr_t *manager; isc_time_t due; int cmp; - bool timedwait; /*! * Note: the caller must ensure locking. @@ -171,13 +170,6 @@ schedule(isc__timer_t *timer, isc_time_t *now, bool signal_ok) { manager = timer->manager; - /*! - * If the manager was timed wait, we may need to signal the - * manager to force a wakeup. - */ - timedwait = (manager->nscheduled > 0 && - isc_time_seconds(&manager->due) != 0); - /* * Compute the new due time. */ @@ -240,31 +232,6 @@ schedule(isc__timer_t *timer, isc_time_t *now, bool signal_ok) { * run thread, or explicitly setting the value in the manager. */ - /* - * This is a temporary (probably) hack to fix a bug on tru64 5.1 - * and 5.1a. Sometimes, pthread_cond_timedwait() doesn't actually - * return when the time expires, so here, we check to see if - * we're 15 seconds or more behind, and if we are, we signal - * the dispatcher. This isn't such a bad idea as a general purpose - * watchdog, so perhaps we should just leave it in here. - */ - if (signal_ok && timedwait) { - isc_interval_t fifteen; - isc_time_t then; - - isc_interval_set(&fifteen, 15, 0); - result = isc_time_add(&manager->due, &fifteen, &then); - - if (result == ISC_R_SUCCESS && - isc_time_compare(&then, now) < 0) { - SIGNAL(&manager->wakeup); - signal_ok = false; - isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_TIMER, ISC_LOG_WARNING, - "*** POKED TIMER ***"); - } - } - if (timer->index == 1 && signal_ok) { XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER, ISC_MSG_SIGNALSCHED, From b02de1ec30798371867e54707e7daca61c7dcd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 10:56:14 +0200 Subject: [PATCH 05/30] Remove legacy support for SunOS --- configure | 26 +------------------------- configure.in | 24 +----------------------- lib/isc/include/isc/socket.h | 4 ++-- util/mksymtbl.pl | 11 ++--------- 4 files changed, 6 insertions(+), 59 deletions(-) diff --git a/configure b/configure index 29c9233fb9..efd70310fc 100755 --- a/configure +++ b/configure @@ -2933,18 +2933,6 @@ $as_echo "no" >&6; } fi -# -# GNU libtool support -# -case $build_os in -sunos*) - # Just set the maximum command line length for sunos as it otherwise - # takes a exceptionally long time to work it out. Required for libtool. - - lt_cv_sys_max_cmd_len=4096; - ;; -esac - case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -19146,11 +19134,6 @@ done case "$host" in *-solaris*) -$as_echo "#define NEED_SECURE_DIRECTORY 1" >>confdefs.h - - ;; -*-sunos*) - $as_echo "#define NEED_SECURE_DIRECTORY 1" >>confdefs.h ;; @@ -20579,11 +20562,9 @@ fi # # The following sets up how non-blocking i/o is established. -# Sunos, cygwin and solaris 2.x (x<5) require special handling. +# cygwin and solaris 2.x (x<5) require special handling. # case "$host" in -*-sunos*) $as_echo "#define PORT_NONBLOCK O_NDELAY" >>confdefs.h -;; *-cygwin*) $as_echo "#define PORT_NONBLOCK O_NDELAY" >>confdefs.h ;; *-solaris2.[01234]) @@ -22131,11 +22112,6 @@ else fi -case $host in - *-sunos*) dlopen="no" - ;; -esac - if test "yes" = "$dlopen"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } diff --git a/configure.in b/configure.in index fa2125e305..8da1940493 100644 --- a/configure.in +++ b/configure.in @@ -17,18 +17,6 @@ AC_CANONICAL_HOST AC_PROG_MAKE_SET -# -# GNU libtool support -# -case $build_os in -sunos*) - # Just set the maximum command line length for sunos as it otherwise - # takes a exceptionally long time to work it out. Required for libtool. - - lt_cv_sys_max_cmd_len=4096; - ;; -esac - AC_PROG_LIBTOOL AC_PROG_INSTALL AC_PROG_LN_S @@ -2634,10 +2622,6 @@ case "$host" in AC_DEFINE(NEED_SECURE_DIRECTORY, 1, [Define if connect does not honour the permission on the UNIX domain socket.]) ;; -*-sunos*) - AC_DEFINE(NEED_SECURE_DIRECTORY, 1, - [Define if connect does not honour the permission on the UNIX domain socket.]) - ;; esac # @@ -3225,10 +3209,9 @@ AC_SUBST(DNSTAP_PB_C_H) # # The following sets up how non-blocking i/o is established. -# Sunos, cygwin and solaris 2.x (x<5) require special handling. +# cygwin and solaris 2.x (x<5) require special handling. # case "$host" in -*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);; *-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);; *-solaris2.[[01234]]) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK) @@ -3717,11 +3700,6 @@ AC_ARG_WITH(dlopen, [support dynamically loadable DLZ drivers]), dlopen="$withval", dlopen="yes") -case $host in - *-sunos*) dlopen="no" - ;; -esac - if test "yes" = "$dlopen"; then AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) if test "yes" = "$have_dl"; then diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 3aff37fd85..0e1b9d8dcd 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -1196,8 +1196,8 @@ isc_socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm, /*%< * Set ownership and file permissions on the UNIX domain socket. * - * Note: On Solaris and SunOS this secures the directory containing - * the socket as Solaris and SunOS do not honour the filesystem + * Note: On Solaris this secures the directory containing + * the socket as Solaris do not honour the filesystem * permissions on the socket. * * Requires: diff --git a/util/mksymtbl.pl b/util/mksymtbl.pl index a7068f5325..a302fe27ad 100755 --- a/util/mksymtbl.pl +++ b/util/mksymtbl.pl @@ -37,7 +37,7 @@ if ($options{'o'}) { $nm_prog = "nm"; $ostype = `uname -s`; chop($ostype); -if ($ostype eq "SunOS" || $ostype eq "HP-UX") { +if ($ostype eq "HP-UX") { $nm_prog = "/usr/ccs/bin/nm -x" } @@ -52,14 +52,7 @@ open(TBLFILE, ">$outputfile") || die "failed to open output file: $outputfile"; $nsyms = 0; while () { my ($addr, $symbol) = (0, ""); - if ($ostype eq "SunOS") { - if (/\[\d*\]\s*\|\s*0x([0-9a-f]*)\|\s*0x[0-9a-f]*\|FUNC\s*(.*)\|([^|]+)$/) { - next if ($2 =~ /UNDEF/); # skip undefined symbols - $addr = $1; - $symbol = $3; - chop($symbol); - } - } elsif ($ostype eq "HP-UX") { + if ($ostype eq "HP-UX") { if (/(\S*)\s*\|0x([0-9a-f]*)\|([^|]*\|entry|extern\|code)/) { $addr = $2; $symbol = $1; From 02e349c0517fce8e297243b167b5391ade47717e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:09:34 +0200 Subject: [PATCH 06/30] Remove legacy support for HP-UX --- bin/tests/system/ifconfig.sh | 10 +--- config.h.in | 3 - configure | 110 ----------------------------------- configure.in | 61 ------------------- lib/isc/unix/ifiter_ioctl.c | 20 ------- lib/isc/unix/os.c | 22 +------ lib/isc/unix/resource.c | 14 ----- lib/isc/unix/socket.c | 21 +++---- util/mksymtbl.pl | 30 +++------- 9 files changed, 17 insertions(+), 274 deletions(-) diff --git a/bin/tests/system/ifconfig.sh b/bin/tests/system/ifconfig.sh index ec9993fd34..478ab56c61 100755 --- a/bin/tests/system/ifconfig.sh +++ b/bin/tests/system/ifconfig.sh @@ -38,15 +38,7 @@ EOF exit 1 fi -# If running on hp-ux, don't even try to run config.guess. -# It will try to create a temporary file in the current directory, -# which fails when running as root with the current directory -# on a NFS mounted disk. - -case `uname -a` in - *HP-UX*) sys=hpux ;; - *) sys=`sh $config_guess` ;; -esac +sys=`sh $config_guess` use_ip= case "$sys" in diff --git a/config.h.in b/config.h.in index c4c801f1ac..f23b16c1af 100644 --- a/config.h.in +++ b/config.h.in @@ -429,9 +429,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DEVPOLL_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_DYNTUNE_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H diff --git a/configure b/configure index efd70310fc..381ff78791 100755 --- a/configure +++ b/configure @@ -13374,12 +13374,6 @@ case "$host" in STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET" CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET" ;; - #HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros - *-hp-hpux*) - STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" - LIBS="-lxnet $LIBS" - ;; # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros *-solaris*) STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__" @@ -17481,12 +17475,6 @@ $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - case "$host" in - *-hp-hpux*) - CFLAGS="$CFLAGS -Wl,+vnocompatwarnings" - BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings" - ;; - esac if test "X$enable_warn_shadow" = Xyes; then STD_CWARNINGS="$STD_CWARNINGS -Wshadow" fi @@ -17501,27 +17489,6 @@ else CCNOOPT="$CCNOOPT -std" MKDEPCC="$CC" ;; - *-hp-hpux*) - CC="$CC -Ae -z" - # The version of the C compiler that constantly warns about - # 'const' as well as alignment issues is unfortunately not - # able to be discerned via the version of the operating - # system, nor does cc have a version flag. - case "`$CC +W 123 2>&1`" in - *Unknown?option*) - STD_CWARNINGS="+w1" - ;; - *) - # Turn off the pointlessly noisy warnings. - STD_CWARNINGS="+w1 +W 474,530,2193,2236" - ;; - esac - CCOPT="$CCOPT -Ae -z" - CCNOOPT="$CCNOOPT -Ae -z" - CFLAGS="$CFLAGS -Wl,+vnocompatwarnings" - BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings" - MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP' - ;; *-sgi-irix*) STD_CWARNINGS="-fullwarn -woff 1209" # @@ -19205,29 +19172,6 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# Older HP-UX doesn't have gettune -# -case "$host" in - *-hp-hpux*) - for ac_header in sys/dyntune.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/dyntune.h" "ac_cv_header_sys_dyntune_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_dyntune_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_DYNTUNE_H 1 -_ACEOF - -fi - -done - - ;; - *) - ;; -esac - - # # Compaq TruCluster requires more code for handling cluster IP aliases # @@ -19373,54 +19317,6 @@ else ac_cv_have_if_nametoindex=no fi -case $ac_cv_have_if_nametoindex in -no) - case "$host" in - *-hp-hpux*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nametoindex in -lipv6" >&5 -$as_echo_n "checking for if_nametoindex in -lipv6... " >&6; } -if ${ac_cv_lib_ipv6_if_nametoindex+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lipv6 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char if_nametoindex (); -int -main () -{ -return if_nametoindex (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ipv6_if_nametoindex=yes -else - ac_cv_lib_ipv6_if_nametoindex=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipv6_if_nametoindex" >&5 -$as_echo "$ac_cv_lib_ipv6_if_nametoindex" >&6; } -if test "x$ac_cv_lib_ipv6_if_nametoindex" = xyes; then : - ac_cv_have_if_nametoindex=yes - LIBS="-lipv6 $LIBS" -fi - - ;; - esac -esac case $ac_cv_have_if_nametoindex in yes) ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" @@ -22215,12 +22111,6 @@ if test "yes" = "$dlopen"; then SO_LDFLAGS="-G -z text" SO_LD="ld" ;; - *-hp-hpux*) - SO=sl - SO_CFLAGS="+z" - SO_LDFLAGS="-b +vnocompatwarnings" - SO_LD="ld" - ;; *) SO_CFLAGS="-fPIC" ;; diff --git a/configure.in b/configure.in index 8da1940493..dcd4e5fc11 100644 --- a/configure.in +++ b/configure.in @@ -403,12 +403,6 @@ case "$host" in STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET" CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET" ;; - #HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros - *-hp-hpux*) - STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" - LIBS="-lxnet $LIBS" - ;; # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros *-solaris*) STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__" @@ -1744,12 +1738,6 @@ if test "X$GCC" = "Xyes"; then else AC_MSG_RESULT(no) fi - case "$host" in - *-hp-hpux*) - CFLAGS="$CFLAGS -Wl,+vnocompatwarnings" - BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings" - ;; - esac if test "X$enable_warn_shadow" = Xyes; then STD_CWARNINGS="$STD_CWARNINGS -Wshadow" fi @@ -1764,27 +1752,6 @@ else CCNOOPT="$CCNOOPT -std" MKDEPCC="$CC" ;; - *-hp-hpux*) - CC="$CC -Ae -z" - # The version of the C compiler that constantly warns about - # 'const' as well as alignment issues is unfortunately not - # able to be discerned via the version of the operating - # system, nor does cc have a version flag. - case "`$CC +W 123 2>&1`" in - *Unknown?option*) - STD_CWARNINGS="+w1" - ;; - *) - # Turn off the pointlessly noisy warnings. - STD_CWARNINGS="+w1 +W 474,530,2193,2236" - ;; - esac - CCOPT="$CCOPT -Ae -z" - CCNOOPT="$CCNOOPT -Ae -z" - CFLAGS="$CFLAGS -Wl,+vnocompatwarnings" - BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings" - MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP' - ;; *-sgi-irix*) STD_CWARNINGS="-fullwarn -woff 1209" # @@ -2650,18 +2617,6 @@ AC_TRY_COMPILE([#include ],[struct stat s; return(s.st_mtim.tv_nsec ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"]) AC_SUBST(ISC_PLATFORM_HAVESTATNSEC) -# -# Older HP-UX doesn't have gettune -# -case "$host" in - *-hp-hpux*) - AC_CHECK_HEADERS(sys/dyntune.h) - ;; - *) - ;; -esac - - # # Compaq TruCluster requires more code for handling cluster IP aliases # @@ -2734,16 +2689,6 @@ AC_SUBST(ISC_PLATFORM_HAVESTRINGSH) AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes, ac_cv_have_if_nametoindex=no) case $ac_cv_have_if_nametoindex in -no) - case "$host" in - *-hp-hpux*) - AC_CHECK_LIB(ipv6, if_nametoindex, - ac_cv_have_if_nametoindex=yes - LIBS="-lipv6 $LIBS",) - ;; - esac -esac -case $ac_cv_have_if_nametoindex in yes) ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" AC_DEFINE(HAVE_IF_NAMETOINDEX, 1, @@ -3749,12 +3694,6 @@ if test "yes" = "$dlopen"; then SO_LDFLAGS="-G -z text" SO_LD="ld" ;; - *-hp-hpux*) - SO=sl - SO_CFLAGS="+z" - SO_LDFLAGS="-b +vnocompatwarnings" - SO_LD="ld" - ;; *) SO_CFLAGS="-fPIC" ;; diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index 9702faea1a..38c121c181 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -206,26 +206,6 @@ getbuf6(isc_interfaceiter_t *iter) { */ if (ioctl(iter->socket6, SIOCGLIFCONF, (char *)&iter->lifc) == -1) { -#ifdef __hpux - /* - * IPv6 interface scanning is not available on all - * kernels w/ IPv6 sockets. - */ - if (errno == ENOENT) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_INTERFACE, - ISC_LOG_DEBUG(1), - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETIFCONFIG, - "get interface " - "configuration: %s"), - strbuf); - result = ISC_R_FAILURE; - goto cleanup; - } -#endif if (errno != EINVAL) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, diff --git a/lib/isc/unix/os.c b/lib/isc/unix/os.c index 8cff6b66eb..79409cffbc 100644 --- a/lib/isc/unix/os.c +++ b/lib/isc/unix/os.c @@ -19,7 +19,6 @@ #include -#ifndef __hpux static inline long sysconf_ncpus(void) { #if defined(_SC_NPROCESSORS_ONLN) @@ -30,25 +29,8 @@ sysconf_ncpus(void) { return (0); #endif } -#endif #endif /* HAVE_SYSCONF */ - -#ifdef __hpux - -#include - -static inline int -hpux_ncpus(void) { - struct pst_dynamic psd; - if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) != -1) - return (psd.psd_proc_cnt); - else - return (0); -} - -#endif /* __hpux */ - #if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME) #include /* for FreeBSD */ #include /* for NetBSD */ @@ -71,9 +53,7 @@ unsigned int isc_os_ncpus(void) { long ncpus = 0; -#ifdef __hpux - ncpus = hpux_ncpus(); -#elif defined(HAVE_SYSCONF) +#if defined(HAVE_SYSCONF) ncpus = sysconf_ncpus(); #endif #if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME) diff --git a/lib/isc/unix/resource.c b/lib/isc/unix/resource.c index a212386bc3..99eab54184 100644 --- a/lib/isc/unix/resource.c +++ b/lib/isc/unix/resource.c @@ -28,10 +28,6 @@ #include /* To get the large NR_OPEN. */ #endif -#if defined(__hpux) && defined(HAVE_SYS_DYNTUNE_H) -#include -#endif - #include "errno2result.h" static isc_result_t @@ -170,16 +166,6 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) { if (unixresult == 0) return (ISC_R_SUCCESS); } -#elif defined(__hpux) && defined(HAVE_SYS_DYNTUNE_H) - if (resource == isc_resource_openfiles && rlim_value == RLIM_INFINITY) { - uint64_t maxfiles; - if (gettune("maxfiles_lim", &maxfiles) == 0) { - rl.rlim_cur = rl.rlim_max = maxfiles; - unixresult = setrlimit(unixresource, &rl); - if (unixresult == 0) - return (ISC_R_SUCCESS); - } - } #endif if (resource == isc_resource_openfiles && rlim_value == RLIM_INFINITY) { if (getrlimit(unixresource, &rl) == 0) { diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index b28b8ef1cc..734b3f4386 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1856,19 +1856,10 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { SOFT_OR_HARD(ENETUNREACH, ISC_R_NETUNREACH); SOFT_OR_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH); SOFT_OR_HARD(EHOSTDOWN, ISC_R_HOSTDOWN); - /* HPUX 11.11 can return EADDRNOTAVAIL. */ - SOFT_OR_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL); SOFT_OR_HARD(ENOBUFS, ISC_R_NORESOURCES); /* Should never get this one but it was seen. */ #ifdef ENOPROTOOPT SOFT_OR_HARD(ENOPROTOOPT, ISC_R_HOSTUNREACH); -#endif - /* - * HPUX returns EPROTO and EINVAL on receiving some ICMP/ICMPv6 - * errors. - */ -#ifdef EPROTO - SOFT_OR_HARD(EPROTO, ISC_R_HOSTUNREACH); #endif SOFT_OR_HARD(EINVAL, ISC_R_HOSTUNREACH); @@ -5686,10 +5677,14 @@ isc__socket_connect(isc_socket_t *sock0, const isc_sockaddr_t *addr, cc = connect(sock->fd, &addr->type.sa, addr->length); if (cc < 0) { /* - * HP-UX "fails" to connect a UDP socket and sets errno to - * EINPROGRESS if it's non-blocking. We'd rather regard this as - * a success and let the user detect it if it's really an error - * at the time of sending a packet on the socket. + * The socket is nonblocking and the connection cannot be + * completed immediately. It is possible to select(2) or + * poll(2) for completion by selecting the socket for writing. + * After select(2) indicates writability, use getsockopt(2) to + * read the SO_ERROR option at level SOL_SOCKET to determine + * whether connect() completed successfully (SO_ERROR is zero) + * or unsuccessfully (SO_ERROR is one of the usual error codes + * listed here, explaining the reason for the failure). */ if (sock->type == isc_sockettype_udp && errno == EINPROGRESS) { cc = 0; diff --git a/util/mksymtbl.pl b/util/mksymtbl.pl index a302fe27ad..f94fb72e89 100755 --- a/util/mksymtbl.pl +++ b/util/mksymtbl.pl @@ -37,9 +37,6 @@ if ($options{'o'}) { $nm_prog = "nm"; $ostype = `uname -s`; chop($ostype); -if ($ostype eq "HP-UX") { - $nm_prog = "/usr/ccs/bin/nm -x" -} if ($options{'i'}) { open(SYMBOLS, $options{'i'}) || die "failed to open $options{'i'}"; @@ -52,28 +49,15 @@ open(TBLFILE, ">$outputfile") || die "failed to open output file: $outputfile"; $nsyms = 0; while () { my ($addr, $symbol) = (0, ""); - if ($ostype eq "HP-UX") { - if (/(\S*)\s*\|0x([0-9a-f]*)\|([^|]*\|entry|extern\|code)/) { - $addr = $2; - $symbol = $1; - # this filter catches a massive number of awkward - # symbols such as "$START$". we are not interested in - # those and ignore them. - next if ($symbol =~ /\$/); - } - } else { - # *BSDs, Linux, etc. - if (/([0-9a-f]*)\s[tT]\s(.*)/) { - ($addr, $symbol) = ($1, $2); - # heuristics: some compilers add a "_" to all program - # defined symbols. Detect and fix it for a well known - # symbol of "main". - $need_uscorefix = 1 if ($symbol eq "_main"); - } + # *BSDs, Linux, etc. + if (/([0-9a-f]*)\s[tT]\s(.*)/) { + ($addr, $symbol) = ($1, $2); + # heuristics: some compilers add a "_" to all program + # defined symbols. Detect and fix it for a well known + # symbol of "main". + $need_uscorefix = 1 if ($symbol eq "_main"); } if ($symbol ne "") { - # XXX: HP-UX's nm can produce a duplicate entry for the same - # address. Ignore duplicate entries except the first one. next if ($symmap{$addr}); $symmap{$addr} = $symbol; From 9f4528c623470f552c60c74d551295be22b0e4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:11:43 +0200 Subject: [PATCH 07/30] Remove legacy support for Compaq TruCluster --- acconfig.h | 3 -- config.h.in | 6 --- configure | 80 ------------------------------------- configure.in | 36 ----------------- lib/isc/unix/ifiter_ioctl.c | 64 ----------------------------- 5 files changed, 189 deletions(-) diff --git a/acconfig.h b/acconfig.h index 9edd8e30c7..d0b557693a 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define on DEC OSF to enable 4.4BSD style sa_len support */ -#undef _SOCKADDR_LEN - /** define if your system needs pthread_init() before using pthreads */ #undef NEED_PTHREAD_INIT diff --git a/config.h.in b/config.h.in index f23b16c1af..8823a42ddc 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define on DEC OSF to enable 4.4BSD style sa_len support */ -#undef _SOCKADDR_LEN - /** define if your system needs pthread_init() before using pthreads */ #undef NEED_PTHREAD_INIT @@ -471,9 +468,6 @@ /* Define if Thread-Local Storage is available */ #undef HAVE_TLS -/* Define if running under Compaq TruCluster */ -#undef HAVE_TRUCLUSTER - /* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T diff --git a/configure b/configure index 381ff78791..737fea7f4c 100755 --- a/configure +++ b/configure @@ -13368,12 +13368,6 @@ fi # OS dependent CC flags # case "$host" in - # OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or - # -D_XOPEN_SOURCE_EXTENDED. - *-dec-osf*) - STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET" - CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET" - ;; # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros *-solaris*) STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__" @@ -17483,12 +17477,6 @@ $as_echo "no" >&6; } fi else case $host in - *-dec-osf*) - CC="$CC -std" - CCOPT="$CCOPT -std" - CCNOOPT="$CCNOOPT -std" - MKDEPCC="$CC" - ;; *-sgi-irix*) STD_CWARNINGS="-fullwarn -woff 1209" # @@ -18311,17 +18299,6 @@ fi -# -# Look for a 4.4BSD-style sa_len member in struct sockaddr. -# -case "$host" in - *-dec-osf*) - # Turn on 4.4BSD style sa_len support. - $as_echo "#define _SOCKADDR_LEN 1" >>confdefs.h - - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sa_len in struct sockaddr" >&5 $as_echo_n "checking for sa_len in struct sockaddr... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19172,63 +19149,6 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# Compaq TruCluster requires more code for handling cluster IP aliases -# -case "$host" in - *-dec-osf*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clua_getaliasaddress in -lclua" >&5 -$as_echo_n "checking for clua_getaliasaddress in -lclua... " >&6; } -if ${ac_cv_lib_clua_clua_getaliasaddress+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lclua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char clua_getaliasaddress (); -int -main () -{ -return clua_getaliasaddress (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_clua_clua_getaliasaddress=yes -else - ac_cv_lib_clua_clua_getaliasaddress=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_clua_clua_getaliasaddress" >&5 -$as_echo "$ac_cv_lib_clua_clua_getaliasaddress" >&6; } -if test "x$ac_cv_lib_clua_clua_getaliasaddress" = xyes; then : - LIBS="-lclua $LIBS" -fi - - ac_fn_c_check_func "$LINENO" "clua_getaliasaddress" "ac_cv_func_clua_getaliasaddress" -if test "x$ac_cv_func_clua_getaliasaddress" = xyes; then : - -$as_echo "#define HAVE_TRUCLUSTER 1" >>confdefs.h - -fi - - ;; - *) - ;; -esac - # # Some hosts need msg_namelen to match the size of the socket structure. # Some hosts don't set msg_namelen appropriately on return from recvmsg(). diff --git a/configure.in b/configure.in index dcd4e5fc11..35934d2b7f 100644 --- a/configure.in +++ b/configure.in @@ -397,12 +397,6 @@ AC_PROG_CC_C99 # OS dependent CC flags # case "$host" in - # OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or - # -D_XOPEN_SOURCE_EXTENDED. - *-dec-osf*) - STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET" - CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET" - ;; # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros *-solaris*) STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__" @@ -1746,12 +1740,6 @@ if test "X$GCC" = "Xyes"; then fi else case $host in - *-dec-osf*) - CC="$CC -std" - CCOPT="$CCOPT -std" - CCNOOPT="$CCNOOPT -std" - MKDEPCC="$CC" - ;; *-sgi-irix*) STD_CWARNINGS="-fullwarn -woff 1209" # @@ -2209,16 +2197,6 @@ AC_SUBST(ISC_PLATFORM_NEEDPTON) AC_SUBST(ISC_EXTRA_OBJS) AC_SUBST(ISC_EXTRA_SRCS) -# -# Look for a 4.4BSD-style sa_len member in struct sockaddr. -# -case "$host" in - *-dec-osf*) - # Turn on 4.4BSD style sa_len support. - AC_DEFINE(_SOCKADDR_LEN) - ;; -esac - AC_MSG_CHECKING(for sa_len in struct sockaddr) AC_TRY_COMPILE([ #include @@ -2617,20 +2595,6 @@ AC_TRY_COMPILE([#include ],[struct stat s; return(s.st_mtim.tv_nsec ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"]) AC_SUBST(ISC_PLATFORM_HAVESTATNSEC) -# -# Compaq TruCluster requires more code for handling cluster IP aliases -# -case "$host" in - *-dec-osf*) - AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS") - AC_CHECK_FUNC(clua_getaliasaddress, - AC_DEFINE(HAVE_TRUCLUSTER, 1, - [Define if running under Compaq TruCluster])) - ;; - *) - ;; -esac - # # Some hosts need msg_namelen to match the size of the socket structure. # Some hosts don't set msg_namelen appropriately on return from recvmsg(). diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index 38c121c181..08143ae25a 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -68,11 +68,6 @@ struct isc_interfaceiter { isc_result_t result6; /* Last result code. */ bool first6; #endif -#ifdef HAVE_TRUCLUSTER - int clua_context; /* Cluster alias context */ - bool clua_done; - struct sockaddr clua_sa; -#endif #ifdef __linux FILE * proc; char entry[ISC_IF_INET6_SZ]; @@ -82,12 +77,6 @@ struct isc_interfaceiter { isc_result_t result; /* Last result code. */ }; -#ifdef HAVE_TRUCLUSTER -#include -#include -#endif - - /*% * Size of buffer for SIOCGLIFCONF, in bytes. We assume no sane system * will have more than a megabyte of interface configuration data. @@ -339,10 +328,6 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { * A newly created iterator has an undefined position * until isc_interfaceiter_first() is called. */ -#ifdef HAVE_TRUCLUSTER - iter->clua_context = -1; - iter->clua_done = true; -#endif #ifdef __linux iter->proc = fopen("/proc/net/if_inet6", "r"); iter->valid = ISC_R_FAILURE; @@ -372,30 +357,6 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { return (result); } -#ifdef HAVE_TRUCLUSTER -static void -get_inaddr(isc_netaddr_t *dst, struct in_addr *src) { - dst->family = AF_INET; - memmove(&dst->type.in, src, sizeof(struct in_addr)); -} - -static isc_result_t -internal_current_clusteralias(isc_interfaceiter_t *iter) { - struct clua_info ci; - if (clua_getaliasinfo(&iter->clua_sa, &ci) != CLUA_SUCCESS) - return (ISC_R_IGNORE); - memset(&iter->current, 0, sizeof(iter->current)); - iter->current.af = iter->clua_sa.sa_family; - memset(iter->current.name, 0, sizeof(iter->current.name)); - snprintf(iter->current.name, sizeof(iter->current.name), - "clua%d", ci.aliasid); - iter->current.flags = INTERFACE_F_UP; - get_inaddr(&iter->current.address, &ci.addr); - get_inaddr(&iter->current.netmask, &ci.netmask); - return (ISC_R_SUCCESS); -} -#endif - /* * Get information about the current interface to iter->current. * If successful, return ISC_R_SUCCESS. @@ -772,10 +733,6 @@ internal_current(isc_interfaceiter_t *iter) { if (iter->result6 != ISC_R_NOMORE) return (iter->result6); } -#endif -#ifdef HAVE_TRUCLUSTER - if (!iter->clua_done) - return(internal_current_clusteralias(iter)); #endif return (internal_current4(iter)); } @@ -845,9 +802,6 @@ internal_next6(isc_interfaceiter_t *iter) { static isc_result_t internal_next(isc_interfaceiter_t *iter) { -#ifdef HAVE_TRUCLUSTER - int clua_result; -#endif #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) if (iter->mode == 6) { iter->result6 = internal_next6(iter); @@ -858,15 +812,6 @@ internal_next(isc_interfaceiter_t *iter) { return (ISC_R_SUCCESS); } } -#endif -#ifdef HAVE_TRUCLUSTER - if (!iter->clua_done) { - clua_result = clua_getaliasaddress(&iter->clua_sa, - &iter->clua_context); - if (clua_result != CLUA_SUCCESS) - iter->clua_done = true; - return (ISC_R_SUCCESS); - } #endif return (internal_next4(iter)); } @@ -889,9 +834,6 @@ internal_destroy(isc_interfaceiter_t *iter) { static void internal_first(isc_interfaceiter_t *iter) { -#ifdef HAVE_TRUCLUSTER - int clua_result; -#endif iter->pos = 0; #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) iter->pos6 = 0; @@ -899,12 +841,6 @@ void internal_first(isc_interfaceiter_t *iter) { iter->result6 = ISC_R_SUCCESS; iter->first6 = true; #endif -#ifdef HAVE_TRUCLUSTER - iter->clua_context = 0; - clua_result = clua_getaliasaddress(&iter->clua_sa, - &iter->clua_context); - iter->clua_done = (clua_result != CLUA_SUCCESS); -#endif #ifdef __linux linux_if_inet6_first(iter); #endif From c19713aa518d1deb43fecd31b99f9ba44317d82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:20:27 +0200 Subject: [PATCH 08/30] Remove support for legacy SGI IRIX --- bin/named/unix/os.c | 2 +- configure | 16 ---------------- configure.in | 15 --------------- lib/isc/unix/file.c | 4 +--- lib/isc/unix/ifiter_sysctl.c | 14 -------------- 5 files changed, 2 insertions(+), 49 deletions(-) diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 2893bb282a..d462a225eb 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -23,8 +23,8 @@ #include #include +#include #include -#include /* Required for initgroups() on IRIX. */ #include #include #include diff --git a/configure b/configure index 737fea7f4c..6f2d3ea112 100755 --- a/configure +++ b/configure @@ -773,7 +773,6 @@ MKSYMTBL_PROGRAM ISC_PLATFORM_USEBACKTRACE PURIFY purify_path -IRIX_DNSSEC_WARNINGS_HACK MKDEPPROG MKDEPCFLAGS MKDEPCC @@ -17402,7 +17401,6 @@ esac # MKDEPCC="$CC" MKDEPCFLAGS="-M" -IRIX_DNSSEC_WARNINGS_HACK="" if test "X$GCC" = "Xyes"; then STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith" @@ -17477,17 +17475,6 @@ $as_echo "no" >&6; } fi else case $host in - *-sgi-irix*) - STD_CWARNINGS="-fullwarn -woff 1209" - # - # Silence more than 250 instances of - # "prototyped function redeclared without prototype" - # and 11 instances of - # "variable ... was set but never used" - # from lib/dns/sec/openssl. - # - IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552" - ;; *-solaris*) MKDEPCFLAGS="-xM" ;; @@ -17498,7 +17485,6 @@ fi - # # NLS # @@ -17519,8 +17505,6 @@ fi # Use this for now, instead: # case "$host" in - mips-sgi-irix*) - ;; *-linux*) ;; *) diff --git a/configure.in b/configure.in index 35934d2b7f..5fcc85117c 100644 --- a/configure.in +++ b/configure.in @@ -1702,7 +1702,6 @@ esac # MKDEPCC="$CC" MKDEPCFLAGS="-M" -IRIX_DNSSEC_WARNINGS_HACK="" if test "X$GCC" = "Xyes"; then STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith" @@ -1740,17 +1739,6 @@ if test "X$GCC" = "Xyes"; then fi else case $host in - *-sgi-irix*) - STD_CWARNINGS="-fullwarn -woff 1209" - # - # Silence more than 250 instances of - # "prototyped function redeclared without prototype" - # and 11 instances of - # "variable ... was set but never used" - # from lib/dns/sec/openssl. - # - IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552" - ;; *-solaris*) MKDEPCFLAGS="-xM" ;; @@ -1760,7 +1748,6 @@ fi AC_SUBST(MKDEPCC) AC_SUBST(MKDEPCFLAGS) AC_SUBST(MKDEPPROG) -AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK) # # NLS @@ -1777,8 +1764,6 @@ AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),) # Use this for now, instead: # case "$host" in - mips-sgi-irix*) - ;; *-linux*) ;; *) diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index c43afda7f7..6f214602d6 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -198,9 +198,7 @@ isc_file_settime(const char *file, isc_time_t *when) { /* * isc_time_nanoseconds guarantees a value that divided by 1000 will - * fit into the minimum possible size tv_usec field. Unfortunately, - * we don't know what that type is so can't cast directly ... but - * we can at least cast to signed so the IRIX compiler shuts up. + * fit into the minimum possible size tv_usec field. */ times[0].tv_usec = times[1].tv_usec = (int32_t)(isc_time_nanoseconds(when) / 1000); diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c index 33ecc69d58..f13065623f 100644 --- a/lib/isc/unix/ifiter_sysctl.c +++ b/lib/isc/unix/ifiter_sysctl.c @@ -29,14 +29,8 @@ #include /* XXX what about Alpha? */ -#ifdef sgi -#define ROUNDUP(a) ((a) > 0 ? \ - (1 + (((a) - 1) | (sizeof(__uint64_t) - 1))) : \ - sizeof(__uint64_t)) -#else #define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \ : sizeof(long)) -#endif #define IFITER_MAGIC ISC_MAGIC('I', 'F', 'I', 'S') #define VALID_IFITER(t) ISC_MAGIC_VALID(t, IFITER_MAGIC) @@ -218,18 +212,10 @@ internal_current(isc_interfaceiter_t *iter) { #ifdef ISC_PLATFORM_HAVESALEN sa = (struct sockaddr *)((char*)(sa) + ROUNDUP(sa->sa_len)); -#else -#ifdef sgi - /* - * Do as the contributed SGI code does. - */ - sa = (struct sockaddr *)((char*)(sa) - + ROUNDUP(_FAKE_SA_LEN_DST(sa))); #else /* XXX untested. */ sa = (struct sockaddr *)((char*)(sa) + ROUNDUP(sizeof(struct sockaddr))); -#endif #endif } From 00ca487fec1c304949046304f3692151783cb89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:28:24 +0200 Subject: [PATCH 09/30] We always want IPv6 --- acconfig.h | 3 --- bin/tests/system/conf.sh.in | 6 +----- bin/tests/system/conf.sh.win32 | 10 +++------- config.h.in | 3 --- config.h.win32 | 2 -- configure | 26 ++------------------------ configure.in | 20 ++------------------ lib/isc/tests/socket_test.c | 2 +- lib/isc/unix/net.c | 22 +--------------------- lib/isc/win32/net.c | 12 ------------ lib/ns/interfacemgr.c | 2 -- 11 files changed, 10 insertions(+), 98 deletions(-) diff --git a/acconfig.h b/acconfig.h index d0b557693a..2be46d2878 100644 --- a/acconfig.h +++ b/acconfig.h @@ -65,9 +65,6 @@ */ #undef CALL_PTHREAD_SETCONCURRENCY -/** define if IPv6 is not disabled */ -#undef WANT_IPV6 - /** define if flockfile() is available */ #undef HAVE_FLOCKFILE diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index d3837db9a3..6c77ce7e58 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -138,11 +138,7 @@ else TESTSOCK6=false fi -if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then - TESTSOCK6="$TESTSOCK6" -else - TESTSOCK6=false -fi +TESTSOCK6="$TESTSOCK6" # Windows process management leave empty PSSUSPEND= diff --git a/bin/tests/system/conf.sh.win32 b/bin/tests/system/conf.sh.win32 index 6b5c8639b7..4335cd60a7 100644 --- a/bin/tests/system/conf.sh.win32 +++ b/bin/tests/system/conf.sh.win32 @@ -107,7 +107,7 @@ PARALLELDIRS="allow_query catz rpzrecurse serve-stale" SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS" # missing: chain integrity -# extra: dname ednscompliance forward +# extra: dname ednscompliance forward #Things that are different on Windows KILL="/bin/kill -f" @@ -117,7 +117,7 @@ DOS2UNIX=dos2unix TP= # Configure is launched from native environment, but tests are run in Cygwin - -# so any detection is unreliable. +# so any detection is unreliable. SHELL="/bin/bash -o igncr" CURL=/usr/bin/curl XMLLINT=/usr/bin/xmllint @@ -135,11 +135,7 @@ else TESTSOCK6=false fi -if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then - TESTSOCK6="$TESTSOCK6" -else - TESTSOCK6=false -fi +TESTSOCK6="$TESTSOCK6" # # PsSuspend is part of PSTools and can be downloaded from diff --git a/config.h.in b/config.h.in index 8823a42ddc..f94ef6ea3b 100644 --- a/config.h.in +++ b/config.h.in @@ -65,9 +65,6 @@ */ #undef CALL_PTHREAD_SETCONCURRENCY -/** define if IPv6 is not disabled */ -#undef WANT_IPV6 - /** define if flockfile() is available */ #undef HAVE_FLOCKFILE diff --git a/config.h.win32 b/config.h.win32 index a907da5a0c..85510eeb0d 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -141,8 +141,6 @@ char *getpassphrase(const char *); */ #define ISC_DLZ_DLOPEN 1 -#define WANT_IPV6 - #define S_IFMT _S_IFMT /* file type mask */ #define S_IFDIR _S_IFDIR /* directory */ #define S_IFCHR _S_IFCHR /* character special */ diff --git a/configure b/configure index 6f2d3ea112..cd89b5726c 100755 --- a/configure +++ b/configure @@ -968,7 +968,6 @@ with_purify with_gperftools_profiler enable_backtrace enable_symtable -enable_ipv6 with_kame enable_tcp_fastopen enable_getifaddrs @@ -1660,7 +1659,6 @@ Optional Features: --enable-backtrace log stack backtrace on abort [default=yes] --enable-symtable use internal symbol table for backtrace [all|minimal(default)|none] - --enable-ipv6 use IPv6 [default=autodetect] --disable-tcp-fastopen disable TCP Fast Open support [default=autodetect] --enable-getifaddrs enable the use of getifaddrs() [yes|no]. --disable-isc-spnego use SPNEGO from GSSAPI library @@ -17838,24 +17836,6 @@ BIND9_CO_RULE=".c.$O:" # capabilities. The order of the tests is significant. # -# -# IPv6 -# -# Check whether --enable-ipv6 was given. -if test "${enable_ipv6+set}" = set; then : - enableval=$enable_ipv6; -fi - - -case "$enable_ipv6" in - yes|''|autodetect) - $as_echo "#define WANT_IPV6 1" >>confdefs.h - - ;; - no) - ;; -esac - # # We do the IPv6 compilation checking after libtool so that we can put # the right suffix on the files. @@ -25469,8 +25449,7 @@ report() { # these lines are only printed if run with --enable-full-report if test "yes" = "$enable_full_report"; then - test "no" = "$enable_ipv6" -o "no" = "$found_ipv6" || \ - echo " IPv6 support (--enable-ipv6)" + test "no" = "$found_ipv6" || echo " IPv6 support (--enable-ipv6)" test "X$PYTHON" = "X" || echo " Python tools (--with-python)" test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)" test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)" @@ -25521,8 +25500,7 @@ report() { echo "-------------------------------------------------------------------------------" echo "Features disabled or unavailable on this platform:" - test "no" = "$enable_ipv6" -o "no" = "$found_ipv6" && \ - echo " IPv6 support (--enable-ipv6)" + test "no" = "$found_ipv6" && echo " IPv6 support (--enable-ipv6)" test "large" = "$use_tuning" || echo " Large-system tuning (--with-tuning)" test "no" = "$use_dnstap" && \ diff --git a/configure.in b/configure.in index 5fcc85117c..c77651a57e 100644 --- a/configure.in +++ b/configure.in @@ -1930,20 +1930,6 @@ AC_SUBST(BIND9_CO_RULE) # capabilities. The order of the tests is significant. # -# -# IPv6 -# -AC_ARG_ENABLE(ipv6, - AS_HELP_STRING([--enable-ipv6], [use IPv6 [default=autodetect]])) - -case "$enable_ipv6" in - yes|''|autodetect) - AC_DEFINE(WANT_IPV6) - ;; - no) - ;; -esac - # # We do the IPv6 compilation checking after libtool so that we can put # the right suffix on the files. @@ -4035,8 +4021,7 @@ report() { # these lines are only printed if run with --enable-full-report if test "yes" = "$enable_full_report"; then - test "no" = "$enable_ipv6" -o "no" = "$found_ipv6" || \ - echo " IPv6 support (--enable-ipv6)" + test "no" = "$found_ipv6" || echo " IPv6 support (--enable-ipv6)" test "X$PYTHON" = "X" || echo " Python tools (--with-python)" test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)" test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)" @@ -4087,8 +4072,7 @@ report() { echo "-------------------------------------------------------------------------------" echo "Features disabled or unavailable on this platform:" - test "no" = "$enable_ipv6" -o "no" = "$found_ipv6" && \ - echo " IPv6 support (--enable-ipv6)" + test "no" = "$found_ipv6" && echo " IPv6 support (--enable-ipv6)" test "large" = "$use_tuning" || echo " Large-system tuning (--with-tuning)" test "no" = "$use_dnstap" && \ diff --git a/lib/isc/tests/socket_test.c b/lib/isc/tests/socket_test.c index 84627a143e..679c47cda4 100644 --- a/lib/isc/tests/socket_test.c +++ b/lib/isc/tests/socket_test.c @@ -412,7 +412,7 @@ ATF_TC_HEAD(udp_dscp_v6, tc) { atf_tc_set_md_var(tc, "descr", "udp dscp ipv6"); } ATF_TC_BODY(udp_dscp_v6, tc) { -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6) +#if defined(ISC_PLATFORM_HAVEIPV6) isc_result_t result; isc_sockaddr_t addr1, addr2; struct in6_addr in6; diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 0064f1a219..ed4eb05180 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -102,13 +102,11 @@ const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT; const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT; # endif -# if defined(WANT_IPV6) static isc_once_t once_ipv6only = ISC_ONCE_INIT; # if defined(ISC_PLATFORM_HAVEIN6PKTINFO) static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; # endif -# endif /* WANT_IPV6 */ #endif /* ISC_PLATFORM_HAVEIPV6 */ #ifndef ISC_CMSG_IP_TOS @@ -165,7 +163,6 @@ try_proto(int domain) { } #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO if (domain == PF_INET6) { struct sockaddr_in6 sin6; @@ -205,7 +202,6 @@ try_proto(int domain) { } } #endif -#endif #endif (void)close(s); @@ -217,12 +213,10 @@ static void initialize_action(void) { ipv4_result = try_proto(PF_INET); #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO ipv6_result = try_proto(PF_INET6); #endif #endif -#endif #ifdef ISC_PLATFORM_HAVESYSUNH unix_result = try_proto(PF_UNIX); #endif @@ -252,7 +246,6 @@ isc_net_probeunix(void) { } #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 static void try_ipv6only(void) { #ifdef IPV6_V6ONLY @@ -328,10 +321,8 @@ initialize_ipv6only(void) { RUNTIME_CHECK(isc_once_do(&once_ipv6only, try_ipv6only) == ISC_R_SUCCESS); } -#endif /* WANT_IPV6 */ #ifdef ISC_PLATFORM_HAVEIN6PKTINFO -#ifdef WANT_IPV6 static void try_ipv6pktinfo(void) { int s, on; @@ -383,18 +374,13 @@ initialize_ipv6pktinfo(void) { RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo, try_ipv6pktinfo) == ISC_R_SUCCESS); } -#endif /* WANT_IPV6 */ #endif /* ISC_PLATFORM_HAVEIN6PKTINFO */ #endif /* ISC_PLATFORM_HAVEIPV6 */ isc_result_t isc_net_probe_ipv6only(void) { #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 initialize_ipv6only(); -#else - ipv6only_result = ISC_R_NOTFOUND; -#endif #endif return (ipv6only_result); } @@ -403,18 +389,14 @@ isc_result_t isc_net_probe_ipv6pktinfo(void) { #ifdef ISC_PLATFORM_HAVEIPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO -#ifdef WANT_IPV6 initialize_ipv6pktinfo(); -#else - ipv6pktinfo_result = ISC_R_NOTFOUND; -#endif #endif #endif return (ipv6pktinfo_result); } #if ISC_CMSG_IP_TOS || \ - defined(ISC_NET_BSD44MSGHDR) && defined(IPV6_TCLASS) && defined(WANT_IPV6) + defined(ISC_NET_BSD44MSGHDR) && defined(IPV6_TCLASS) static inline ISC_SOCKADDR_LEN_T cmsg_len(ISC_SOCKADDR_LEN_T len) { @@ -691,7 +673,6 @@ try_dscp_v4(void) { static void try_dscp_v6(void) { #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 #ifdef IPV6_TCLASS char strbuf[ISC_STRERRORSIZE]; struct addrinfo hints, *res0; @@ -745,7 +726,6 @@ try_dscp_v6(void) { close(s); #endif /* IPV6_TCLASS */ -#endif /* WANT_IPV6 */ #endif /* ISC_PLATFORM_HAVEIPV6 */ } diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index c49bb6bedd..1a6f086437 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -91,12 +91,10 @@ initialize_action(void) { InitSockets(); ipv4_result = try_proto(PF_INET); #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO ipv6_result = try_proto(PF_INET6); #endif #endif -#endif } static void @@ -122,7 +120,6 @@ isc_net_probeunix(void) { } #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 static void try_ipv6only(void) { #ifdef IPV6_V6ONLY @@ -262,17 +259,12 @@ initialize_ipv6pktinfo(void) { try_ipv6pktinfo) == ISC_R_SUCCESS); } #endif /* __notyet__ */ -#endif /* WANT_IPV6 */ #endif /* ISC_PLATFORM_HAVEIPV6 */ isc_result_t isc_net_probe_ipv6only(void) { #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 initialize_ipv6only(); -#else - ipv6only_result = ISC_R_NOTFOUND; -#endif #endif return (ipv6only_result); } @@ -281,11 +273,7 @@ isc_result_t isc_net_probe_ipv6pktinfo(void) { #ifdef __notyet__ #ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 initialize_ipv6pktinfo(); -#else - ipv6pktinfo_result = ISC_R_NOTFOUND; -#endif #endif #endif /* __notyet__ */ return (ipv6pktinfo_result); diff --git a/lib/ns/interfacemgr.c b/lib/ns/interfacemgr.c index 3bc582ef71..6f1b0d591a 100644 --- a/lib/ns/interfacemgr.c +++ b/lib/ns/interfacemgr.c @@ -862,12 +862,10 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, if (isc_net_probeipv6() == ISC_R_SUCCESS) scan_ipv6 = true; -#ifdef WANT_IPV6 else if ((mgr->sctx->options & NS_SERVER_DISABLE6) == 0) isc_log_write(IFMGR_COMMON_LOGARGS, verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1), "no IPv6 interfaces found"); -#endif if (isc_net_probeipv4() == ISC_R_SUCCESS) scan_ipv4 = true; From 7b21bbb7c17136226040dccadf7163016301407d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:50:23 +0200 Subject: [PATCH 10/30] Require IPv6 support from the OS --- configure | 226 +++++++++++------------- configure.in | 185 ++++++++++--------- lib/isc/Makefile.in | 2 +- lib/isc/include/isc/ipv6.h | 134 -------------- lib/isc/include/isc/platform.h.in | 6 - lib/isc/tests/socket_test.c | 10 -- lib/isc/unix/Makefile.in | 4 +- lib/isc/unix/ifiter_ioctl.c | 8 - lib/isc/unix/include/isc/net.h | 10 +- lib/isc/unix/ipv6.c | 20 --- lib/isc/unix/net.c | 26 +-- lib/isc/unix/socket.c | 4 - lib/isc/win32/include/isc/platform.h.in | 1 - lib/isc/win32/net.c | 10 +- lib/isc/win32/socket.c | 4 - 15 files changed, 208 insertions(+), 442 deletions(-) delete mode 100644 lib/isc/include/isc/ipv6.h delete mode 100644 lib/isc/unix/ipv6.c diff --git a/configure b/configure index cd89b5726c..9ea0cf99a7 100755 --- a/configure +++ b/configure @@ -748,16 +748,11 @@ ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVESCOPEID -ISC_IPV6_C -ISC_ISCIPV6_O -ISC_IPV6_O -ISC_IPV6_H ISC_PLATFORM_HAVESOCKADDRSTORAGE ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_HAVEINADDR6 -ISC_PLATFORM_HAVEIPV6 BIND9_CO_RULE LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL @@ -17845,13 +17840,16 @@ $as_echo_n "checking for IPv6 structures... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include + #include + #include + #include + int main () { -struct sockaddr_in6 sin6; return (0); + + struct sockaddr_in6 sin6; return (0); + ; return 0; } @@ -17859,11 +17857,11 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - found_ipv6=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - found_ipv6=no + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "IPv6 support is mandatory +See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -17914,26 +17912,21 @@ Please choose the proper path with the following command: ;; esac -# -# Now delve deeper into the suitability of the IPv6 support. -# -case "$found_ipv6" in - yes) - ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_addr" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_addr" >&5 $as_echo_n "checking for in6_addr... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include + #include + #include + #include int main () { -struct in6_addr in6; return (0); + + struct in6_addr in6; return (0); + ; return 0; } @@ -17941,89 +17934,32 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6" - isc_in_addr6_hack="" + ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6" + isc_in_addr6_hack="" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1" - isc_in_addr6_hack="#define in6_addr in_addr6" + ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1" + isc_in_addr6_hack="#define in6_addr in_addr6" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_any" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_any" >&5 $as_echo_n "checking for in6addr_any... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -$isc_in_addr6_hack + #include + #include + #include + $isc_in_addr6_hack int main () { -struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_loopback" >&5 -$as_echo_n "checking for in6addr_loopback... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]); -#include -#include -#include -$isc_in_addr6_hack - -int -main () -{ -struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin6_scope_id in struct sockaddr_in6" >&5 -$as_echo_n "checking for sin6_scope_id in struct sockaddr_in6... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int -main () -{ -struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0); ; return 0; } @@ -18031,27 +17967,30 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1" + ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID" + ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_pktinfo" >&5 -$as_echo_n "checking for in6_pktinfo... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_loopback" >&5 +$as_echo_n "checking for in6addr_loopback... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include + #include + #include + #include + $isc_in_addr6_hack int main () { -struct in6_pktinfo xyzzy; return (0); + + struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]); + ; return 0; } @@ -18059,25 +17998,73 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1" + ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin6_scope_id in struct sockaddr_in6" >&5 +$as_echo_n "checking for sin6_scope_id in struct sockaddr_in6... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + +int +main () +{ + + struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_pktinfo" >&5 +$as_echo_n "checking for in6_pktinfo... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + +int +main () +{ + + struct in6_pktinfo xyzzy; return (0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- disabling runtime ipv6 support" >&5 $as_echo "no -- disabling runtime ipv6 support" >&6; } - ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO" + ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - no) - ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6" - ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY" - ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO" - ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1" - ISC_IPV6_H="ipv6.h" - ISC_IPV6_O="ipv6.$O" - ISC_ISCIPV6_O="unix/ipv6.$O" - ISC_IPV6_C="ipv6.c" - ;; -esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 $as_echo_n "checking for struct sockaddr_storage... " >&6; } @@ -18114,11 +18101,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index c77651a57e..2dbb8fc586 100644 --- a/configure.in +++ b/configure.in @@ -1934,16 +1934,19 @@ AC_SUBST(BIND9_CO_RULE) # We do the IPv6 compilation checking after libtool so that we can put # the right suffix on the files. # -AC_MSG_CHECKING(for IPv6 structures) -AC_TRY_COMPILE([ -#include -#include -#include ], -[struct sockaddr_in6 sin6; return (0);], - [AC_MSG_RESULT(yes) - found_ipv6=yes], - [AC_MSG_RESULT(no) - found_ipv6=no]) +AC_MSG_CHECKING([for IPv6 structures]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + ]], + [[ + struct sockaddr_in6 sin6; return (0); + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_FAILURE([IPv6 support is mandatory])]) # # See whether IPv6 support is provided via a Kame add-on. @@ -1985,88 +1988,89 @@ Please choose the proper path with the following command: ;; esac -# -# Now delve deeper into the suitability of the IPv6 support. -# -case "$found_ipv6" in - yes) - ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1" +AC_MSG_CHECKING([for in6_addr]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + ]], + [[ + struct in6_addr in6; return (0); + ]])], + [AC_MSG_RESULT([yes]) + ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6" + isc_in_addr6_hack=""], + [AC_MSG_RESULT([no]) + ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1" + isc_in_addr6_hack="#define in6_addr in_addr6"]) - AC_MSG_CHECKING(for in6_addr) - AC_TRY_COMPILE([ -#include -#include -#include -], -[struct in6_addr in6; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6" - isc_in_addr6_hack=""], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1" - isc_in_addr6_hack="#define in6_addr in_addr6"]) +AC_MSG_CHECKING([for in6addr_any]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + $isc_in_addr6_hack + ]], + [[ + struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]); + ]])], + [AC_MSG_RESULT([yes]) + ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"], + [AC_MSG_RESULT([no]) + ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"]) - AC_MSG_CHECKING(for in6addr_any) - AC_TRY_LINK([ -#include -#include -#include -$isc_in_addr6_hack -], - [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"]) +AC_MSG_CHECKING([for in6addr_loopback]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + $isc_in_addr6_hack + ]], + [[ + struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]); + ]])], + [AC_MSG_RESULT(yes) + ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"], + [AC_MSG_RESULT(no) + ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"]) - AC_MSG_CHECKING(for in6addr_loopback) - AC_TRY_LINK([ -#include -#include -#include -$isc_in_addr6_hack -], - [struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"]) +AC_MSG_CHECKING([for sin6_scope_id in struct sockaddr_in6]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + ]], + [[ + struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0); + ]])], + [AC_MSG_RESULT([yes]) + ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"], + [AC_MSG_RESULT([no]) + ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"]) - AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6) - AC_TRY_COMPILE([ -#include -#include -#include -], - [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"]) - - AC_MSG_CHECKING(for in6_pktinfo) - AC_TRY_COMPILE([ -#include -#include -#include -], - [struct in6_pktinfo xyzzy; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"], - [AC_MSG_RESULT(no -- disabling runtime ipv6 support) - ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"]) - ;; - no) - ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6" - ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY" - ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO" - ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1" - ISC_IPV6_H="ipv6.h" - ISC_IPV6_O="ipv6.$O" - ISC_ISCIPV6_O="unix/ipv6.$O" - ISC_IPV6_C="ipv6.c" - ;; -esac +AC_MSG_CHECKING([for in6_pktinfo]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + ]], + [[ + struct in6_pktinfo xyzzy; return (0); + ]])], + [AC_MSG_RESULT(yes) + ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"], + [AC_MSG_RESULT(no -- disabling runtime ipv6 support) + ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"]) AC_MSG_CHECKING(for struct sockaddr_storage) AC_TRY_COMPILE([ @@ -2079,16 +2083,11 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], [AC_MSG_RESULT(no) ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) -AC_SUBST(ISC_PLATFORM_HAVEIPV6) AC_SUBST(ISC_PLATFORM_HAVEINADDR6) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) -AC_SUBST(ISC_IPV6_H) -AC_SUBST(ISC_IPV6_O) -AC_SUBST(ISC_ISCIPV6_O) -AC_SUBST(ISC_IPV6_C) AC_SUBST(ISC_PLATFORM_HAVESCOPEID) AC_MSG_CHECKING([for struct if_laddrreq]) diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 010fc65b5e..d4e316865a 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -26,7 +26,7 @@ CDEFINES = CWARNINGS = # Alphabetically -UNIXOBJS = @ISC_ISCIPV6_O@ unix/pk11_api.@O@ \ +UNIXOBJS = unix/pk11_api.@O@ \ unix/app.@O@ unix/dir.@O@ unix/errno.@O@ \ unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \ unix/interfaceiter.@O@ unix/keyboard.@O@ unix/meminfo.@O@ \ diff --git a/lib/isc/include/isc/ipv6.h b/lib/isc/include/isc/ipv6.h deleted file mode 100644 index 0d69379e36..0000000000 --- a/lib/isc/include/isc/ipv6.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#ifndef ISC_IPV6_H -#define ISC_IPV6_H 1 - -/***** - ***** Module Info - *****/ - -/*! \file isc/ipv6.h - * \brief IPv6 definitions for systems which do not support IPv6. - * - * \li MP: - * No impact. - * - * \li Reliability: - * No anticipated impact. - * - * \li Resources: - * N/A. - * - * \li Security: - * No anticipated impact. - * - * \li Standards: - * RFC2553. - */ - -/*** - *** Imports. - ***/ - -#include -#include - -/*** - *** Types. - ***/ - -struct in6_addr { - union { - uint8_t _S6_u8[16]; - uint16_t _S6_u16[8]; - uint32_t _S6_u32[4]; - } _S6_un; -}; -#define s6_addr _S6_un._S6_u8 -#define s6_addr8 _S6_un._S6_u8 -#define s6_addr16 _S6_un._S6_u16 -#define s6_addr32 _S6_un._S6_u32 - -#define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}} -#define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}} - -LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_any; -LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback; - -struct sockaddr_in6 { -#ifdef ISC_PLATFORM_HAVESALEN - uint8_t sin6_len; - uint8_t sin6_family; -#else - uint16_t sin6_family; -#endif - uint16_t sin6_port; - uint32_t sin6_flowinfo; - struct in6_addr sin6_addr; - uint32_t sin6_scope_id; -}; - -#ifdef ISC_PLATFORM_HAVESALEN -#define SIN6_LEN 1 -#endif - -/*% - * Unspecified - */ -#define IN6_IS_ADDR_UNSPECIFIED(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == 0) && \ - ((a)->s6_addr32[3] == 0)) - -/*% - * Loopback - */ -#define IN6_IS_ADDR_LOOPBACK(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == 0) && \ - ((a)->s6_addr32[3] == htonl(1))) - -/*% - * IPv4 compatible - */ -#define IN6_IS_ADDR_V4COMPAT(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == 0) && \ - ((a)->s6_addr32[3] != 0) && \ - ((a)->s6_addr32[3] != htonl(1))) - -/*% - * Mapped - */ -#define IN6_IS_ADDR_V4MAPPED(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == htonl(0x0000ffff))) - -/*% - * Multicast - */ -#define IN6_IS_ADDR_MULTICAST(a) \ - ((a)->s6_addr8[0] == 0xffU) - -/*% - * Unicast link / site local. - */ -#define IN6_IS_ADDR_LINKLOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) -#define IN6_IS_ADDR_SITELOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) - -#endif /* ISC_IPV6_H */ diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 5f10e621fe..3cc5b89e1f 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,12 +36,6 @@ */ @ISC_PLATFORM_HAVESALEN@ -/*! \brief - * If this system has the IPv6 structure definitions, ISC_PLATFORM_HAVEIPV6 - * will be defined. - */ -@ISC_PLATFORM_HAVEIPV6@ - /*! \brief * If this system is missing in6addr_any, ISC_PLATFORM_NEEDIN6ADDRANY will * be defined. diff --git a/lib/isc/tests/socket_test.c b/lib/isc/tests/socket_test.c index 679c47cda4..1bfe65f3a2 100644 --- a/lib/isc/tests/socket_test.c +++ b/lib/isc/tests/socket_test.c @@ -412,7 +412,6 @@ ATF_TC_HEAD(udp_dscp_v6, tc) { atf_tc_set_md_var(tc, "descr", "udp dscp ipv6"); } ATF_TC_BODY(udp_dscp_v6, tc) { -#if defined(ISC_PLATFORM_HAVEIPV6) isc_result_t result; isc_sockaddr_t addr1, addr2; struct in6_addr in6; @@ -508,10 +507,6 @@ ATF_TC_BODY(udp_dscp_v6, tc) { isc_socket_detach(&s2); isc_test_end(); -#else - UNUSED(tc); - atf_tc_skip("IPv6 not available"); -#endif } /* Test TCP sendto/recv (IPv4) */ @@ -618,7 +613,6 @@ ATF_TC_HEAD(tcp_dscp_v6, tc) { atf_tc_set_md_var(tc, "descr", "tcp dscp ipv6"); } ATF_TC_BODY(tcp_dscp_v6, tc) { -#ifdef ISC_PLATFORM_HAVEIPV6 isc_result_t result; isc_sockaddr_t addr1; struct in6_addr in6; @@ -717,10 +711,6 @@ ATF_TC_BODY(tcp_dscp_v6, tc) { isc_socket_detach(&s3); isc_test_end(); -#else - UNUSED(tc); - atf_tc_skip("IPv6 not available"); -#endif } ATF_TC(net_probedscp); diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in index c558494825..190540cdaf 100644 --- a/lib/isc/unix/Makefile.in +++ b/lib/isc/unix/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = CWARNINGS = # Alphabetically -OBJS = @ISC_IPV6_O@ pk11_api.@O@ \ +OBJS = pk11_api.@O@ \ app.@O@ dir.@O@ errno.@O@ errno2result.@O@ \ file.@O@ fsaccess.@O@ interfaceiter.@O@ \ keyboard.@O@ meminfo.@O@ \ @@ -29,7 +29,7 @@ OBJS = @ISC_IPV6_O@ pk11_api.@O@ \ strerror.@O@ syslog.@O@ time.@O@ # Alphabetically -SRCS = @ISC_IPV6_C@ pk11_api.c \ +SRCS = pk11_api.c \ app.c dir.c errno.c errno2result.c \ file.c fsaccess.c interfaceiter.c keyboard.c meminfo.c \ net.c os.c resource.c socket.c stdio.c stdtime.c \ diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index 08143ae25a..fcccb7946d 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -397,11 +397,7 @@ internal_current4(isc_interfaceiter_t *iter) { memmove(&ifreq, ifrp, sizeof(ifreq)); family = ifreq.ifr_addr.sa_family; -#if defined(ISC_PLATFORM_HAVEIPV6) if (family != AF_INET && family != AF_INET6) -#else - if (family != AF_INET) -#endif return (ISC_R_IGNORE); memset(&iter->current, 0, sizeof(iter->current)); @@ -581,11 +577,7 @@ internal_current6(isc_interfaceiter_t *iter) { memmove(&lifreq, ifrp, sizeof(lifreq)); family = lifreq.lifr_addr.ss_family; -#ifdef ISC_PLATFORM_HAVEIPV6 if (family != AF_INET && family != AF_INET6) -#else - if (family != AF_INET) -#endif return (ISC_R_IGNORE); memset(&iter->current, 0, sizeof(iter->current)); diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 68e73a8166..e8ea2dab55 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -77,10 +77,6 @@ #include /* Contractual promise. */ #include /* Contractual promise. */ -#ifndef ISC_PLATFORM_HAVEIPV6 -#include /* Contractual promise. */ -#endif - #include #include @@ -88,7 +84,6 @@ #define in6_addr in_addr6 /*%< Required for pre RFC2133 implementations. */ #endif -#ifdef ISC_PLATFORM_HAVEIPV6 #ifndef IN6ADDR_ANY_INIT #ifdef s6_addr /*% @@ -161,7 +156,6 @@ #define IN6_IS_ADDR_LOOPBACK(x) \ (memcmp((x)->s6_addr, in6addr_loopback.s6_addr, 16) == 0) #endif -#endif #ifndef AF_INET6 /*% IPv6 */ @@ -218,7 +212,7 @@ struct sockaddr_storage { }; #endif -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) +#if defined(ISC_PLATFORM_NEEDIN6ADDRANY) extern const struct in6_addr isc_net_in6addrany; /*% * Cope with a missing in6addr_any and in6addr_loopback. @@ -226,7 +220,7 @@ extern const struct in6_addr isc_net_in6addrany; #define in6addr_any isc_net_in6addrany #endif -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) +#if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) extern const struct in6_addr isc_net_in6addrloop; #define in6addr_loopback isc_net_in6addrloop #endif diff --git a/lib/isc/unix/ipv6.c b/lib/isc/unix/ipv6.c deleted file mode 100644 index eb77377aac..0000000000 --- a/lib/isc/unix/ipv6.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -/*! \file */ - -#include - -#include - -const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; -const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index ed4eb05180..5529fb6351 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -93,21 +93,19 @@ #endif /* HAVE_SYSCTLBYNAME */ -#if defined(ISC_PLATFORM_HAVEIPV6) -# if defined(ISC_PLATFORM_NEEDIN6ADDRANY) +#if defined(ISC_PLATFORM_NEEDIN6ADDRANY) const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT; -# endif +#endif -# if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) +#if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT; -# endif +#endif static isc_once_t once_ipv6only = ISC_ONCE_INIT; -# if defined(ISC_PLATFORM_HAVEIN6PKTINFO) +#if defined(ISC_PLATFORM_HAVEIN6PKTINFO) static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; -# endif -#endif /* ISC_PLATFORM_HAVEIPV6 */ +#endif #ifndef ISC_CMSG_IP_TOS #ifdef __APPLE__ @@ -162,7 +160,6 @@ try_proto(int domain) { } } -#ifdef ISC_PLATFORM_HAVEIPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO if (domain == PF_INET6) { struct sockaddr_in6 sin6; @@ -201,7 +198,6 @@ try_proto(int domain) { } } } -#endif #endif (void)close(s); @@ -212,11 +208,9 @@ try_proto(int domain) { static void initialize_action(void) { ipv4_result = try_proto(PF_INET); -#ifdef ISC_PLATFORM_HAVEIPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO ipv6_result = try_proto(PF_INET6); #endif -#endif #ifdef ISC_PLATFORM_HAVESYSUNH unix_result = try_proto(PF_UNIX); #endif @@ -245,7 +239,6 @@ isc_net_probeunix(void) { return (unix_result); } -#ifdef ISC_PLATFORM_HAVEIPV6 static void try_ipv6only(void) { #ifdef IPV6_V6ONLY @@ -375,22 +368,17 @@ initialize_ipv6pktinfo(void) { try_ipv6pktinfo) == ISC_R_SUCCESS); } #endif /* ISC_PLATFORM_HAVEIN6PKTINFO */ -#endif /* ISC_PLATFORM_HAVEIPV6 */ isc_result_t isc_net_probe_ipv6only(void) { -#ifdef ISC_PLATFORM_HAVEIPV6 initialize_ipv6only(); -#endif return (ipv6only_result); } isc_result_t isc_net_probe_ipv6pktinfo(void) { -#ifdef ISC_PLATFORM_HAVEIPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO initialize_ipv6pktinfo(); -#endif #endif return (ipv6pktinfo_result); } @@ -672,7 +660,6 @@ try_dscp_v4(void) { static void try_dscp_v6(void) { -#ifdef ISC_PLATFORM_HAVEIPV6 #ifdef IPV6_TCLASS char strbuf[ISC_STRERRORSIZE]; struct addrinfo hints, *res0; @@ -726,7 +713,6 @@ try_dscp_v6(void) { close(s); #endif /* IPV6_TCLASS */ -#endif /* ISC_PLATFORM_HAVEIPV6 */ } static void diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 734b3f4386..2fc4da95c0 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -2325,7 +2325,6 @@ set_rcvbuf(void) { ISC_SOCKADDR_LEN_T len; fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -#if defined(ISC_PLATFORM_HAVEIPV6) if (fd == -1) { switch (errno) { case EPROTONOSUPPORT: @@ -2340,7 +2339,6 @@ set_rcvbuf(void) { break; } } -#endif if (fd == -1) return; @@ -2673,7 +2671,6 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, } #endif /* SO_TIMESTAMP */ -#if defined(ISC_PLATFORM_HAVEIPV6) #ifdef ISC_PLATFORM_HAVEIN6PKTINFO #ifdef IPV6_RECVPKTINFO /* RFC 3542 */ @@ -2718,7 +2715,6 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, sizeof(action)); } #endif -#endif /* ISC_PLATFORM_HAVEIPV6 */ #endif /* defined(USE_CMSG) */ #if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT) diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 691ac00122..56eddd820f 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -42,7 +42,6 @@ #define PATH_MAX _MAX_PATH #endif -#define ISC_PLATFORM_HAVEIPV6 #if _MSC_VER > 1200 #define ISC_PLATFORM_HAVEIN6PKTINFO #endif diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index 1a6f086437..173d7bb871 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -40,7 +40,7 @@ #define ISC_NET_PORTRANGEHIGH 65535 #endif /* ISC_NET_PORTRANGEHIGH */ -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) +#if defined(ISC_PLATFORM_NEEDIN6ADDRANY) const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT; #endif @@ -90,11 +90,9 @@ static void initialize_action(void) { InitSockets(); ipv4_result = try_proto(PF_INET); -#ifdef ISC_PLATFORM_HAVEIPV6 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO ipv6_result = try_proto(PF_INET6); #endif -#endif } static void @@ -119,7 +117,6 @@ isc_net_probeunix(void) { return (ISC_R_NOTFOUND); } -#ifdef ISC_PLATFORM_HAVEIPV6 static void try_ipv6only(void) { #ifdef IPV6_V6ONLY @@ -259,22 +256,17 @@ initialize_ipv6pktinfo(void) { try_ipv6pktinfo) == ISC_R_SUCCESS); } #endif /* __notyet__ */ -#endif /* ISC_PLATFORM_HAVEIPV6 */ isc_result_t isc_net_probe_ipv6only(void) { -#ifdef ISC_PLATFORM_HAVEIPV6 initialize_ipv6only(); -#endif return (ipv6only_result); } isc_result_t isc_net_probe_ipv6pktinfo(void) { #ifdef __notyet__ -#ifdef ISC_PLATFORM_HAVEIPV6 initialize_ipv6pktinfo(); -#endif #endif /* __notyet__ */ return (ipv6pktinfo_result); } diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 1209292dfb..f89d323589 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -188,11 +188,9 @@ enum { * to collect the destination address and interface so the client can * set them on outgoing packets. */ -#ifdef ISC_PLATFORM_HAVEIPV6 #ifndef USE_CMSG #define USE_CMSG 1 #endif -#endif /* * We really don't want to try and use these control messages. Win32 @@ -1754,7 +1752,6 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, if (type == isc_sockettype_udp) { #if defined(USE_CMSG) -#if defined(ISC_PLATFORM_HAVEIPV6) #ifdef IPV6_RECVPKTINFO /* 2292bis */ if ((pf == AF_INET6) @@ -1786,7 +1783,6 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, strbuf); } #endif /* IPV6_RECVPKTINFO */ -#endif /* ISC_PLATFORM_HAVEIPV6 */ #endif /* defined(USE_CMSG) */ #if defined(SO_RCVBUF) From 243a347d60fc5c57c9769cbbebbfe679732b6488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:51:57 +0200 Subject: [PATCH 11/30] Remove support for legacy KAME IPv6 stack --- README.md | 4 ---- configure | 49 ------------------------------------------------- configure.in | 40 ---------------------------------------- 3 files changed, 93 deletions(-) diff --git a/README.md b/README.md index 0d9bf0f1d8..fc76e44096 100644 --- a/README.md +++ b/README.md @@ -271,10 +271,6 @@ specifying `--enable-fixed-rrset` or `--disable-fixed-rrset` on the configure command line. By default, fixed rrset-order is disabled to reduce memory footprint. -If your operating system has integrated support for IPv6, it will be used -automatically. If you have installed KAME IPv6 separately, use -`--with-kame[=PATH]` to specify its location. - `make install` will install `named` and the various BIND 9 libraries. By default, installation is into /usr/local, but this can be changed with the `--prefix` option when running `configure`. diff --git a/configure b/configure index 9ea0cf99a7..f99bafcf0f 100755 --- a/configure +++ b/configure @@ -963,7 +963,6 @@ with_purify with_gperftools_profiler enable_backtrace enable_symtable -with_kame enable_tcp_fastopen enable_getifaddrs with_readline @@ -1706,7 +1705,6 @@ Optional Packages: --with-purify=PATH use Rational purify --with-gperftools-profiler use gperftools CPU profiler - --with-kame=PATH use Kame IPv6 [default path /usr/local/v6] --with-readline=LIBSPEC specify readline library [default auto] --with-dnsrps-libname DNSRPS provider library name (librpz.so) --with-dnsrps-dir path to DNSRPS provider library @@ -17865,53 +17863,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# See whether IPv6 support is provided via a Kame add-on. -# This is done before other IPv6 linking tests to LIBS is properly set. -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kame IPv6 support" >&5 -$as_echo_n "checking for Kame IPv6 support... " >&6; } - -# Check whether --with-kame was given. -if test "${with_kame+set}" = set; then : - withval=$with_kame; use_kame="$withval" -else - use_kame="no" -fi - - -case "$use_kame" in - no) - ;; - yes) - kame_path=/usr/local/v6 - ;; - *) - kame_path="$use_kame" - ;; -esac - -case "$use_kame" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - *) - if test -f $kame_path/lib/libinet6.a; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kame_path/lib/libinet6.a" >&5 -$as_echo "$kame_path/lib/libinet6.a" >&6; } - LIBS="-L$kame_path/lib -linet6 $LIBS" - else - as_fn_error $? "$kame_path/lib/libinet6.a not found. - -Please choose the proper path with the following command: - - configure --with-kame=PATH -" "$LINENO" 5 - fi - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_addr" >&5 $as_echo_n "checking for in6_addr... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index 2dbb8fc586..31944a7ce8 100644 --- a/configure.in +++ b/configure.in @@ -1948,46 +1948,6 @@ AC_COMPILE_IFELSE( [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -# -# See whether IPv6 support is provided via a Kame add-on. -# This is done before other IPv6 linking tests to LIBS is properly set. -# -AC_MSG_CHECKING(for Kame IPv6 support) -AC_ARG_WITH(kame, - AS_HELP_STRING([--with-kame[=PATH]], - [use Kame IPv6 [default path /usr/local/v6]]), - use_kame="$withval", use_kame="no") - -case "$use_kame" in - no) - ;; - yes) - kame_path=/usr/local/v6 - ;; - *) - kame_path="$use_kame" - ;; -esac - -case "$use_kame" in - no) - AC_MSG_RESULT(no) - ;; - *) - if test -f $kame_path/lib/libinet6.a; then - AC_MSG_RESULT($kame_path/lib/libinet6.a) - LIBS="-L$kame_path/lib -linet6 $LIBS" - else - AC_MSG_ERROR([$kame_path/lib/libinet6.a not found. - -Please choose the proper path with the following command: - - configure --with-kame=PATH -]) - fi - ;; -esac - AC_MSG_CHECKING([for in6_addr]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( From b962f47d3e1240527ddb3b47d891544f27dea24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 11:59:52 +0200 Subject: [PATCH 12/30] Remove support for pre-RFC2133 IPv6 implementation (in_addr6) --- configure | 34 ------------------------------- configure.in | 19 ----------------- lib/isc/include/isc/platform.h.in | 6 ------ lib/isc/unix/include/isc/net.h | 4 ---- 4 files changed, 63 deletions(-) diff --git a/configure b/configure index f99bafcf0f..d02ece934f 100755 --- a/configure +++ b/configure @@ -752,7 +752,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_NEEDIN6ADDRANY -ISC_PLATFORM_HAVEINADDR6 BIND9_CO_RULE LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL @@ -17863,38 +17862,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_addr" >&5 -$as_echo_n "checking for in6_addr... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - #include - -int -main () -{ - - struct in6_addr in6; return (0); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6" - isc_in_addr6_hack="" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1" - isc_in_addr6_hack="#define in6_addr in_addr6" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_any" >&5 $as_echo_n "checking for in6addr_any... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18051,7 +18018,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index 31944a7ce8..87cee59ba2 100644 --- a/configure.in +++ b/configure.in @@ -1948,24 +1948,6 @@ AC_COMPILE_IFELSE( [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING([for in6_addr]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include - #include - #include - ]], - [[ - struct in6_addr in6; return (0); - ]])], - [AC_MSG_RESULT([yes]) - ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6" - isc_in_addr6_hack=""], - [AC_MSG_RESULT([no]) - ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1" - isc_in_addr6_hack="#define in6_addr in_addr6"]) - AC_MSG_CHECKING([for in6addr_any]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -2043,7 +2025,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], [AC_MSG_RESULT(no) ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) -AC_SUBST(ISC_PLATFORM_HAVEINADDR6) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 3cc5b89e1f..8f5f029d10 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -54,12 +54,6 @@ */ @ISC_PLATFORM_HAVEIN6PKTINFO@ -/*! \brief - * If this system has in_addr6, rather than in6_addr, ISC_PLATFORM_HAVEINADDR6 - * will be defined. - */ -@ISC_PLATFORM_HAVEINADDR6@ - /*! \brief * If this system has sin6_scope_id, ISC_PLATFORM_HAVESCOPEID will be defined. */ diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index e8ea2dab55..cffd310eac 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -80,10 +80,6 @@ #include #include -#ifdef ISC_PLATFORM_HAVEINADDR6 -#define in6_addr in_addr6 /*%< Required for pre RFC2133 implementations. */ -#endif - #ifndef IN6ADDR_ANY_INIT #ifdef s6_addr /*% From 5083a42072c4afe5c12dd473782dbdbcd6860a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 12:54:15 +0200 Subject: [PATCH 13/30] Remove support for legacy systems without in6addr_any --- configure | 38 ++++--------------------------- configure.in | 23 ++++--------------- lib/isc/include/isc/platform.h.in | 6 ----- lib/isc/unix/include/isc/net.h | 23 ------------------- lib/isc/unix/net.c | 4 ---- lib/isc/win32/ipv6.c | 3 --- lib/isc/win32/net.c | 4 ---- 7 files changed, 8 insertions(+), 93 deletions(-) diff --git a/configure b/configure index d02ece934f..494dfa4ab7 100755 --- a/configure +++ b/configure @@ -751,7 +751,6 @@ ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVESOCKADDRSTORAGE ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_NEEDIN6ADDRLOOPBACK -ISC_PLATFORM_NEEDIN6ADDRANY BIND9_CO_RULE LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL @@ -17845,7 +17844,10 @@ int main () { - struct sockaddr_in6 sin6; return (0); + struct sockaddr_in6 sin6; + struct in6_addr in6; + in6 = in6addr_any; + return (0); ; return 0; @@ -17862,37 +17864,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_any" >&5 -$as_echo_n "checking for in6addr_any... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - #include - $isc_in_addr6_hack - -int -main () -{ - - struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_loopback" >&5 $as_echo_n "checking for in6addr_loopback... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18017,7 +17988,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index 87cee59ba2..696af20357 100644 --- a/configure.in +++ b/configure.in @@ -1943,28 +1943,14 @@ AC_COMPILE_IFELSE( #include ]], [[ - struct sockaddr_in6 sin6; return (0); + struct sockaddr_in6 sin6; + struct in6_addr in6; + in6 = in6addr_any; + return (0); ]])], [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING([for in6addr_any]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include - #include - #include - $isc_in_addr6_hack - ]], - [[ - struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]); - ]])], - [AC_MSG_RESULT([yes]) - ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"], - [AC_MSG_RESULT([no]) - ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"]) - AC_MSG_CHECKING([for in6addr_loopback]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -2025,7 +2011,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], [AC_MSG_RESULT(no) ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) -AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY) AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 8f5f029d10..47b1744df9 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,12 +36,6 @@ */ @ISC_PLATFORM_HAVESALEN@ -/*! \brief - * If this system is missing in6addr_any, ISC_PLATFORM_NEEDIN6ADDRANY will - * be defined. - */ -@ISC_PLATFORM_NEEDIN6ADDRANY@ - /*! \brief * If this system is missing in6addr_loopback, ISC_PLATFORM_NEEDIN6ADDRLOOPBACK * will be defined. diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index cffd310eac..aeed627eeb 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -80,21 +80,6 @@ #include #include -#ifndef IN6ADDR_ANY_INIT -#ifdef s6_addr -/*% - * Required for some pre RFC2133 implementations. - * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in - * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt. - * If 's6_addr' is defined then assume that there is a union and three - * levels otherwise assume two levels required. - */ -#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } -#else -#define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } -#endif -#endif - #ifndef IN6ADDR_LOOPBACK_INIT #ifdef s6_addr /*% IPv6 address loopback init */ @@ -208,14 +193,6 @@ struct sockaddr_storage { }; #endif -#if defined(ISC_PLATFORM_NEEDIN6ADDRANY) -extern const struct in6_addr isc_net_in6addrany; -/*% - * Cope with a missing in6addr_any and in6addr_loopback. - */ -#define in6addr_any isc_net_in6addrany -#endif - #if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) extern const struct in6_addr isc_net_in6addrloop; #define in6addr_loopback isc_net_in6addrloop diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 5529fb6351..baff6b49f7 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -93,10 +93,6 @@ #endif /* HAVE_SYSCTLBYNAME */ -#if defined(ISC_PLATFORM_NEEDIN6ADDRANY) -const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT; -#endif - #if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT; #endif diff --git a/lib/isc/win32/ipv6.c b/lib/isc/win32/ipv6.c index 048315e7fa..3e0eb37ed5 100644 --- a/lib/isc/win32/ipv6.c +++ b/lib/isc/win32/ipv6.c @@ -14,8 +14,5 @@ #include #include -LIBISC_EXTERNAL_DATA const struct in6_addr isc_in6addr_any = - IN6ADDR_ANY_INIT; - LIBISC_EXTERNAL_DATA const struct in6_addr isc_in6addr_loopback = IN6ADDR_LOOPBACK_INIT; diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index 173d7bb871..3ea4de3e26 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -40,10 +40,6 @@ #define ISC_NET_PORTRANGEHIGH 65535 #endif /* ISC_NET_PORTRANGEHIGH */ -#if defined(ISC_PLATFORM_NEEDIN6ADDRANY) -const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT; -#endif - static isc_once_t once = ISC_ONCE_INIT; static isc_once_t once_ipv6only = ISC_ONCE_INIT; static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; From 4150a8604684cfd0f1d01a38ea20cb81fd726622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 13:07:05 +0200 Subject: [PATCH 14/30] Remove support for legacy platforms without in6addr_loopback --- configure | 34 +------------------------------ configure.in | 19 +---------------- lib/isc/include/isc/platform.h.in | 6 ------ lib/isc/unix/include/isc/net.h | 5 ----- lib/isc/unix/net.c | 4 ---- 5 files changed, 2 insertions(+), 66 deletions(-) diff --git a/configure b/configure index 494dfa4ab7..ea8ebb7246 100755 --- a/configure +++ b/configure @@ -750,7 +750,6 @@ ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVESOCKADDRSTORAGE ISC_PLATFORM_HAVEIN6PKTINFO -ISC_PLATFORM_NEEDIN6ADDRLOOPBACK BIND9_CO_RULE LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL @@ -17847,6 +17846,7 @@ main () struct sockaddr_in6 sin6; struct in6_addr in6; in6 = in6addr_any; + in6 = in6addr_loopback; return (0); ; @@ -17864,37 +17864,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6addr_loopback" >&5 -$as_echo_n "checking for in6addr_loopback... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - #include - $isc_in_addr6_hack - -int -main () -{ - - struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin6_scope_id in struct sockaddr_in6" >&5 $as_echo_n "checking for sin6_scope_id in struct sockaddr_in6... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17987,7 +17956,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index 696af20357..52f761bd38 100644 --- a/configure.in +++ b/configure.in @@ -1946,28 +1946,12 @@ AC_COMPILE_IFELSE( struct sockaddr_in6 sin6; struct in6_addr in6; in6 = in6addr_any; + in6 = in6addr_loopback; return (0); ]])], [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING([for in6addr_loopback]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include - #include - #include - $isc_in_addr6_hack - ]], - [[ - struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]); - ]])], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"]) - AC_MSG_CHECKING([for sin6_scope_id in struct sockaddr_in6]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -2011,7 +1995,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], [AC_MSG_RESULT(no) ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) -AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) AC_SUBST(ISC_PLATFORM_HAVESCOPEID) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 47b1744df9..d8f783b623 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,12 +36,6 @@ */ @ISC_PLATFORM_HAVESALEN@ -/*! \brief - * If this system is missing in6addr_loopback, ISC_PLATFORM_NEEDIN6ADDRLOOPBACK - * will be defined. - */ -@ISC_PLATFORM_NEEDIN6ADDRLOOPBACK@ - /*! \brief * If this system has in6_pktinfo, ISC_PLATFORM_HAVEIN6PKTINFO will be * defined. diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index aeed627eeb..744c9d6fad 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -193,11 +193,6 @@ struct sockaddr_storage { }; #endif -#if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) -extern const struct in6_addr isc_net_in6addrloop; -#define in6addr_loopback isc_net_in6addrloop -#endif - #ifdef ISC_PLATFORM_NEEDPORTT /*% * Ensure type in_port_t is defined. diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index baff6b49f7..f46d9b0c86 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -93,10 +93,6 @@ #endif /* HAVE_SYSCTLBYNAME */ -#if defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) -const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT; -#endif - static isc_once_t once_ipv6only = ISC_ONCE_INIT; #if defined(ISC_PLATFORM_HAVEIN6PKTINFO) From 8c526df3060544a0c4a32f252c28d5f19d8f69ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 13:17:00 +0200 Subject: [PATCH 15/30] Remove support for legacy systems without sin6_scope_id --- configure | 33 +------------------------ configure.in | 18 +------------- lib/bind9/getaddresses.c | 10 -------- lib/isc/include/isc/platform.h.in | 5 ---- lib/isc/netaddr.c | 4 --- lib/isc/sockaddr.c | 4 --- lib/isc/unix/interfaceiter.c | 5 +--- lib/isc/win32/include/isc/platform.h.in | 1 - lib/isccfg/parser.c | 4 --- 9 files changed, 3 insertions(+), 81 deletions(-) diff --git a/configure b/configure index ea8ebb7246..6e542c0872 100755 --- a/configure +++ b/configure @@ -747,7 +747,6 @@ ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ -ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVESOCKADDRSTORAGE ISC_PLATFORM_HAVEIN6PKTINFO BIND9_CO_RULE @@ -17847,6 +17846,7 @@ main () struct in6_addr in6; in6 = in6addr_any; in6 = in6addr_loopback; + sin6.sin6_scope_id = 0; return (0); ; @@ -17864,36 +17864,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin6_scope_id in struct sockaddr_in6" >&5 -$as_echo_n "checking for sin6_scope_id in struct sockaddr_in6... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - #include - -int -main () -{ - - struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_pktinfo" >&5 $as_echo_n "checking for in6_pktinfo... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17955,7 +17925,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index 52f761bd38..4b0d642659 100644 --- a/configure.in +++ b/configure.in @@ -1947,27 +1947,12 @@ AC_COMPILE_IFELSE( struct in6_addr in6; in6 = in6addr_any; in6 = in6addr_loopback; + sin6.sin6_scope_id = 0; return (0); ]])], [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING([for sin6_scope_id in struct sockaddr_in6]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include - #include - #include - ]], - [[ - struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0); - ]])], - [AC_MSG_RESULT([yes]) - ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"], - [AC_MSG_RESULT([no]) - ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"]) - AC_MSG_CHECKING([for in6_pktinfo]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -1997,7 +1982,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) -AC_SUBST(ISC_PLATFORM_HAVESCOPEID) AC_MSG_CHECKING([for struct if_laddrreq]) AC_TRY_LINK([ diff --git a/lib/bind9/getaddresses.c b/lib/bind9/getaddresses.c index 46cd4d519b..5daf03e8b0 100644 --- a/lib/bind9/getaddresses.c +++ b/lib/bind9/getaddresses.c @@ -98,7 +98,6 @@ bind9_getaddresses(const char *hostname, in_port_t port, return (ISC_R_FAMILYNOSUPPORT); if (d != NULL) { -#ifdef ISC_PLATFORM_HAVESCOPEID isc_result_t iresult; iresult = isc_netscope_pton(AF_INET6, d + 1, @@ -106,15 +105,6 @@ bind9_getaddresses(const char *hostname, in_port_t port, if (iresult != ISC_R_SUCCESS) return (iresult); -#else - /* - * The extended format is specified while the - * system does not provide the ability to use - * it. Throw an explicit error instead of - * ignoring the specified value. - */ - return (ISC_R_BADADDRESSFORM); -#endif } isc_netaddr_fromin6(&na, &in6); diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index d8f783b623..b788f25263 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -42,11 +42,6 @@ */ @ISC_PLATFORM_HAVEIN6PKTINFO@ -/*! \brief - * If this system has sin6_scope_id, ISC_PLATFORM_HAVESCOPEID will be defined. - */ -@ISC_PLATFORM_HAVESCOPEID@ - /*! \brief * If this system needs inet_ntop(), ISC_PLATFORM_NEEDNTOP will be defined. */ diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index 0534ce0ae6..56f6f4e08b 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -336,11 +336,7 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) { break; case AF_INET6: memmove(&t->type.in6, &s->type.sin6.sin6_addr, 16); -#ifdef ISC_PLATFORM_HAVESCOPEID t->zone = s->type.sin6.sin6_scope_id; -#else - t->zone = 0; -#endif break; #ifdef ISC_PLATFORM_HAVESYSUNH case AF_UNIX: diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 6a97e69c46..fcbd0ec743 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -71,7 +71,6 @@ isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, memcmp(&a->type.sin6.sin6_addr, &b->type.sin6.sin6_addr, sizeof(a->type.sin6.sin6_addr)) != 0) return (false); -#ifdef ISC_PLATFORM_HAVESCOPEID /* * If ISC_SOCKADDR_CMPSCOPEZERO is set then don't return * false if one of the scopes in zero. @@ -82,7 +81,6 @@ isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, (a->type.sin6.sin6_scope_id != 0 && b->type.sin6.sin6_scope_id != 0))) return (false); -#endif if ((flags & ISC_SOCKADDR_CMPPORT) != 0 && a->type.sin6.sin6_port != b->type.sin6.sin6_port) return (false); @@ -377,9 +375,7 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6); #endif memmove(&sockaddr->type.sin6.sin6_addr, &na->type.in6, 16); -#ifdef ISC_PLATFORM_HAVESCOPEID sockaddr->type.sin6.sin6_scope_id = isc_netaddr_getzone(na); -#endif sockaddr->type.sin6.sin6_port = htons(port); break; default: diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index 4df4d34703..ab59a2efc5 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -62,8 +62,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, { struct sockaddr_in6 *sa6; -#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) || \ - !defined(ISC_PLATFORM_HAVESCOPEID) +#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) UNUSED(ifname); #endif @@ -81,7 +80,6 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, sa6 = (struct sockaddr_in6 *)src; memmove(&dst->type.in6, &sa6->sin6_addr, sizeof(struct in6_addr)); -#ifdef ISC_PLATFORM_HAVESCOPEID if (sa6->sin6_scope_id != 0) isc_netaddr_setzone(dst, sa6->sin6_scope_id); else { @@ -127,7 +125,6 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, } } } -#endif break; default: INSIST(0); diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 56eddd820f..80c0a7a3c0 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -45,7 +45,6 @@ #if _MSC_VER > 1200 #define ISC_PLATFORM_HAVEIN6PKTINFO #endif -#define ISC_PLATFORM_HAVESCOPEID #define ISC_PLATFORM_NEEDPORTT #undef MSG_TRUNC #define ISC_PLATFORM_NEEDNTOP diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index dc46bdb8cd..552015aff9 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -2336,7 +2336,6 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) { if (inet_pton(AF_INET6, buf, &in6a) == 1) { if (d != NULL) { -#ifdef ISC_PLATFORM_HAVESCOPEID isc_result_t result; result = isc_netscope_pton(AF_INET6, @@ -2345,9 +2344,6 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) { &zone); if (result != ISC_R_SUCCESS) return (result); -#else - return (ISC_R_BADADDRESSFORM); -#endif } isc_netaddr_fromin6(na, &in6a); From 3ab9c995671a5da61d09343011072403542cb1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 13:22:40 +0200 Subject: [PATCH 16/30] Remove support for legacy systems without in6_pktinfo --- configure | 34 +------------------------ configure.in | 18 +------------ lib/isc/include/isc/platform.h.in | 6 ----- lib/isc/unix/include/isc/net.h | 9 ------- lib/isc/unix/net.c | 11 -------- lib/isc/unix/socket.c | 14 +--------- lib/isc/win32/include/isc/net.h | 7 ----- lib/isc/win32/include/isc/platform.h.in | 3 --- lib/isc/win32/net.c | 2 -- 9 files changed, 3 insertions(+), 101 deletions(-) diff --git a/configure b/configure index 6e542c0872..c219bf1b17 100755 --- a/configure +++ b/configure @@ -748,7 +748,6 @@ ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVESOCKADDRSTORAGE -ISC_PLATFORM_HAVEIN6PKTINFO BIND9_CO_RULE LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL @@ -17844,6 +17843,7 @@ main () struct sockaddr_in6 sin6; struct in6_addr in6; + struct in6_pktinfo in6_pi; in6 = in6addr_any; in6 = in6addr_loopback; sin6.sin6_scope_id = 0; @@ -17864,36 +17864,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_pktinfo" >&5 -$as_echo_n "checking for in6_pktinfo... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - #include - -int -main () -{ - - struct in6_pktinfo xyzzy; return (0); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- disabling runtime ipv6 support" >&5 -$as_echo "no -- disabling runtime ipv6 support" >&6; } - ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 $as_echo_n "checking for struct sockaddr_storage... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17923,8 +17893,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.in b/configure.in index 4b0d642659..98e327a584 100644 --- a/configure.in +++ b/configure.in @@ -1945,6 +1945,7 @@ AC_COMPILE_IFELSE( [[ struct sockaddr_in6 sin6; struct in6_addr in6; + struct in6_pktinfo in6_pi; in6 = in6addr_any; in6 = in6addr_loopback; sin6.sin6_scope_id = 0; @@ -1953,22 +1954,6 @@ AC_COMPILE_IFELSE( [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING([for in6_pktinfo]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include - #include - #include - ]], - [[ - struct in6_pktinfo xyzzy; return (0); - ]])], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"], - [AC_MSG_RESULT(no -- disabling runtime ipv6 support) - ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"]) - AC_MSG_CHECKING(for struct sockaddr_storage) AC_TRY_COMPILE([ #include @@ -1980,7 +1965,6 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], [AC_MSG_RESULT(no) ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) -AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO) AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) AC_MSG_CHECKING([for struct if_laddrreq]) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index b788f25263..3db6b55f87 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,12 +36,6 @@ */ @ISC_PLATFORM_HAVESALEN@ -/*! \brief - * If this system has in6_pktinfo, ISC_PLATFORM_HAVEIN6PKTINFO will be - * defined. - */ -@ISC_PLATFORM_HAVEIN6PKTINFO@ - /*! \brief * If this system needs inet_ntop(), ISC_PLATFORM_NEEDNTOP will be defined. */ diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 744c9d6fad..09fcfa8e0c 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -158,15 +158,6 @@ #define INADDR_LOOPBACK 0x7f000001UL #endif -#ifndef ISC_PLATFORM_HAVEIN6PKTINFO -/*% IPv6 packet info */ -struct in6_pktinfo { - struct in6_addr ipi6_addr; /*%< src/dst IPv6 address */ - unsigned int ipi6_ifindex; /*%< send/recv interface index */ -}; -#endif - - #ifndef ISC_PLATFORM_HAVESOCKADDRSTORAGE #define _SS_MAXSIZE 128 #define _SS_ALIGNSIZE (sizeof (uint64_t)) diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index f46d9b0c86..60c3f0c42b 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -94,10 +94,7 @@ #endif /* HAVE_SYSCTLBYNAME */ static isc_once_t once_ipv6only = ISC_ONCE_INIT; - -#if defined(ISC_PLATFORM_HAVEIN6PKTINFO) static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; -#endif #ifndef ISC_CMSG_IP_TOS #ifdef __APPLE__ @@ -152,7 +149,6 @@ try_proto(int domain) { } } -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO if (domain == PF_INET6) { struct sockaddr_in6 sin6; unsigned int len; @@ -190,7 +186,6 @@ try_proto(int domain) { } } } -#endif (void)close(s); @@ -200,9 +195,7 @@ try_proto(int domain) { static void initialize_action(void) { ipv4_result = try_proto(PF_INET); -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO ipv6_result = try_proto(PF_INET6); -#endif #ifdef ISC_PLATFORM_HAVESYSUNH unix_result = try_proto(PF_UNIX); #endif @@ -307,7 +300,6 @@ initialize_ipv6only(void) { try_ipv6only) == ISC_R_SUCCESS); } -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO static void try_ipv6pktinfo(void) { int s, on; @@ -359,7 +351,6 @@ initialize_ipv6pktinfo(void) { RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo, try_ipv6pktinfo) == ISC_R_SUCCESS); } -#endif /* ISC_PLATFORM_HAVEIN6PKTINFO */ isc_result_t isc_net_probe_ipv6only(void) { @@ -369,9 +360,7 @@ isc_net_probe_ipv6only(void) { isc_result_t isc_net_probe_ipv6pktinfo(void) { -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO initialize_ipv6pktinfo(); -#endif return (ipv6pktinfo_result); } diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 2fc4da95c0..526f7ff8da 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -259,11 +259,9 @@ typedef isc_event_t intev_t; * to collect the destination address and interface so the client can * set them on outgoing packets. */ -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO #ifndef USE_CMSG #define USE_CMSG 1 #endif -#endif /*% * NetBSD and FreeBSD can timestamp packets. XXXMLG Should we have @@ -295,7 +293,7 @@ typedef isc_event_t intev_t; * multiplied by 2, everything should fit. Those sizes are not * large enough to cause any concern. */ -#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO) +#if defined(USE_CMSG) #define CMSG_SP_IN6PKT 40 #else #define CMSG_SP_IN6PKT 0 @@ -1249,9 +1247,7 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { #ifdef ISC_NET_BSD44MSGHDR #ifdef USE_CMSG struct cmsghdr *cmsgp; -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO struct in6_pktinfo *pktinfop; -#endif #ifdef SO_TIMESTAMP void *timevalp; #endif @@ -1289,9 +1285,7 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { #ifdef SO_TIMESTAMP timevalp = NULL; #endif -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO pktinfop = NULL; -#endif cmsgp = CMSG_FIRSTHDR(msg); while (cmsgp != NULL) { @@ -1299,7 +1293,6 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PROCESSCMSG, "processing cmsg %p", cmsgp); -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO if (cmsgp->cmsg_level == IPPROTO_IPV6 && cmsgp->cmsg_type == IPV6_PKTINFO) { @@ -1316,7 +1309,6 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { dev->attributes |= ISC_SOCKEVENTATTR_MULTICAST; goto next; } -#endif #ifdef SO_TIMESTAMP if (cmsgp->cmsg_level == SOL_SOCKET @@ -1454,7 +1446,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, msg->msg_flags = 0; #if defined(USE_CMSG) -#if defined(ISC_PLATFORM_HAVEIN6PKTINFO) if ((sock->type == isc_sockettype_udp) && ((dev->attributes & ISC_SOCKEVENTATTR_PKTINFO) != 0)) { @@ -1476,7 +1467,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp); memmove(pktinfop, &dev->pktinfo, sizeof(struct in6_pktinfo)); } -#endif #if defined(IPV6_USE_MIN_MTU) if ((sock->type == isc_sockettype_udp) && @@ -2671,7 +2661,6 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, } #endif /* SO_TIMESTAMP */ -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO #ifdef IPV6_RECVPKTINFO /* RFC 3542 */ if ((sock->pf == AF_INET6) @@ -2703,7 +2692,6 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, strbuf); } #endif /* IPV6_RECVPKTINFO */ -#endif /* ISC_PLATFORM_HAVEIN6PKTINFO */ #if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT) /* * Turn off Path MTU discovery on IPv6/UDP sockets. diff --git a/lib/isc/win32/include/isc/net.h b/lib/isc/win32/include/isc/net.h index 8494bcccb1..85c424976f 100644 --- a/lib/isc/win32/include/isc/net.h +++ b/lib/isc/win32/include/isc/net.h @@ -100,13 +100,6 @@ #define INADDR_LOOPBACK 0x7f000001UL #endif -#ifndef ISC_PLATFORM_HAVEIN6PKTINFO -struct in6_pktinfo { - struct in6_addr ipi6_addr; /* src/dst IPv6 address */ - unsigned int ipi6_ifindex; /* send/recv interface index */ -}; -#endif - #if _MSC_VER < 1300 #define in6addr_any isc_in6addr_any #define in6addr_loopback isc_in6addr_loopback diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 80c0a7a3c0..4be866fe99 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -42,9 +42,6 @@ #define PATH_MAX _MAX_PATH #endif -#if _MSC_VER > 1200 -#define ISC_PLATFORM_HAVEIN6PKTINFO -#endif #define ISC_PLATFORM_NEEDPORTT #undef MSG_TRUNC #define ISC_PLATFORM_NEEDNTOP diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index 3ea4de3e26..2b536aae7d 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -86,9 +86,7 @@ static void initialize_action(void) { InitSockets(); ipv4_result = try_proto(PF_INET); -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO ipv6_result = try_proto(PF_INET6); -#endif } static void From 388d6db5a1d3deac1ddf910f40d8988e4d540719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 13:48:48 +0200 Subject: [PATCH 17/30] Remove support for legacy systems without inet_{ntop,pton} w/ IPv6 support --- configure.in | 69 +------- lib/isc/Makefile.in | 4 +- lib/isc/include/isc/platform.h.in | 15 -- lib/isc/inet_ntop.c | 196 ----------------------- lib/isc/inet_pton.c | 204 ------------------------ lib/isc/tests/Atffile | 1 - lib/isc/tests/Kyuafile | 1 - lib/isc/tests/Makefile.in | 9 +- lib/isc/tests/inet_ntop_test.c | 62 ------- lib/isc/unix/include/isc/net.h | 40 ----- lib/isc/win32/include/isc/net.h | 13 -- lib/isc/win32/include/isc/platform.h.in | 3 - util/copyrights | 1 - 13 files changed, 5 insertions(+), 613 deletions(-) delete mode 100644 lib/isc/inet_ntop.c delete mode 100644 lib/isc/inet_pton.c delete mode 100644 lib/isc/tests/inet_ntop_test.c diff --git a/configure.in b/configure.in index 98e327a584..d8550c6ff8 100644 --- a/configure.in +++ b/configure.in @@ -1946,6 +1946,7 @@ AC_COMPILE_IFELSE( struct sockaddr_in6 sin6; struct in6_addr in6; struct in6_pktinfo in6_pi; + struct sockaddr_storage storage; in6 = in6addr_any; in6 = in6addr_loopback; sin6.sin6_scope_id = 0; @@ -1954,19 +1955,6 @@ AC_COMPILE_IFELSE( [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING(for struct sockaddr_storage) -AC_TRY_COMPILE([ -#include -#include -], -[struct sockaddr_storage storage; return (0);], -[AC_MSG_RESULT(yes) -ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"], -[AC_MSG_RESULT(no) -ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"]) - -AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE) - AC_MSG_CHECKING([for struct if_laddrreq]) AC_TRY_LINK([ #include @@ -1989,61 +1977,6 @@ AC_TRY_LINK([ ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"]) AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF) -# -# Check for network functions that are often missing. We do this -# after the libtool checking, so we can put the right suffix on -# the files. It also needs to come after checking for a Kame add-on, -# which provides some (all?) of the desired functions. -# - -AC_MSG_CHECKING([for inet_ntop with IPv6 support]) -AC_TRY_RUN([ -#include -#include -#include -#include -main() { -char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"], - - [AC_MSG_RESULT(no) - ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c" - ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"], - [AC_MSG_RESULT(assuming inet_ntop not needed) - ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"]) - - -# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts -# addresses with less than four octets, like "1.2.3". Also leading -# zeros should also be rejected. - -AC_MSG_CHECKING([for working inet_pton with IPv6 support]) -AC_TRY_RUN([ -#include -#include -#include -#include -main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 : - inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : - (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"], - [AC_MSG_RESULT(no) - ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c" - ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"], - [AC_MSG_RESULT(assuming inet_pton needed) - ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c" - ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"]) - -AC_SUBST(ISC_PLATFORM_NEEDNTOP) -AC_SUBST(ISC_PLATFORM_NEEDPTON) -AC_SUBST(ISC_EXTRA_OBJS) -AC_SUBST(ISC_EXTRA_SRCS) - AC_MSG_CHECKING(for sa_len in struct sockaddr) AC_TRY_COMPILE([ #include diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index d4e316865a..098467b490 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -44,7 +44,7 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/errno.@O@ \ win32/stdtime.@O@ win32/thread.@O@ win32/time.@O@ # Alphabetically -OBJS = @ISC_EXTRA_OBJS@ pk11.@O@ pk11_result.@O@ \ +OBJS = pk11.@O@ pk11_result.@O@ \ aes.@O@ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ bind9.@O@ buffer.@O@ bufferlist.@O@ \ commandline.@O@ counter.@O@ crc64.@O@ error.@O@ entropy.@O@ \ @@ -63,7 +63,7 @@ OBJS = @ISC_EXTRA_OBJS@ pk11.@O@ pk11_result.@O@ \ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically -SRCS = @ISC_EXTRA_SRCS@ pk11.c pk11_result.c \ +SRCS = pk11.c pk11_result.c \ aes.c assertions.c backtrace.c base32.c base64.c bind9.c \ buffer.c bufferlist.c commandline.c counter.c crc64.c \ entropy.c error.c event.c hash.c ht.c heap.c hex.c hmacmd5.c \ diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 3db6b55f87..18cec640ce 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,16 +36,6 @@ */ @ISC_PLATFORM_HAVESALEN@ -/*! \brief - * If this system needs inet_ntop(), ISC_PLATFORM_NEEDNTOP will be defined. - */ -@ISC_PLATFORM_NEEDNTOP@ - -/*! \brief - * If this system needs inet_pton(), ISC_PLATFORM_NEEDPTON will be defined. - */ -@ISC_PLATFORM_NEEDPTON@ - /*! \brief * If this system needs in_port_t, ISC_PLATFORM_NEEDPORTT will be defined. */ @@ -78,11 +68,6 @@ */ @ISC_PLATFORM_HAVEIFNAMETOINDEX@ -/*! \brief - * Define if the system has struct sockaddr_storage. - */ -@ISC_PLATFORM_HAVESOCKADDRSTORAGE@ - /*! \brief * Define if the system has TCP_FASTOPEN socket option. */ diff --git a/lib/isc/inet_ntop.c b/lib/isc/inet_ntop.c deleted file mode 100644 index fb06f850fd..0000000000 --- a/lib/isc/inet_ntop.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#define NS_INT16SZ 2 -#define NS_IN6ADDRSZ 16 - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static const char *inet_ntop4(const unsigned char *src, char *dst, - size_t size); - -#ifdef AF_INET6 -static const char *inet_ntop6(const unsigned char *src, char *dst, - size_t size); -#endif - -/*! char * - * isc_net_ntop(af, src, dst, size) - * convert a network format address to presentation format. - * \return - * pointer to presentation format address (`dst'), or NULL (see errno). - * \author - * Paul Vixie, 1996. - */ -const char * -isc_net_ntop(int af, const void *src, char *dst, size_t size) -{ - switch (af) { - case AF_INET: - return (inet_ntop4(src, dst, size)); -#ifdef AF_INET6 - case AF_INET6: - return (inet_ntop6(src, dst, size)); -#endif - default: - errno = EAFNOSUPPORT; - return (NULL); - } - /* NOTREACHED */ -} - -/*! const char * - * inet_ntop4(src, dst, size) - * format an IPv4 address - * \return - * `dst' (as a const) - * \note - * (1) uses no statics - * \note - * (2) takes a unsigned char* not an in_addr as input - * \author - * Paul Vixie, 1996. - */ -static const char * -inet_ntop4(const unsigned char *src, char *dst, size_t size) -{ - static const char *fmt = "%u.%u.%u.%u"; - char tmp[sizeof("255.255.255.255")]; - int n; - - - n = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); - if (n < 0 || (size_t)n >= size) { - errno = ENOSPC; - return (NULL); - } - strlcpy(dst, tmp, size); - - return (dst); -} - -/*! const char * - * isc_inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * \author - * Paul Vixie, 1996. - */ -#ifdef AF_INET6 -static const char * -inet_ntop6(const unsigned char *src, char *dst, size_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")], *tp; - struct { int base, len; } best, cur; - unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ]; - int i; - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof(words)); - for (i = 0; i < NS_IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - best.base = -1; - best.len = 0; /* silence compiler */ - cur.base = -1; - cur.len = 0; /* silence compiler */ - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - if (words[i] == 0) { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) - *tp++ = ':'; - continue; - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *tp++ = ':'; - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && (best.len == 6 || - (best.len == 7 && words[7] != 0x0001) || - (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src+12, tp, - sizeof(tmp) - (tp - tmp))) - return (NULL); - tp += strlen(tp); - break; - } - INSIST((size_t)(tp - tmp) < sizeof(tmp)); - tp += snprintf(tp, sizeof(tmp) - (tp - tmp), "%x", words[i]); - } - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == - (NS_IN6ADDRSZ / NS_INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { - errno = ENOSPC; - return (NULL); - } - strlcpy(dst, tmp, size); - return (dst); -} -#endif /* AF_INET6 */ diff --git a/lib/isc/inet_pton.c b/lib/isc/inet_pton.c deleted file mode 100644 index bde88e3bec..0000000000 --- a/lib/isc/inet_pton.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -#include - -#include -#include - -#include - -/*% INT16 Size */ -#define NS_INT16SZ 2 -/*% IPv4 Address Size */ -#define NS_INADDRSZ 4 -/*% IPv6 Address Size */ -#define NS_IN6ADDRSZ 16 - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4(const char *src, unsigned char *dst); -static int inet_pton6(const char *src, unsigned char *dst); - -/*% - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * \return - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * \author - * Paul Vixie, 1996. - */ -int -isc_net_pton(int af, const char *src, void *dst) { - switch (af) { - case AF_INET: - return (inet_pton4(src, dst)); - case AF_INET6: - return (inet_pton6(src, dst)); - default: - errno = EAFNOSUPPORT; - return (-1); - } - /* NOTREACHED */ -} - -/*!\fn static int inet_pton4(const char *src, unsigned char *dst) - * \brief - * like inet_aton() but without all the hexadecimal and shorthand. - * \return - * 1 if `src' is a valid dotted quad, else 0. - * \note - * does not touch `dst' unless it's returning 1. - * \author - * Paul Vixie, 1996. - */ -static int -inet_pton4(const char *src, unsigned char *dst) { - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - unsigned char tmp[NS_INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr(digits, ch)) != NULL) { - unsigned int byte = *tp * 10; - - byte += (int)(pch - digits); - if (saw_digit && *tp == 0) - return (0); - if (byte > 255) - return (0); - *tp = byte; - if (!saw_digit) { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } else if (ch == '.' && saw_digit) { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } else - return (0); - } - if (octets < 4) - return (0); - memmove(dst, tmp, NS_INADDRSZ); - return (1); -} - -/*% - * convert presentation level address to network order binary form. - * \return - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * \note - * (1) does not touch `dst' unless it's returning 1. - * \note - * (2) :: in a full address is silently ignored. - * \author - * inspired by Mark Andrews. - * \author - * Paul Vixie, 1996. - */ -static int -inet_pton6(const char *src, unsigned char *dst) { - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, seen_xdigits; - unsigned int val; - - memset((tp = tmp), '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - seen_xdigits = 0; - val = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if (++seen_xdigits > 4) - return (0); - continue; - } - if (ch == ':') { - curtok = src; - if (!seen_xdigits) { - if (colonp) - return (0); - colonp = tp; - continue; - } - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - seen_xdigits = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += NS_INADDRSZ; - seen_xdigits = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (seen_xdigits) { - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - } - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = (int)(tp - colonp); - int i; - - if (tp == endp) - return (0); - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - memmove(dst, tmp, NS_IN6ADDRSZ); - return (1); -} diff --git a/lib/isc/tests/Atffile b/lib/isc/tests/Atffile index a8e7e0fc1f..335b1dbb64 100644 --- a/lib/isc/tests/Atffile +++ b/lib/isc/tests/Atffile @@ -11,7 +11,6 @@ tp: file_test tp: hash_test tp: heap_test tp: ht_test -tp: inet_ntop_test tp: lex_test tp: mem_test tp: netaddr_test diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile index ab40a71d8c..b1005e7e9b 100644 --- a/lib/isc/tests/Kyuafile +++ b/lib/isc/tests/Kyuafile @@ -10,7 +10,6 @@ atf_test_program{name='file_test'} atf_test_program{name='hash_test'} atf_test_program{name='heap_test'} atf_test_program{name='ht_test'} -atf_test_program{name='inet_ntop_test'} atf_test_program{name='lex_test'} atf_test_program{name='mem_test'} atf_test_program{name='netaddr_test'} diff --git a/lib/isc/tests/Makefile.in b/lib/isc/tests/Makefile.in index 3349845d0d..fe570b56f8 100644 --- a/lib/isc/tests/Makefile.in +++ b/lib/isc/tests/Makefile.in @@ -33,7 +33,7 @@ CMOCKA_LIBS = @CMOCKA_LIBS@ OBJS = isctest.@O@ SRCS = isctest.c aes_test.c atomic_test.c buffer_test.c \ counter_test.c errno_test.c file_test.c hash_test.c \ - heap_test.c ht_test.c inet_ntop_test.c lex_test.c \ + heap_test.c ht_test.c lex_test.c \ mem_test.c netaddr_test.c parse_test.c pool_test.c \ queue_test.c radix_test.c random_test.c \ regex_test.c result_test.c safe_test.c sockaddr_test.c \ @@ -44,7 +44,7 @@ SUBDIRS = TARGETS = aes_test@EXEEXT@ atomic_test@EXEEXT@ buffer_test@EXEEXT@ \ counter_test@EXEEXT@ errno_test@EXEEXT@ file_test@EXEEXT@ \ hash_test@EXEEXT@ heap_test@EXEEXT@ ht_test@EXEEXT@ \ - inet_ntop_test@EXEEXT@ lex_test@EXEEXT@ mem_test@EXEEXT@ \ + lex_test@EXEEXT@ mem_test@EXEEXT@ \ netaddr_test@EXEEXT@ parse_test@EXEEXT@ pool_test@EXEEXT@ \ queue_test@EXEEXT@ radix_test@EXEEXT@ \ random_test@EXEEXT@ regex_test@EXEEXT@ result_test@EXEEXT@ \ @@ -90,11 +90,6 @@ ht_test@EXEEXT@: ht_test.@O@ ${ISCDEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ ht_test.@O@ ${ISCLIBS} ${LIBS} -inet_ntop_test.c.@O@: ${top_srcdir}/lib/isc/ntop_test.c -inet_ntop_test@EXEEXT@: inet_ntop_test.@O@ ${ISCDEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - inet_ntop_test.@O@ ${ISCLIBS} ${LIBS} - lex_test@EXEEXT@: lex_test.@O@ ${ISCDEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ lex_test.@O@ ${ISCLIBS} ${LIBS} diff --git a/lib/isc/tests/inet_ntop_test.c b/lib/isc/tests/inet_ntop_test.c deleted file mode 100644 index 2bfe9deb95..0000000000 --- a/lib/isc/tests/inet_ntop_test.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -#include - -/* - * Force the prototype for isc_net_ntop to be declared. - */ -#include -#undef ISC_PLATFORM_NEEDNTOP -#define ISC_PLATFORM_NEEDNTOP -#include "../inet_ntop.c" - -ATF_TC(isc_net_ntop); -ATF_TC_HEAD(isc_net_ntop, tc) { - atf_tc_set_md_var(tc, "descr", "isc_net_ntop implementation"); -} -ATF_TC_BODY(isc_net_ntop, tc) { - char buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - int r; - size_t i; - unsigned char abuf[16]; - struct { - int family; - const char * address; - } testdata[] = { - { AF_INET, "0.0.0.0" }, - { AF_INET, "0.1.0.0" }, - { AF_INET, "0.0.2.0" }, - { AF_INET, "0.0.0.3" }, - { AF_INET, "255.255.255.255" }, - { AF_INET6, "::" }, - { AF_INET6, "::1.2.3.4" }, - { AF_INET6, "::ffff:1.2.3.4" }, - { AF_INET6, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" } - }; - - for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) { - r = inet_pton(testdata[i].family, testdata[i].address, abuf); - ATF_REQUIRE_EQ_MSG(r, 1, "%s", testdata[i].address); - isc_net_ntop(testdata[i].family, abuf, buf, sizeof(buf)); - ATF_CHECK_STREQ(buf, testdata[i].address); - } -} - -/* - * Main - */ -ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, isc_net_ntop); - return (atf_no_error()); -} diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 09fcfa8e0c..84c5fc9e7a 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -158,32 +158,6 @@ #define INADDR_LOOPBACK 0x7f000001UL #endif -#ifndef ISC_PLATFORM_HAVESOCKADDRSTORAGE -#define _SS_MAXSIZE 128 -#define _SS_ALIGNSIZE (sizeof (uint64_t)) -#ifdef ISC_PLATFORM_HAVESALEN -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - (2 * sizeof(uint8_t))) -#define _SS_PAD2SIZE (_SS_MAXSIZE - (_SS_ALIGNSIZE + _SS_PAD1SIZE \ - + 2 * sizeof(uint8_t))) -#else -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(uint16_t)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - (_SS_ALIGNSIZE + _SS_PAD1SIZE \ - + sizeof(uint16_t))) -#endif - -struct sockaddr_storage { -#ifdef ISC_PLATFORM_HAVESALEN - uint8_t ss_len; - uint8_t ss_family; -#else - uint16_t ss_family; -#endif - char __ss_pad1[_SS_PAD1SIZE]; - uint64_t __ss_align; /* field to force desired structure */ - char __ss_pad2[_SS_PAD2SIZE]; -}; -#endif - #ifdef ISC_PLATFORM_NEEDPORTT /*% * Ensure type in_port_t is defined. @@ -319,20 +293,6 @@ isc_net_getudpportrange(int af, in_port_t *low, in_port_t *high); * the range. */ -#ifdef ISC_PLATFORM_NEEDNTOP -const char * -isc_net_ntop(int af, const void *src, char *dst, size_t size); -#undef inet_ntop -#define inet_ntop isc_net_ntop -#endif - -#ifdef ISC_PLATFORM_NEEDPTON -int -isc_net_pton(int af, const char *src, void *dst); -#undef inet_pton -#define inet_pton isc_net_pton -#endif - ISC_LANG_ENDDECLS #endif /* ISC_NET_H */ diff --git a/lib/isc/win32/include/isc/net.h b/lib/isc/win32/include/isc/net.h index 85c424976f..1fe214002b 100644 --- a/lib/isc/win32/include/isc/net.h +++ b/lib/isc/win32/include/isc/net.h @@ -392,19 +392,6 @@ isc_net_getudpportrange(int af, in_port_t *low, in_port_t *high); * the range. */ -#ifdef ISC_PLATFORM_NEEDNTOP -const char * -isc_net_ntop(int af, const void *src, char *dst, size_t size); -#undef inet_ntop -#define inet_ntop isc_net_ntop -#endif - -#ifdef ISC_PLATFORM_NEEDPTON -int -isc_net_pton(int af, const char *src, void *dst); -#define inet_pton isc_net_pton -#endif - ISC_LANG_ENDDECLS #endif /* ISC_NET_H */ diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 4be866fe99..dea6cb94c9 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -44,9 +44,6 @@ #define ISC_PLATFORM_NEEDPORTT #undef MSG_TRUNC -#define ISC_PLATFORM_NEEDNTOP -#define ISC_PLATFORM_NEEDPTON -#define ISC_PLATFORM_HAVESOCKADDRSTORAGE #define ISC_PLATFORM_NEEDSTRSEP #define ISC_PLATFORM_NEEDSTRLCPY diff --git a/util/copyrights b/util/copyrights index d276fa8067..d490f0c32d 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3522,7 +3522,6 @@ ./lib/isc/tests/hash_test.c C 2011,2012,2013,2014,2015,2016,2017,2018 ./lib/isc/tests/heap_test.c C 2017,2018 ./lib/isc/tests/ht_test.c C 2016,2017,2018 -./lib/isc/tests/inet_ntop_test.c C 2017,2018 ./lib/isc/tests/isctest.c C 2011,2012,2013,2014,2016,2017,2018 ./lib/isc/tests/isctest.h C 2011,2012,2016,2018 ./lib/isc/tests/lex_test.c C 2013,2016,2018 From e6dc08b06c3267b24fb29f21c196aff6f367d000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 14:26:39 +0200 Subject: [PATCH 18/30] Always assume BSD4.4 msghdr version --- configure | 152 +----------------------------- configure.in | 14 --- lib/isc/include/isc/platform.h.in | 5 - lib/isc/unix/net.c | 11 +-- lib/isc/unix/socket.c | 21 ----- 5 files changed, 2 insertions(+), 201 deletions(-) diff --git a/configure b/configure index c219bf1b17..ea02de09a0 100755 --- a/configure +++ b/configure @@ -739,15 +739,9 @@ ISC_IRS_GETNAMEINFOSOCKLEN ISC_IRS_NEEDADDRINFO ISC_PLATFORM_HAVETFO ISC_PLATFORM_NEEDPORTT -ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_HAVESALEN -ISC_EXTRA_SRCS -ISC_EXTRA_OBJS -ISC_PLATFORM_NEEDPTON -ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ -ISC_PLATFORM_HAVESOCKADDRSTORAGE BIND9_CO_RULE LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_UNINSTALL @@ -17844,6 +17838,7 @@ main () struct sockaddr_in6 sin6; struct in6_addr in6; struct in6_pktinfo in6_pi; + struct sockaddr_storage storage; in6 = in6addr_any; in6 = in6addr_loopback; sin6.sin6_scope_id = 0; @@ -17864,35 +17859,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 -$as_echo_n "checking for struct sockaddr_storage... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ -struct sockaddr_storage storage; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 $as_echo_n "checking for struct if_laddrreq... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17951,92 +17917,6 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -# -# Check for network functions that are often missing. We do this -# after the libtool checking, so we can put the right suffix on -# the files. It also needs to come after checking for a Kame add-on, -# which provides some (all?) of the desired functions. -# - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntop with IPv6 support" >&5 -$as_echo_n "checking for inet_ntop with IPv6 support... " >&6; } -if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming inet_ntop not needed" >&5 -$as_echo "assuming inet_ntop not needed" >&6; } - ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#include -main() { -char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c" - ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts -# addresses with less than four octets, like "1.2.3". Also leading -# zeros should also be rejected. - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working inet_pton with IPv6 support" >&5 -$as_echo_n "checking for working inet_pton with IPv6 support... " >&6; } -if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming inet_pton needed" >&5 -$as_echo "assuming inet_pton needed" >&6; } - ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c" - ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#include -main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 : - inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : - (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c" - ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sa_len in struct sockaddr" >&5 $as_echo_n "checking for sa_len in struct sockaddr... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18064,36 +17944,6 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# Look for a 4.4BSD or 4.3BSD struct msghdr -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct msghdr flavor" >&5 -$as_echo_n "checking for struct msghdr flavor... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int -main () -{ -struct msghdr msg; msg.msg_flags = 0; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: 4.4BSD" >&5 -$as_echo "4.4BSD" >&6; } - ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: 4.3BSD" >&5 -$as_echo "4.3BSD" >&6; } - ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - # # Look for in_port_t. # diff --git a/configure.in b/configure.in index d8550c6ff8..b419d1fcec 100644 --- a/configure.in +++ b/configure.in @@ -1988,20 +1988,6 @@ AC_TRY_COMPILE([ ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"]) AC_SUBST(ISC_PLATFORM_HAVESALEN) -# -# Look for a 4.4BSD or 4.3BSD struct msghdr -# -AC_MSG_CHECKING(for struct msghdr flavor) -AC_TRY_COMPILE([ -#include -#include ], -[struct msghdr msg; msg.msg_flags = 0; return (0);], - [AC_MSG_RESULT(4.4BSD) - ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"], - [AC_MSG_RESULT(4.3BSD) - ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"]) -AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR) - # # Look for in_port_t. # diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 18cec640ce..985e08b53d 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -58,11 +58,6 @@ */ @ISC_PLATFORM_HAVEIF_LADDRREQ@ -/*! \brief - * Define either ISC_PLATFORM_BSD44MSGHDR or ISC_PLATFORM_BSD43MSGHDR. - */ -@ISC_PLATFORM_MSGHDRFLAVOR@ - /*! \brief * Define if the system supports if_nametoindex. */ diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 60c3f0c42b..e62cbbaf61 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -364,8 +364,7 @@ isc_net_probe_ipv6pktinfo(void) { return (ipv6pktinfo_result); } -#if ISC_CMSG_IP_TOS || \ - defined(ISC_NET_BSD44MSGHDR) && defined(IPV6_TCLASS) +#if ISC_CMSG_IP_TOS || defined(IPV6_TCLASS) static inline ISC_SOCKADDR_LEN_T cmsg_len(ISC_SOCKADDR_LEN_T len) { @@ -411,7 +410,6 @@ cmsg_space(ISC_SOCKADDR_LEN_T len) { #endif } -#ifdef ISC_NET_BSD44MSGHDR /* * Make a fd non-blocking. */ @@ -574,7 +572,6 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { return (true); } #endif -#endif static void try_dscp_v4(void) { @@ -624,15 +621,11 @@ try_dscp_v4(void) { dscp_result |= ISC_NET_DSCPRECVV4; #endif /* IP_RECVTOS */ -#ifdef ISC_NET_BSD44MSGHDR - #if ISC_CMSG_IP_TOS if (cmsgsend(s, IPPROTO_IP, IP_TOS, res0)) dscp_result |= ISC_NET_DSCPPKTV4; #endif /* ISC_CMSG_IP_TOS */ -#endif /* ISC_NET_BSD44MSGHDR */ - freeaddrinfo(res0); close(s); @@ -685,10 +678,8 @@ try_dscp_v6(void) { dscp_result |= ISC_NET_DSCPRECVV6; #endif /* IPV6_RECVTCLASS */ -#ifdef ISC_NET_BSD44MSGHDR if (cmsgsend(s, IPPROTO_IPV6, IPV6_TCLASS, res0)) dscp_result |= ISC_NET_DSCPPKTV6; -#endif /* ISC_NET_BSD44MSGHDR */ freeaddrinfo(res0); close(s); diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 526f7ff8da..f20702d4aa 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1244,14 +1244,12 @@ cmsg_space(ISC_SOCKADDR_LEN_T len) { */ static void process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { -#ifdef ISC_NET_BSD44MSGHDR #ifdef USE_CMSG struct cmsghdr *cmsgp; struct in6_pktinfo *pktinfop; #ifdef SO_TIMESTAMP void *timevalp; #endif -#endif #endif /* @@ -1264,8 +1262,6 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { UNUSED(msg); UNUSED(dev); -#ifdef ISC_NET_BSD44MSGHDR - #ifdef MSG_TRUNC if ((msg->msg_flags & MSG_TRUNC) == MSG_TRUNC) dev->attributes |= ISC_SOCKEVENTATTR_TRUNC; @@ -1350,8 +1346,6 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { cmsgp = CMSG_NXTHDR(msg, cmsgp); } #endif /* USE_CMSG */ - -#endif /* ISC_NET_BSD44MSGHDR */ } /* @@ -1375,9 +1369,7 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, isc_region_t used; size_t write_count; size_t skip_count; -#ifdef ISC_NET_BSD44MSGHDR struct cmsghdr *cmsgp; -#endif memset(msg, 0, sizeof(*msg)); @@ -1439,8 +1431,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, config: msg->msg_iov = iov; msg->msg_iovlen = iovcount; - -#ifdef ISC_NET_BSD44MSGHDR msg->msg_control = NULL; msg->msg_controllen = 0; msg->msg_flags = 0; @@ -1572,10 +1562,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, } #endif #endif /* USE_CMSG */ -#else /* ISC_NET_BSD44MSGHDR */ - msg->msg_accrights = NULL; - msg->msg_accrightslen = 0; -#endif /* ISC_NET_BSD44MSGHDR */ if (write_countp != NULL) *write_countp = write_count; @@ -1690,7 +1676,6 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev, msg->msg_iov = iov; msg->msg_iovlen = iovcount; -#ifdef ISC_NET_BSD44MSGHDR #if defined(USE_CMSG) msg->msg_control = cmsgbuf; msg->msg_controllen = RECVCMSGBUFLEN; @@ -1699,10 +1684,6 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev, msg->msg_controllen = 0; #endif /* USE_CMSG */ msg->msg_flags = 0; -#else /* ISC_NET_BSD44MSGHDR */ - msg->msg_accrights = NULL; - msg->msg_accrightslen = 0; -#endif /* ISC_NET_BSD44MSGHDR */ if (read_countp != NULL) *read_countp = read_count; @@ -1774,10 +1755,8 @@ dump_msg(struct msghdr *msg) { printf("\t\t%u\tbase %p, len %ld\n", i, msg->msg_iov[i].iov_base, (long) msg->msg_iov[i].iov_len); -#ifdef ISC_NET_BSD44MSGHDR printf("\tcontrol %p, controllen %ld\n", msg->msg_control, (long) msg->msg_controllen); -#endif } #endif From 40f7680efa1d7692a19b1407eb0c51ab3947fab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 14:32:20 +0200 Subject: [PATCH 19/30] Ignore sockaddr_{sin,sin6,sun}.{sin,sin6,sun}_len even on systems that define it --- configure | 28 ---------------------------- configure.in | 11 ----------- lib/isc/include/isc/platform.h.in | 6 ------ lib/isc/sockaddr.c | 25 ------------------------- lib/isc/unix/ifiter_ioctl.c | 23 +---------------------- lib/isc/unix/ifiter_sysctl.c | 6 ------ 6 files changed, 1 insertion(+), 98 deletions(-) diff --git a/configure b/configure index ea02de09a0..a854aed4c4 100755 --- a/configure +++ b/configure @@ -739,7 +739,6 @@ ISC_IRS_GETNAMEINFOSOCKLEN ISC_IRS_NEEDADDRINFO ISC_PLATFORM_HAVETFO ISC_PLATFORM_NEEDPORTT -ISC_PLATFORM_HAVESALEN ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ BIND9_CO_RULE @@ -17917,33 +17916,6 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sa_len in struct sockaddr" >&5 -$as_echo_n "checking for sa_len in struct sockaddr... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int -main () -{ -struct sockaddr sa; sa.sa_len = 0; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - # # Look for in_port_t. # diff --git a/configure.in b/configure.in index b419d1fcec..b919987e8e 100644 --- a/configure.in +++ b/configure.in @@ -1977,17 +1977,6 @@ AC_TRY_LINK([ ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"]) AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF) -AC_MSG_CHECKING(for sa_len in struct sockaddr) -AC_TRY_COMPILE([ -#include -#include ], -[struct sockaddr sa; sa.sa_len = 0; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"]) -AC_SUBST(ISC_PLATFORM_HAVESALEN) - # # Look for in_port_t. # diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 985e08b53d..deb4efad40 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -30,12 +30,6 @@ *** Network. ***/ -/*! \brief - * If sockaddrs on this system have an sa_len field, ISC_PLATFORM_HAVESALEN - * will be defined. - */ -@ISC_PLATFORM_HAVESALEN@ - /*! \brief * If this system needs in_port_t, ISC_PLATFORM_NEEDPORTT will be defined. */ diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index fcbd0ec743..2fe1a5ba64 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -242,9 +242,6 @@ isc_sockaddr_any(isc_sockaddr_t *sockaddr) { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->type.sin.sin_family = AF_INET; -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin); -#endif sockaddr->type.sin.sin_addr.s_addr = INADDR_ANY; sockaddr->type.sin.sin_port = 0; sockaddr->length = sizeof(sockaddr->type.sin); @@ -256,9 +253,6 @@ isc_sockaddr_any6(isc_sockaddr_t *sockaddr) { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->type.sin6.sin6_family = AF_INET6; -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6); -#endif sockaddr->type.sin6.sin6_addr = in6addr_any; sockaddr->type.sin6.sin6_port = 0; sockaddr->length = sizeof(sockaddr->type.sin6); @@ -271,9 +265,6 @@ isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->type.sin.sin_family = AF_INET; -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin); -#endif sockaddr->type.sin.sin_addr = *ina; sockaddr->type.sin.sin_port = htons(port); sockaddr->length = sizeof(sockaddr->type.sin); @@ -300,9 +291,6 @@ isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6, { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->type.sin6.sin6_family = AF_INET6; -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6); -#endif sockaddr->type.sin6.sin6_addr = *ina6; sockaddr->type.sin6.sin6_port = htons(port); sockaddr->length = sizeof(sockaddr->type.sin6); @@ -315,9 +303,6 @@ isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->type.sin6.sin6_family = AF_INET6; -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6); -#endif sockaddr->type.sin6.sin6_addr.s6_addr[10] = 0xff; sockaddr->type.sin6.sin6_addr.s6_addr[11] = 0xff; memmove(&sockaddr->type.sin6.sin6_addr.s6_addr[12], ina, 4); @@ -363,17 +348,11 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, switch (na->family) { case AF_INET: sockaddr->length = sizeof(sockaddr->type.sin); -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin); -#endif sockaddr->type.sin.sin_addr = na->type.in; sockaddr->type.sin.sin_port = htons(port); break; case AF_INET6: sockaddr->length = sizeof(sockaddr->type.sin6); -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6); -#endif memmove(&sockaddr->type.sin6.sin6_addr, &na->type.in6, 16); sockaddr->type.sin6.sin6_scope_id = isc_netaddr_getzone(na); sockaddr->type.sin6.sin6_port = htons(port); @@ -488,10 +467,6 @@ isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path) { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->length = sizeof(sockaddr->type.sunix); sockaddr->type.sunix.sun_family = AF_UNIX; -#ifdef ISC_PLATFORM_HAVESALEN - sockaddr->type.sunix.sun_len = - (unsigned char)sizeof(sockaddr->type.sunix); -#endif strlcpy(sockaddr->type.sunix.sun_path, path, sizeof(sockaddr->type.sunix.sun_path)); return (ISC_R_SUCCESS); diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index fcccb7946d..3fa64537ac 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -738,19 +738,8 @@ internal_current(isc_interfaceiter_t *iter) { */ static isc_result_t internal_next4(isc_interfaceiter_t *iter) { -#ifdef ISC_PLATFORM_HAVESALEN - struct ifreq *ifrp; -#endif if (iter->pos < (unsigned int) iter->ifc.ifc_len) { -#ifdef ISC_PLATFORM_HAVESALEN - ifrp = (struct ifreq *)((char *) iter->ifc.ifc_req + iter->pos); - - if (ifrp->ifr_addr.sa_len > sizeof(struct sockaddr)) - iter->pos += sizeof(ifrp->ifr_name) + - ifrp->ifr_addr.sa_len; - else -#endif iter->pos += sizeof(struct ifreq); } else { @@ -767,23 +756,13 @@ internal_next4(isc_interfaceiter_t *iter) { #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) static isc_result_t internal_next6(isc_interfaceiter_t *iter) { -#ifdef ISC_PLATFORM_HAVESALEN - struct LIFREQ *ifrp; -#endif if (iter->result6 != ISC_R_SUCCESS && iter->result6 != ISC_R_IGNORE) return (iter->result6); REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len); -#ifdef ISC_PLATFORM_HAVESALEN - ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6); - - if (ifrp->lifr_addr.sa_len > sizeof(struct sockaddr)) - iter->pos6 += sizeof(ifrp->lifr_name) + ifrp->lifr_addr.sa_len; - else -#endif - iter->pos6 += sizeof(struct LIFREQ); + iter->pos6 += sizeof(struct LIFREQ); if (iter->pos6 >= (unsigned int) iter->lifc.lifc_len) return (ISC_R_NOMORE); diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c index f13065623f..feb275e0f7 100644 --- a/lib/isc/unix/ifiter_sysctl.c +++ b/lib/isc/unix/ifiter_sysctl.c @@ -209,14 +209,8 @@ internal_current(isc_interfaceiter_t *iter) { dst_sa = sa; break; } -#ifdef ISC_PLATFORM_HAVESALEN - sa = (struct sockaddr *)((char*)(sa) - + ROUNDUP(sa->sa_len)); -#else - /* XXX untested. */ sa = (struct sockaddr *)((char*)(sa) + ROUNDUP(sizeof(struct sockaddr))); -#endif } if (addr_sa == NULL) From 29c853f5003e64164669627c21e09fc796773829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 14:35:57 +0200 Subject: [PATCH 20/30] Remove check for isc_port_t; Windows never have it, Unix always have it --- configure | 31 ------------------------- configure.in | 30 +++++++----------------- lib/isc/include/isc/platform.h.in | 5 ---- lib/isc/unix/include/isc/net.h | 7 ------ lib/isc/win32/include/isc/net.h | 2 -- lib/isc/win32/include/isc/platform.h.in | 1 - 6 files changed, 8 insertions(+), 68 deletions(-) diff --git a/configure b/configure index a854aed4c4..e9b21a2089 100755 --- a/configure +++ b/configure @@ -738,7 +738,6 @@ ISC_PLATFORM_NEEDMEMMOVE ISC_IRS_GETNAMEINFOSOCKLEN ISC_IRS_NEEDADDRINFO ISC_PLATFORM_HAVETFO -ISC_PLATFORM_NEEDPORTT ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ BIND9_CO_RULE @@ -17916,36 +17915,6 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -# -# Look for in_port_t. -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type in_port_t" >&5 -$as_echo_n "checking for type in_port_t... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int -main () -{ -in_port_t port = 25; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - # # Allow forcibly disabling TCP Fast Open support as autodetection might yield # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen() diff --git a/configure.in b/configure.in index b919987e8e..35c618a19e 100644 --- a/configure.in +++ b/configure.in @@ -1245,7 +1245,7 @@ case "$use_gssapi" in DNS_GSSAPI_LIBS="-framework Kerberos" AC_MSG_RESULT(framework) ;; - + *) AC_MSG_RESULT(looking in $use_gssapi/lib) USE_GSSAPI='-DGSSAPI' @@ -1977,20 +1977,6 @@ AC_TRY_LINK([ ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"]) AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF) -# -# Look for in_port_t. -# -AC_MSG_CHECKING(for type in_port_t) -AC_TRY_COMPILE([ -#include -#include ], -[in_port_t port = 25; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"]) -AC_SUBST(ISC_PLATFORM_NEEDPORTT) - # # Allow forcibly disabling TCP Fast Open support as autodetection might yield # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen() @@ -2114,7 +2100,7 @@ AC_ARG_ENABLE(getifaddrs, # This interface iteration code for getifaddrs() will fall back to using # /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6 # addresses. -# +# case $want_getifaddrs in glibc) AC_MSG_WARN("--enable-getifaddrs=glibc is no longer required") @@ -2964,11 +2950,11 @@ AC_SUBST(CURL) # NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES) # # If the file FILENAME is found in one of the DIRECTORIES, the shell -# variable VARIABLE is defined to its absolute pathname. Otherwise, +# variable VARIABLE is defined to its absolute pathname. Otherwise, # it is set to FILENAME, with no directory prefix (that's not terribly # useful, but looks less confusing in substitutions than leaving it # empty). The variable VARIABLE will be substituted into output files. -# +# AC_DEFUN([NOM_PATH_FILE], [ $1="" @@ -3344,7 +3330,7 @@ DLZ_SYSTEM_TEST="" DLZ_DRIVER_MYSQL_INCLUDES="" DLZ_DRIVER_MYSQL_LIBS="" -# +# # Configure support for building a shared library object # # Even when libtool is available it can't always be relied upon @@ -3482,8 +3468,8 @@ if test "yes" = "$cross_compiling"; then BUILD_LDFLAGS="$BUILD_LDFLAGS" BUILD_LIBS="$BUILD_LIBS" else - BUILD_CC="$CC" - BUILD_CFLAGS="$CFLAGS" + BUILD_CC="$CC" + BUILD_CFLAGS="$CFLAGS" BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG" BUILD_LDFLAGS="$LDFLAGS" BUILD_LIBS="$LIBS" @@ -3803,7 +3789,7 @@ report() { echo " Algorithm: $with_cc_alg" fi - # these lines are only printed if run with --enable-full-report + # these lines are only printed if run with --enable-full-report if test "yes" = "$enable_full_report"; then test "no" = "$found_ipv6" || echo " IPv6 support (--enable-ipv6)" test "X$PYTHON" = "X" || echo " Python tools (--with-python)" diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index deb4efad40..e2d3622ccc 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -30,11 +30,6 @@ *** Network. ***/ -/*! \brief - * If this system needs in_port_t, ISC_PLATFORM_NEEDPORTT will be defined. - */ -@ISC_PLATFORM_NEEDPORTT@ - /*! \brief * Define if the system has struct lifconf which is a extended struct ifconf * for IPv6. diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 84c5fc9e7a..1f37c6d708 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -158,13 +158,6 @@ #define INADDR_LOOPBACK 0x7f000001UL #endif -#ifdef ISC_PLATFORM_NEEDPORTT -/*% - * Ensure type in_port_t is defined. - */ -typedef uint16_t in_port_t; -#endif - #ifndef MSG_TRUNC /*% * If this system does not have MSG_TRUNC (as returned from recvmsg()) diff --git a/lib/isc/win32/include/isc/net.h b/lib/isc/win32/include/isc/net.h index 1fe214002b..54e1c31f90 100644 --- a/lib/isc/win32/include/isc/net.h +++ b/lib/isc/win32/include/isc/net.h @@ -108,9 +108,7 @@ /* * Ensure type in_port_t is defined. */ -#ifdef ISC_PLATFORM_NEEDPORTT typedef uint16_t in_port_t; -#endif /* * If this system does not have MSG_TRUNC (as returned from recvmsg()) diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index dea6cb94c9..80df0a0b11 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -42,7 +42,6 @@ #define PATH_MAX _MAX_PATH #endif -#define ISC_PLATFORM_NEEDPORTT #undef MSG_TRUNC #define ISC_PLATFORM_NEEDSTRSEP From 62fb0759e9ebe75fe08613419580b2a7fdcead6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 14:54:36 +0200 Subject: [PATCH 21/30] Assume always working getaddrinfo/getnameinfo implemenation --- acconfig.h | 9 - bin/check/check-tool.c | 21 - bin/nsupdate/nsupdate.c | 14 - config.h.in | 21 - config.h.win32 | 21 - configure | 183 ------- configure.in | 80 --- contrib/queryperf/config.h.in | 9 +- contrib/queryperf/configure | 213 ++++---- contrib/queryperf/configure.in | 6 - contrib/queryperf/missing/addrinfo.h | 100 ---- contrib/queryperf/missing/getaddrinfo.c | 632 ------------------------ contrib/queryperf/missing/getnameinfo.c | 226 --------- contrib/queryperf/queryperf.c | 11 +- lib/bind9/getaddresses.c | 54 -- lib/irs/gai_strerror.c | 2 +- lib/irs/getnameinfo.c | 8 +- lib/irs/include/irs/netdb.h.in | 30 +- 18 files changed, 113 insertions(+), 1527 deletions(-) delete mode 100644 contrib/queryperf/missing/addrinfo.h delete mode 100644 contrib/queryperf/missing/getaddrinfo.c delete mode 100644 contrib/queryperf/missing/getnameinfo.c diff --git a/acconfig.h b/acconfig.h index 2be46d2878..1a1579c49b 100644 --- a/acconfig.h +++ b/acconfig.h @@ -50,15 +50,6 @@ /** define if tzset() is available */ #undef HAVE_TZSET -/** define if struct addrinfo exists */ -#undef HAVE_ADDRINFO - -/** define if getaddrinfo() exists */ -#undef HAVE_GETADDRINFO - -/** define if gai_strerror() exists */ -#undef HAVE_GAISTRERROR - /** * define if pthread_setconcurrency() should be called to tell the * OS how many threads we might want to run. diff --git a/bin/check/check-tool.c b/bin/check/check-tool.c index 1902fd303d..8af8190036 100644 --- a/bin/check/check-tool.c +++ b/bin/check/check-tool.c @@ -62,14 +62,6 @@ #define CHECK_LOCAL 1 #endif -#ifdef HAVE_ADDRINFO -#ifdef HAVE_GETADDRINFO -#ifdef HAVE_GAISTRERROR -#define USE_GETADDRINFO -#endif -#endif -#endif - #define CHECK(r) \ do { \ result = (r); \ @@ -177,7 +169,6 @@ static bool checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner, dns_rdataset_t *a, dns_rdataset_t *aaaa) { -#ifdef USE_GETADDRINFO dns_rdataset_t *rdataset; dns_rdata_t rdata = DNS_RDATA_INIT; struct addrinfo hints, *ai, *cur; @@ -373,14 +364,10 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner, } freeaddrinfo(ai); return (answer); -#else - return (true); -#endif } static bool checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) { -#ifdef USE_GETADDRINFO struct addrinfo hints, *ai, *cur; char namebuf[DNS_NAME_FORMATSIZE + 1]; char ownerbuf[DNS_NAME_FORMATSIZE]; @@ -459,14 +446,10 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) { } return (true); } -#else - return (true); -#endif } static bool checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) { -#ifdef USE_GETADDRINFO struct addrinfo hints, *ai, *cur; char namebuf[DNS_NAME_FORMATSIZE + 1]; char ownerbuf[DNS_NAME_FORMATSIZE]; @@ -544,9 +527,6 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) { } return (true); } -#else - return (true); -#endif } isc_result_t @@ -791,4 +771,3 @@ DestroySockets(void) { WSACleanup(); } #endif - diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 39083fb496..4245dca302 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -99,20 +99,6 @@ #endif #endif -#ifdef HAVE_ADDRINFO -#ifdef HAVE_GETADDRINFO -#ifdef HAVE_GAISTRERROR -#define USE_GETADDRINFO -#endif -#endif -#endif - -#ifndef USE_GETADDRINFO -#ifndef ISC_PLATFORM_NONSTDHERRNO -extern int h_errno; -#endif -#endif - #define MAXCMD (128 * 1024) #define MAXWIRE (64 * 1024) #define PACKETSIZE ((64 * 1024) - 1) diff --git a/config.h.in b/config.h.in index f94ef6ea3b..ae9a89cc7b 100644 --- a/config.h.in +++ b/config.h.in @@ -50,15 +50,6 @@ /** define if tzset() is available */ #undef HAVE_TZSET -/** define if struct addrinfo exists */ -#undef HAVE_ADDRINFO - -/** define if getaddrinfo() exists */ -#undef HAVE_GETADDRINFO - -/** define if gai_strerror() exists */ -#undef HAVE_GAISTRERROR - /** * define if pthread_setconcurrency() should be called to tell the * OS how many threads we might want to run. @@ -486,18 +477,6 @@ /* Use HMAC-SHA256 for Client Cookie generation */ #undef HMAC_SHA256_CC -/* return type of gai_strerror */ -#undef IRS_GAISTRERROR_RETURN_T - -/* Define to the buffer length type used by getnameinfo(3). */ -#undef IRS_GETNAMEINFO_BUFLEN_T - -/* Define to the flags type used by getnameinfo(3). */ -#undef IRS_GETNAMEINFO_FLAGS_T - -/* Define to the sockaddr length type used by getnameinfo(3). */ -#undef IRS_GETNAMEINFO_SOCKLEN_T - /* Define if you want to use inline buffers */ #undef ISC_BUFFER_USEINLINE diff --git a/config.h.win32 b/config.h.win32 index 85510eeb0d..5ad82bc368 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -289,27 +289,6 @@ typedef __int64 off_t; */ @HAVE_LIBXML2@ -/** define if struct addrinfo exists */ -#define HAVE_ADDRINFO - -/** define if getaddrinfo() exists */ -#define HAVE_GETADDRINFO - -/** define if gai_strerror() exists */ -#define HAVE_GAISTRERROR - -/* return type of gai_strerror */ -#define IRS_GAISTRERROR_RETURN_T char * - -/* Define to the buffer length type used by getnameinfo(3). */ -#define IRS_GETNAMEINFO_BUFLEN_T DWORD - -/* Define to the flags type used by getnameinfo(3). */ -#define IRS_GETNAMEINFO_FLAGS_T int - -/* Define to the sockaddr length type used by getnameinfo(3). */ -#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t - /* Define to enable "rrset-order fixed" syntax. */ @DNS_RDATASET_FIXED@ diff --git a/configure b/configure index e9b21a2089..62bc03e878 100755 --- a/configure +++ b/configure @@ -735,8 +735,6 @@ ISC_PLATFORM_NEEDSTRLCPY GENRANDOMLIB ISC_PLATFORM_NEEDSTRTOUL ISC_PLATFORM_NEEDMEMMOVE -ISC_IRS_GETNAMEINFOSOCKLEN -ISC_IRS_NEEDADDRINFO ISC_PLATFORM_HAVETFO ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ @@ -17964,187 +17962,6 @@ $as_echo "disabled" >&6; } esac -# -# Check for addrinfo -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct addrinfo" >&5 -$as_echo_n "checking for struct addrinfo... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main () -{ -struct addrinfo a; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO" - $as_echo "#define HAVE_ADDRINFO 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -# -# Sadly, the definitions of system-supplied getnameinfo(3) vary. Try to catch -# known variations here: -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo prototype definitions" >&5 -$as_echo_n "checking for getnameinfo prototype definitions... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -int getnameinfo(const struct sockaddr *, socklen_t, char *, - socklen_t, char *, socklen_t, unsigned int); -int -main () -{ - return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: socklen_t for buflen; u_int for flags" >&5 -$as_echo "socklen_t for buflen; u_int for flags" >&6; } - -$as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h - - -$as_echo "#define IRS_GETNAMEINFO_BUFLEN_T socklen_t" >>confdefs.h - - -$as_echo "#define IRS_GETNAMEINFO_FLAGS_T unsigned int" >>confdefs.h - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -int getnameinfo(const struct sockaddr *, socklen_t, char *, - size_t, char *, size_t, int); -int -main () -{ - return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t for buflen; int for flags" >&5 -$as_echo "size_t for buflen; int for flags" >&6; } - $as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h - - $as_echo "#define IRS_GETNAMEINFO_BUFLEN_T size_t" >>confdefs.h - - $as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -int getnameinfo(const struct sockaddr *, size_t, char *, - size_t, char *, size_t, int); -int -main () -{ - return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t for buflen; int for flags" >&5 -$as_echo "size_t for buflen; int for flags" >&6; } - $as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T size_t" >>confdefs.h - - $as_echo "#define IRS_GETNAMEINFO_BUFLEN_T size_t" >>confdefs.h - - $as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not match any subspecies; assume standard definition" >&5 -$as_echo "not match any subspecies; assume standard definition" >&6; } -$as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h - -$as_echo "#define IRS_GETNAMEINFO_BUFLEN_T socklen_t" >>confdefs.h - -$as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -# -# ...and same for gai_strerror(). -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gai_strerror prototype definitions" >&5 -$as_echo_n "checking for gai_strerror prototype definitions... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -char *gai_strerror(int ecode); -int -main () -{ - return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: returning char *" >&5 -$as_echo "returning char *" >&6; } - -$as_echo "#define IRS_GAISTRERROR_RETURN_T char *" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not match any subspecies; assume standard definition" >&5 -$as_echo "not match any subspecies; assume standard definition" >&6; } -$as_echo "#define IRS_GAISTRERROR_RETURN_T const char *" >>confdefs.h - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" -if test "x$ac_cv_func_getaddrinfo" = xyes; then : - $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h - -fi - -ac_fn_c_check_func "$LINENO" "gai_strerror" "ac_cv_func_gai_strerror" -if test "x$ac_cv_func_gai_strerror" = xyes; then : - $as_echo "#define HAVE_GAISTRERROR 1" >>confdefs.h - -fi - - - # Check whether --enable-getifaddrs was given. if test "${enable_getifaddrs+set}" = set; then : enableval=$enable_getifaddrs; want_getifaddrs="$enableval" diff --git a/configure.in b/configure.in index 35c618a19e..e7fe188ec1 100644 --- a/configure.in +++ b/configure.in @@ -2011,86 +2011,6 @@ int has_tfo() { return (0); } esac AC_SUBST(ISC_PLATFORM_HAVETFO) -# -# Check for addrinfo -# -AC_MSG_CHECKING(for struct addrinfo) -AC_TRY_COMPILE([ -#include ], -[struct addrinfo a; return (0);], - [AC_MSG_RESULT(yes) - ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO" - AC_DEFINE(HAVE_ADDRINFO)], - [AC_MSG_RESULT(no) - ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"]) -AC_SUBST(ISC_IRS_NEEDADDRINFO) - -# -# Sadly, the definitions of system-supplied getnameinfo(3) vary. Try to catch -# known variations here: -# -AC_MSG_CHECKING(for getnameinfo prototype definitions) -AC_TRY_COMPILE([ -#include -#include -#include -int getnameinfo(const struct sockaddr *, socklen_t, char *, - socklen_t, char *, socklen_t, unsigned int);], -[ return (0);], - [AC_MSG_RESULT(socklen_t for buflen; u_int for flags) - AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t, - [Define to the sockaddr length type used by getnameinfo(3).]) - AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t, - [Define to the buffer length type used by getnameinfo(3).]) - AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int, - [Define to the flags type used by getnameinfo(3).])], -[AC_TRY_COMPILE([ -#include -#include -#include -int getnameinfo(const struct sockaddr *, socklen_t, char *, - size_t, char *, size_t, int);], -[ return (0);], - [AC_MSG_RESULT(size_t for buflen; int for flags) - AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t) - AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t) - AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)], -[AC_TRY_COMPILE([ -#include -#include -#include -int getnameinfo(const struct sockaddr *, size_t, char *, - size_t, char *, size_t, int);], -[ return (0);], - [AC_MSG_RESULT(size_t for buflen; int for flags) - AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, size_t) - AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t) - AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)], -[AC_MSG_RESULT(not match any subspecies; assume standard definition) -AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t) -AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t) -AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])]) - -# -# ...and same for gai_strerror(). -# -AC_MSG_CHECKING(for gai_strerror prototype definitions) -AC_TRY_COMPILE([ -#include -#include -#include -char *gai_strerror(int ecode);], -[ return (0); ], - [AC_MSG_RESULT(returning char *) - AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *], - [return type of gai_strerror])], -[AC_MSG_RESULT(not match any subspecies; assume standard definition) -AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])]) - -AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO)) -AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR)) -AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN) - AC_ARG_ENABLE(getifaddrs, AS_HELP_STRING([--enable-getifaddrs], [enable the use of getifaddrs() [yes|no].]), diff --git a/contrib/queryperf/config.h.in b/contrib/queryperf/config.h.in index 744afdde31..d25bc55fe2 100644 --- a/contrib/queryperf/config.h.in +++ b/contrib/queryperf/config.h.in @@ -1,14 +1,8 @@ /* config.h.in. Generated from configure.in by autoheader. */ -/* Define to 1 if you have the `getaddrinfo' function. */ -#undef HAVE_GETADDRINFO - /* Define to 1 if you have the `gethostbyname2' function. */ #undef HAVE_GETHOSTBYNAME2 -/* Define to 1 if you have the `getnameinfo' function. */ -#undef HAVE_GETNAMEINFO - /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL @@ -30,6 +24,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION diff --git a/contrib/queryperf/configure b/contrib/queryperf/configure index 4de92ee898..2c0071b1b9 100755 --- a/contrib/queryperf/configure +++ b/contrib/queryperf/configure @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -211,21 +235,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -327,6 +355,14 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -448,6 +484,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -482,16 +522,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -503,28 +543,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1076,8 +1096,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1302,9 +1320,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1380,7 +1398,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1470,7 +1488,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1842,7 +1860,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1882,7 +1900,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1935,7 +1953,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1976,7 +1994,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2034,7 +2052,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2078,7 +2096,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2524,8 +2542,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2887,34 +2904,6 @@ _ACEOF fi done -ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" -if test "x$ac_cv_func_getaddrinfo" = xyes; then : - -$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" getaddrinfo.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" - ;; -esac - -fi - -ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = xyes; then : - -$as_echo "#define HAVE_GETNAMEINFO 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" getnameinfo.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getnameinfo.$ac_objext" - ;; -esac - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5 $as_echo_n "checking for socklen_t... " >&6; } @@ -3394,16 +3383,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -3463,28 +3452,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -3506,7 +3483,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3568,10 +3545,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -3659,7 +3636,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/contrib/queryperf/configure.in b/contrib/queryperf/configure.in index 442e8199db..beb5bf9656 100644 --- a/contrib/queryperf/configure.in +++ b/contrib/queryperf/configure.in @@ -58,12 +58,6 @@ AC_SEARCH_LIBS(res_9_mkquery, resolv bind) AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, inet_ntoa) AC_CHECK_FUNCS(gethostbyname2) -AC_CHECK_FUNC(getaddrinfo, - AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the `getaddrinfo' function.]), - [AC_LIBOBJ(getaddrinfo)]) -AC_CHECK_FUNC(getnameinfo, - AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the `getnameinfo' function.]), - [AC_LIBOBJ(getnameinfo)]) AC_TYPE_SOCKLEN_T AC_SA_LEN diff --git a/contrib/queryperf/missing/addrinfo.h b/contrib/queryperf/missing/addrinfo.h deleted file mode 100644 index 54a5e85bd8..0000000000 --- a/contrib/queryperf/missing/addrinfo.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef HAVE_GETADDRINFO - -/* - * Error return codes from getaddrinfo() - */ -#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with hostname */ -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_BADHINTS 12 -#define EAI_PROTOCOL 13 -#define EAI_MAX 14 - -/* - * Flag values for getaddrinfo() - */ -#define AI_PASSIVE 0x00000001 /* get address to use bind() */ -#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ -#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ -/* valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) - -#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ -#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ -#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ -#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ -/* special recommended flags for getipnodebyname */ -#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) - -/* - * Constants for getnameinfo() - */ -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 - -/* - * Flag values for getnameinfo() - */ -#define NI_NOFQDN 0x00000001 -#define NI_NUMERICHOST 0x00000002 -#define NI_NAMEREQD 0x00000004 -#define NI_NUMERICSERV 0x00000008 -#define NI_DGRAM 0x00000010 - -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; - -struct sockaddr_storage { - u_char __ss_len; - u_char __ss_family; - u_char fill[126]; -}; - -extern void freehostent(struct hostent *); -extern char *gai_strerror(int); -#endif diff --git a/contrib/queryperf/missing/getaddrinfo.c b/contrib/queryperf/missing/getaddrinfo.c deleted file mode 100644 index 69eb748c0f..0000000000 --- a/contrib/queryperf/missing/getaddrinfo.c +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "addrinfo.h" - -#define SUCCESS 0 -#define ANY 0 -#define YES 1 -#define NO 0 - -static const char in_addrany[] = { 0, 0, 0, 0 }; -static const char in6_addrany[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -static const char in_loopback[] = { 127, 0, 0, 1 }; -static const char in6_loopback[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 -}; - -struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; -}; - -static struct afd { - int a_af; - int a_addrlen; - int a_socklen; - int a_off; - const char *a_addrany; - const char *a_loopback; -} afdl [] = { -#ifdef INET6 -#define N_INET6 0 - {PF_INET6, sizeof(struct in6_addr), - sizeof(struct sockaddr_in6), - offsetof(struct sockaddr_in6, sin6_addr), - in6_addrany, in6_loopback}, -#define N_INET 1 -#else -#define N_INET 0 -#endif - {PF_INET, sizeof(struct in_addr), - sizeof(struct sockaddr_in), - offsetof(struct sockaddr_in, sin_addr), - in_addrany, in_loopback}, - {0, 0, 0, 0, NULL, NULL}, -}; - -#ifdef INET6 -#define PTON_MAX 16 -#else -#define PTON_MAX 4 -#endif - - -static int get_name(const char *, struct afd *, - struct addrinfo **, char *, struct addrinfo *, - int); -static int get_addr(const char *, int, struct addrinfo **, - struct addrinfo *, int); -static int get_addr0(const char *, int, struct addrinfo **, - struct addrinfo *, int); -static int str_isnumber(const char *); - -static char *ai_errlist[] = { - "Success", - "Address family for hostname not supported", /* EAI_ADDRFAMILY */ - "Temporary failure in name resolution", /* EAI_AGAIN */ - "Invalid value for ai_flags", /* EAI_BADFLAGS */ - "Non-recoverable failure in name resolution", /* EAI_FAIL */ - "ai_family not supported", /* EAI_FAMILY */ - "Memory allocation failure", /* EAI_MEMORY */ - "No address associated with hostname", /* EAI_NODATA */ - "hostname nor servname provided, or not known",/* EAI_NONAME */ - "servname not supported for ai_socktype", /* EAI_SERVICE */ - "ai_socktype not supported", /* EAI_SOCKTYPE */ - "System error returned in errno", /* EAI_SYSTEM */ - "Invalid value for hints", /* EAI_BADHINTS */ - "Resolved protocol is unknown", /* EAI_PROTOCOL */ - "Unknown error", /* EAI_MAX */ -}; - -#define GET_CANONNAME(ai, str) \ -if (pai->ai_flags & AI_CANONNAME) {\ - if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\ - strcpy((ai)->ai_canonname, (str));\ - } else {\ - error = EAI_MEMORY;\ - goto free;\ - }\ -} - -#ifdef HAVE_SA_LEN -#define SET_AILEN(ai,l) (ai)->ai_addr->sa_len = (ai)->ai_addrlen = (l) -#else -#define SET_AILEN(ai,l) (ai)->ai_addrlen = (l) -#endif - -#define GET_AI(ai, afd, addr, port) {\ - char *p;\ - if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\ - ((afd)->a_socklen)))\ - == NULL) {\ - error = EAI_MEMORY;\ - goto free;\ - }\ - memcpy(ai, pai, sizeof(struct addrinfo));\ - (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\ - memset((ai)->ai_addr, 0, (afd)->a_socklen);\ - SET_AILEN((ai), (afd)->a_socklen);\ - (ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\ - ((struct sockinet *)(ai)->ai_addr)->si_port = port;\ - p = (char *)((ai)->ai_addr);\ - memcpy(p + (afd)->a_off, (addr), (afd)->a_addrlen);\ -} - -#define ERR(err) { error = (err); goto bad; } - -char * -gai_strerror(ecode) - int ecode; -{ - if (ecode < 0 || ecode > EAI_MAX) - ecode = EAI_MAX; - return ai_errlist[ecode]; -} - -void -freeaddrinfo(ai) - struct addrinfo *ai; -{ - struct addrinfo *next; - - do { - next = ai->ai_next; - if (ai->ai_canonname) - free(ai->ai_canonname); - /* no need to free(ai->ai_addr) */ - free(ai); - } while ((ai = next) != NULL); -} - -static int -str_isnumber(p) - const char *p; -{ - char *q = (char *)p; - while (*q) { - if (! isdigit(*q)) - return NO; - q++; - } - return YES; -} - -int -getaddrinfo(hostname, servname, hints, res) - const char *hostname, *servname; - const struct addrinfo *hints; - struct addrinfo **res; -{ - struct addrinfo sentinel; - struct addrinfo *top = NULL; - struct addrinfo *cur; - int i, error = 0; - char pton[PTON_MAX]; - struct addrinfo ai; - struct addrinfo *pai; - u_short port; - - /* initialize file static vars */ - sentinel.ai_next = NULL; - cur = &sentinel; - pai = &ai; - pai->ai_flags = 0; - pai->ai_family = PF_UNSPEC; - pai->ai_socktype = ANY; - pai->ai_protocol = ANY; - pai->ai_addrlen = 0; - pai->ai_canonname = NULL; - pai->ai_addr = NULL; - pai->ai_next = NULL; - port = ANY; - - if (hostname == NULL && servname == NULL) - return EAI_NONAME; - if (hints) { - /* error check for hints */ - if (hints->ai_addrlen || hints->ai_canonname || - hints->ai_addr || hints->ai_next) - ERR(EAI_BADHINTS); /* xxx */ - if (hints->ai_flags & ~AI_MASK) - ERR(EAI_BADFLAGS); - switch (hints->ai_family) { - case PF_UNSPEC: - case PF_INET: -#ifdef INET6 - case PF_INET6: -#endif - break; - default: - ERR(EAI_FAMILY); - } - memcpy(pai, hints, sizeof(*pai)); - switch (pai->ai_socktype) { - case ANY: - switch (pai->ai_protocol) { - case ANY: - break; - case IPPROTO_UDP: - pai->ai_socktype = SOCK_DGRAM; - break; - case IPPROTO_TCP: - pai->ai_socktype = SOCK_STREAM; - break; - default: - pai->ai_socktype = SOCK_RAW; - break; - } - break; - case SOCK_RAW: - break; - case SOCK_DGRAM: - if (pai->ai_protocol != IPPROTO_UDP && - pai->ai_protocol != ANY) - ERR(EAI_BADHINTS); /*xxx*/ - pai->ai_protocol = IPPROTO_UDP; - break; - case SOCK_STREAM: - if (pai->ai_protocol != IPPROTO_TCP && - pai->ai_protocol != ANY) - ERR(EAI_BADHINTS); /*xxx*/ - pai->ai_protocol = IPPROTO_TCP; - break; - default: - ERR(EAI_SOCKTYPE); - break; - } - } - - /* - * service port - */ - if (servname) { - if (str_isnumber(servname)) { - if (pai->ai_socktype == ANY) { - /* caller accept *ANY* socktype */ - pai->ai_socktype = SOCK_DGRAM; - pai->ai_protocol = IPPROTO_UDP; - } - port = htons(atoi(servname)); - } else { - struct servent *sp; - char *proto; - - proto = NULL; - switch (pai->ai_socktype) { - case ANY: - proto = NULL; - break; - case SOCK_DGRAM: - proto = "udp"; - break; - case SOCK_STREAM: - proto = "tcp"; - break; - default: - fprintf(stderr, "panic!\n"); - break; - } - if ((sp = getservbyname(servname, proto)) == NULL) - ERR(EAI_SERVICE); - port = sp->s_port; - if (pai->ai_socktype == ANY) { - if (strcmp(sp->s_proto, "udp") == 0) { - pai->ai_socktype = SOCK_DGRAM; - pai->ai_protocol = IPPROTO_UDP; - } else if (strcmp(sp->s_proto, "tcp") == 0) { - pai->ai_socktype = SOCK_STREAM; - pai->ai_protocol = IPPROTO_TCP; - } else - ERR(EAI_PROTOCOL); /*xxx*/ - } - } - } - - /* - * hostname == NULL. - * passive socket -> anyaddr (0.0.0.0 or ::) - * non-passive socket -> localhost (127.0.0.1 or ::1) - */ - if (hostname == NULL) { - struct afd *afd; - int s; - - for (afd = &afdl[0]; afd->a_af; afd++) { - if (!(pai->ai_family == PF_UNSPEC - || pai->ai_family == afd->a_af)) { - continue; - } - - /* - * filter out AFs that are not supported by the kernel - * XXX errno? - */ - s = socket(afd->a_af, SOCK_DGRAM, 0); - if (s < 0) - continue; - close(s); - - if (pai->ai_flags & AI_PASSIVE) { - GET_AI(cur->ai_next, afd, afd->a_addrany, port); - /* xxx meaningless? - * GET_CANONNAME(cur->ai_next, "anyaddr"); - */ - } else { - GET_AI(cur->ai_next, afd, afd->a_loopback, - port); - /* xxx meaningless? - * GET_CANONNAME(cur->ai_next, "localhost"); - */ - } - cur = cur->ai_next; - } - top = sentinel.ai_next; - if (top) - goto good; - else - ERR(EAI_FAMILY); - } - - /* hostname as numeric name */ - for (i = 0; afdl[i].a_af; i++) { - if (inet_pton(afdl[i].a_af, hostname, pton) == 1) { - u_long v4a; - u_char pfx; - - switch (afdl[i].a_af) { - case AF_INET: - v4a = ntohl(((struct in_addr *)pton)->s_addr); - if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) - pai->ai_flags &= ~AI_CANONNAME; - v4a >>= IN_CLASSA_NSHIFT; - if (v4a == 0 || v4a == IN_LOOPBACKNET) - pai->ai_flags &= ~AI_CANONNAME; - break; -#ifdef INET6 - case AF_INET6: - pfx = ((struct in6_addr *)pton)->s6_addr[0]; - if (pfx == 0 || pfx == 0xfe || pfx == 0xff) - pai->ai_flags &= ~AI_CANONNAME; - break; -#endif - } - - if (pai->ai_family == afdl[i].a_af || - pai->ai_family == PF_UNSPEC) { - if (! (pai->ai_flags & AI_CANONNAME)) { - GET_AI(top, &afdl[i], pton, port); - goto good; - } - /* - * if AI_CANONNAME and if reverse lookup - * fail, return ai anyway to pacify - * calling application. - * - * XXX getaddrinfo() is a name->address - * translation function, and it looks strange - * that we do addr->name translation here. - */ - get_name(pton, &afdl[i], &top, pton, pai, port); - goto good; - } else - ERR(EAI_FAMILY); /*xxx*/ - } - } - - if (pai->ai_flags & AI_NUMERICHOST) - ERR(EAI_NONAME); - - /* hostname as alphabetical name */ - error = get_addr(hostname, pai->ai_family, &top, pai, port); - if (error == 0) { - if (top) { - good: - *res = top; - return SUCCESS; - } else - error = EAI_FAIL; - } - free: - if (top) - freeaddrinfo(top); - bad: - *res = NULL; - return error; -} - -static int -get_name(addr, afd, res, numaddr, pai, port0) - const char *addr; - struct afd *afd; - struct addrinfo **res; - char *numaddr; - struct addrinfo *pai; - int port0; -{ - u_short port = port0 & 0xffff; - struct hostent *hp; - struct addrinfo *cur; - int error = 0; - hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); - if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { - GET_AI(cur, afd, hp->h_addr_list[0], port); - GET_CANONNAME(cur, hp->h_name); - } else - GET_AI(cur, afd, numaddr, port); - - *res = cur; - return SUCCESS; - free: - if (cur) - freeaddrinfo(cur); - - /* bad: */ - *res = NULL; - return error; -} - -static int -get_addr(hostname, af, res0, pai, port0) - const char *hostname; - int af; - struct addrinfo **res0; - struct addrinfo *pai; - int port0; -{ - int i, error, ekeep; - struct addrinfo *cur; - struct addrinfo **res; - int retry; - int s; - - res = res0; - ekeep = 0; - error = 0; - for (i = 0; afdl[i].a_af; i++) { - retry = 0; - if (af == AF_UNSPEC) { - /* - * filter out AFs that are not supported by the kernel - * XXX errno? - */ - s = socket(afdl[i].a_af, SOCK_DGRAM, 0); - if (s < 0) - continue; - close(s); - } else { - if (af != afdl[i].a_af) - continue; - } - /* It is WRONG, we need getipnodebyname(). */ -again: - error = get_addr0(hostname, afdl[i].a_af, res, pai, port0); - switch (error) { - case EAI_AGAIN: - if (++retry < 3) - goto again; - /* FALL THROUGH*/ - default: - if (ekeep == 0) - ekeep = error; - break; - } - if (*res) { - /* make chain of addrs */ - for (cur = *res; - cur && cur->ai_next; - cur = cur->ai_next) - ; - if (!cur) - return EAI_FAIL; - res = &cur->ai_next; - } - } - - /* if we got something, it's okay */ - if (*res0) - return 0; - - return error ? error : ekeep; -} - -static int -get_addr0(hostname, af, res, pai, port0) - const char *hostname; - int af; - struct addrinfo **res; - struct addrinfo *pai; - int port0; -{ - u_short port = port0 & 0xffff; - struct addrinfo sentinel; - struct hostent *hp; - struct addrinfo *top, *cur; - struct afd *afd; - int i, error = 0, h_error; - char *ap; - - top = NULL; - sentinel.ai_next = NULL; - cur = &sentinel; - -#ifdef HAVE_GETHOSTBYNAME2 - if (af == AF_UNSPEC) { - error = EAI_FAIL; - goto bad; - } - hp = gethostbyname2(hostname, af); -#else - if (af != AF_UNSPEC && af != AF_INET) { - error = EAI_FAIL; - goto bad; - } - hp = gethostbyname(hostname); -#endif - h_error = h_errno; - - if (hp == NULL) { - switch (h_error) { - case HOST_NOT_FOUND: - case NO_DATA: - error = EAI_NODATA; - break; - case TRY_AGAIN: - error = EAI_AGAIN; - break; - case NO_RECOVERY: - case NETDB_INTERNAL: - default: - error = EAI_FAIL; - break; - } - goto bad; - } - - if ((hp->h_name == NULL) || (hp->h_name[0] == 0) || - (hp->h_addr_list[0] == NULL)) - ERR(EAI_FAIL); - - for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) { - switch (af) { -#ifdef INET6 - case AF_INET6: - afd = &afdl[N_INET6]; - break; -#endif -#ifndef INET6 - default: /* AF_UNSPEC */ -#endif - case AF_INET: - afd = &afdl[N_INET]; - break; -#ifdef INET6 - default: /* AF_UNSPEC */ - if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) { - ap += sizeof(struct in6_addr) - - sizeof(struct in_addr); - afd = &afdl[N_INET]; - } else - afd = &afdl[N_INET6]; - break; -#endif - } - GET_AI(cur->ai_next, afd, ap, port); - if (cur == &sentinel) { - top = cur->ai_next; - GET_CANONNAME(top, hp->h_name); - } - cur = cur->ai_next; - } - *res = top; - return SUCCESS; - free: - if (top) - freeaddrinfo(top); - bad: - *res = NULL; - return error; -} diff --git a/contrib/queryperf/missing/getnameinfo.c b/contrib/queryperf/missing/getnameinfo.c deleted file mode 100644 index 6b1cbe113f..0000000000 --- a/contrib/queryperf/missing/getnameinfo.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Issues to be discussed: - * - Thread safe-ness must be checked - * - Return values. There seems to be no standard for return value (RFC2553) - * but INRIA implementation returns EAI_xxx defined for getaddrinfo(). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "addrinfo.h" - -#define SUCCESS 0 -#define ANY 0 -#define YES 1 -#define NO 0 - -static struct afd { - int a_af; - int a_addrlen; - int a_socklen; - int a_off; -} afdl [] = { -#ifdef INET6 - {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6), - offsetof(struct sockaddr_in6, sin6_addr)}, -#endif - {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in), - offsetof(struct sockaddr_in, sin_addr)}, - {0, 0, 0}, -}; - -struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; -}; - -#define ENI_NOSOCKET 0 -#define ENI_NOSERVNAME 1 -#define ENI_NOHOSTNAME 2 -#define ENI_MEMORY 3 -#define ENI_SYSTEM 4 -#define ENI_FAMILY 5 -#define ENI_SALEN 6 - -int -getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) - const struct sockaddr *sa; - size_t salen; - char *host; - size_t hostlen; - char *serv; - size_t servlen; - int flags; -{ - struct afd *afd; - struct servent *sp; - struct hostent *hp; - u_short port; - int family, len, i; - char *addr, *p; - u_long v4a; - int h_error; - char numserv[512]; - char numaddr[512]; - - if (sa == NULL) - return ENI_NOSOCKET; - -#ifdef HAVE_SA_LEN - len = sa->sa_len; - if (len != salen) return ENI_SALEN; -#else - len = salen; -#endif - - family = sa->sa_family; - for (i = 0; afdl[i].a_af; i++) - if (afdl[i].a_af == family) { - afd = &afdl[i]; - goto found; - } - return ENI_FAMILY; - - found: - if (len != afd->a_socklen) return ENI_SALEN; - - port = ((struct sockinet *)sa)->si_port; /* network byte order */ - addr = (char *)sa + afd->a_off; - - if (serv == NULL || servlen == 0) { - /* what we should do? */ - } else if (flags & NI_NUMERICSERV) { - snprintf(numserv, sizeof(numserv), "%d", ntohs(port)); - if (strlen(numserv) > servlen) - return ENI_MEMORY; - strcpy(serv, numserv); - } else { - sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp"); - if (sp) { - if (strlen(sp->s_name) > servlen) - return ENI_MEMORY; - strcpy(serv, sp->s_name); - } else - return ENI_NOSERVNAME; - } - - switch (sa->sa_family) { - case AF_INET: - v4a = ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr); - if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) - flags |= NI_NUMERICHOST; - v4a >>= IN_CLASSA_NSHIFT; - if (v4a == 0 || v4a == IN_LOOPBACKNET) - flags |= NI_NUMERICHOST; - break; -#ifdef INET6 - case AF_INET6: - { - struct sockaddr_in6 *sin6; - sin6 = (struct sockaddr_in6 *)sa; - switch (sin6->sin6_addr.s6_addr[0]) { - case 0x00: - if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) - ; - else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) - ; - else - flags |= NI_NUMERICHOST; - break; - default: - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) - flags |= NI_NUMERICHOST; - else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) - flags |= NI_NUMERICHOST; - break; - } - } - break; -#endif - } - if (host == NULL || hostlen == 0) { - /* what should we do? */ - } else if (flags & NI_NUMERICHOST) { - /* NUMERICHOST and NAMEREQD conflicts with each other */ - if (flags & NI_NAMEREQD) - return ENI_NOHOSTNAME; - if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) - == NULL) - return ENI_SYSTEM; - if (strlen(numaddr) > hostlen) - return ENI_MEMORY; - strcpy(host, numaddr); - } else { -#ifdef USE_GETIPNODEBY - hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); -#else - hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); - h_error = h_errno; -#endif - - if (hp) { - if (flags & NI_NOFQDN) { - p = strchr(hp->h_name, '.'); - if (p) *p = '\0'; - } - if (strlen(hp->h_name) > hostlen) { -#ifdef USE_GETIPNODEBY - freehostent(hp); -#endif - return ENI_MEMORY; - } - strcpy(host, hp->h_name); -#ifdef USE_GETIPNODEBY - freehostent(hp); -#endif - } else { - if (flags & NI_NAMEREQD) - return ENI_NOHOSTNAME; - if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) - == NULL) - return ENI_NOHOSTNAME; - if (strlen(numaddr) > hostlen) - return ENI_MEMORY; - strcpy(host, numaddr); - } - } - return SUCCESS; -} diff --git a/contrib/queryperf/queryperf.c b/contrib/queryperf/queryperf.c index cd2feb2a1c..0dbffa95f6 100644 --- a/contrib/queryperf/queryperf.c +++ b/contrib/queryperf/queryperf.c @@ -41,9 +41,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" -#ifndef HAVE_GETADDRINFO -#include "missing/addrinfo.h" -#endif #endif /* @@ -1387,7 +1384,7 @@ parse_query(char *input, char *qname, unsigned int qnlen, int *qtype) { /* * dispatch_query: - * Send the query packet for the entry + * Send the query packet for the entry * * Return -1 on failure * Return a non-negative integer otherwise @@ -1422,7 +1419,7 @@ dispatch_query(unsigned short int id, char *dom, int qt, u_char **pktp, *p++ = 0; /* root name */ *p++ = 0; *p++ = 41; /* OPT */ - *p++ = 16; + *p++ = 16; *p++ = 0; /* UDP payload size (4K) */ *p++ = 0; /* extended rcode */ *p++ = 0; /* version */ @@ -1934,7 +1931,7 @@ print_statistics(int intermediate, unsigned int sent, unsigned int timed_out, unsigned int roverflows, unsigned int *rarray) { unsigned int num_queries_completed; - double per_lost, per_completed, per_lost2, per_completed2; + double per_lost, per_completed, per_lost2, per_completed2; double run_time, queries_per_sec, queries_per_sec2; double queries_per_sec_total; double rtt_average, rtt_stddev; @@ -2074,7 +2071,7 @@ print_statistics(int intermediate, unsigned int sent, unsigned int timed_out, } if (target_qps > 0) { printf(" Total QPS/target: %.6lf/%d qps\n", - queries_per_sec_total, target_qps); + queries_per_sec_total, target_qps); } printf("\n"); diff --git a/lib/bind9/getaddresses.c b/lib/bind9/getaddresses.c index 5daf03e8b0..c954b5f01d 100644 --- a/lib/bind9/getaddresses.c +++ b/lib/bind9/getaddresses.c @@ -28,20 +28,6 @@ #include -#ifdef HAVE_ADDRINFO -#ifdef HAVE_GETADDRINFO -#ifdef HAVE_GAISTRERROR -#define USE_GETADDRINFO -#endif -#endif -#endif - -#ifndef USE_GETADDRINFO -#ifndef ISC_PLATFORM_NONSTDHERRNO -extern int h_errno; -#endif -#endif - isc_result_t bind9_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs, int addrsize, int *addrcount) @@ -51,12 +37,8 @@ bind9_getaddresses(const char *hostname, in_port_t port, bool have_ipv4, have_ipv6; int i; -#ifdef USE_GETADDRINFO struct addrinfo *ai = NULL, *tmpai, hints; int result; -#else - struct hostent *he; -#endif REQUIRE(hostname != NULL); REQUIRE(addrs != NULL); @@ -117,7 +99,6 @@ bind9_getaddresses(const char *hostname, in_port_t port, return (ISC_R_SUCCESS); } } -#ifdef USE_GETADDRINFO memset(&hints, 0, sizeof(hints)); if (!have_ipv6) hints.ai_family = PF_INET; @@ -175,41 +156,6 @@ bind9_getaddresses(const char *hostname, in_port_t port, } freeaddrinfo(ai); *addrcount = i; -#else - he = gethostbyname(hostname); - if (he == NULL) { - switch (h_errno) { - case HOST_NOT_FOUND: -#ifdef NO_DATA - case NO_DATA: -#endif -#if defined(NO_ADDRESS) && (!defined(NO_DATA) || (NO_DATA != NO_ADDRESS)) - case NO_ADDRESS: -#endif - return (ISC_R_NOTFOUND); - default: - return (ISC_R_FAILURE); - } - } - if (he->h_addrtype != AF_INET && he->h_addrtype != AF_INET6) - return (ISC_R_NOTFOUND); - for (i = 0; i < addrsize; i++) { - if (he->h_addrtype == AF_INET) { - struct in_addr *inp; - inp = (struct in_addr *)(he->h_addr_list[i]); - if (inp == NULL) - break; - isc_sockaddr_fromin(&addrs[i], inp, port); - } else { - struct in6_addr *in6p; - in6p = (struct in6_addr *)(he->h_addr_list[i]); - if (in6p == NULL) - break; - isc_sockaddr_fromin6(&addrs[i], in6p, port); - } - } - *addrcount = i; -#endif if (*addrcount == 0) return (ISC_R_NOTFOUND); else diff --git a/lib/irs/gai_strerror.c b/lib/irs/gai_strerror.c index 76a561eee1..144ed66ece 100644 --- a/lib/irs/gai_strerror.c +++ b/lib/irs/gai_strerror.c @@ -73,7 +73,7 @@ static const char *gai_messages[] = { * Returns an error message corresponding to an error code returned by * getaddrinfo() and getnameinfo() */ -IRS_GAISTRERROR_RETURN_T +const char * gai_strerror(int ecode) { union { const char *const_ptr; diff --git a/lib/irs/getnameinfo.c b/lib/irs/getnameinfo.c index c91e39ace9..2af8aaee28 100644 --- a/lib/irs/getnameinfo.c +++ b/lib/irs/getnameinfo.c @@ -138,10 +138,10 @@ static struct afd { } while (0) int -getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, - char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen, - char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen, - IRS_GETNAMEINFO_FLAGS_T flags) +getnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, socklen_t hostlen, + char *serv, socklen_t servlen, + int flags) { struct afd *afd = NULL; struct servent *sp; diff --git a/lib/irs/include/irs/netdb.h.in b/lib/irs/include/irs/netdb.h.in index 8806045ec2..4089f9e916 100644 --- a/lib/irs/include/irs/netdb.h.in +++ b/lib/irs/include/irs/netdb.h.in @@ -17,24 +17,6 @@ #include /* Required on FreeBSD (and others?) for size_t. */ #include /* Contractual provision. */ -/* - * Define if does not declare struct addrinfo. - */ -@ISC_IRS_NEEDADDRINFO@ - -#ifdef ISC_IRS_NEEDADDRINFO -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* Length of ai_addr */ - char *ai_canonname; /* Canonical name for hostname */ - struct sockaddr *ai_addr; /* Binary address */ - struct addrinfo *ai_next; /* Next structure in linked list */ -}; -#endif - /* * Undefine all #defines we are interested in as may or may not have * defined them. @@ -187,17 +169,17 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res); int -getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, - char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen, - char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen, - IRS_GETNAMEINFO_FLAGS_T flags); +getnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, socklen_t hostlen, + char *serv, socklen_t servlen, + int flags); void freeaddrinfo (struct addrinfo *ai); -IRS_GAISTRERROR_RETURN_T +const char * gai_strerror(int ecode); -#endif +#endif /* IRS_NAMESPACE */ /* * Tell Emacs to use C mode on this file. From 1e1804bb961332efc11d1956e9954f8f3cfd65da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 15:04:40 +0200 Subject: [PATCH 22/30] getifaddrs() is available on all supported Unix platforms (Linux, BSDs, macOS and Solaris) --- configure | 71 --- configure.in | 42 -- lib/isc/unix/ifiter_ioctl.c | 818 ----------------------------------- lib/isc/unix/ifiter_sysctl.c | 281 ------------ lib/isc/unix/interfaceiter.c | 6 - 5 files changed, 1218 deletions(-) delete mode 100644 lib/isc/unix/ifiter_ioctl.c delete mode 100644 lib/isc/unix/ifiter_sysctl.c diff --git a/configure b/configure index 62bc03e878..dff9c52199 100755 --- a/configure +++ b/configure @@ -949,7 +949,6 @@ with_gperftools_profiler enable_backtrace enable_symtable enable_tcp_fastopen -enable_getifaddrs with_readline enable_isc_spnego enable_chroot @@ -1639,7 +1638,6 @@ Optional Features: --enable-symtable use internal symbol table for backtrace [all|minimal(default)|none] --disable-tcp-fastopen disable TCP Fast Open support [default=autodetect] - --enable-getifaddrs enable the use of getifaddrs() [yes|no]. --disable-isc-spnego use SPNEGO from GSSAPI library --disable-chroot disable chroot --disable-linux-caps disable Linux capabilities @@ -17962,75 +17960,6 @@ $as_echo "disabled" >&6; } esac -# Check whether --enable-getifaddrs was given. -if test "${enable_getifaddrs+set}" = set; then : - enableval=$enable_getifaddrs; want_getifaddrs="$enableval" -else - want_getifaddrs="yes" -fi - - -# -# This interface iteration code for getifaddrs() will fall back to using -# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6 -# addresses. -# -case $want_getifaddrs in -glibc) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"--enable-getifaddrs=glibc is no longer required\"" >&5 -$as_echo "$as_me: WARNING: \"--enable-getifaddrs=glibc is no longer required\"" >&2;} -ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" -if test "x$ac_cv_func_getifaddrs" = xyes; then : - $as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h - -fi - -;; -yes) -ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" -if test "x$ac_cv_func_getifaddrs" = xyes; then : - $as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h - -fi - -;; -no) -;; -esac - -# -# Look for a sysctl call to get the list of network interfaces. -# -case $ac_cv_header_sys_sysctl_h in -yes) -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for interface list sysctl" >&5 -$as_echo_n "checking for interface list sysctl... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#ifdef NET_RT_IFLIST -found_rt_iflist -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "found_rt_iflist" >/dev/null 2>&1; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - $as_echo "#define HAVE_IFLIST_SYSCTL 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f conftest* - -;; -esac - # # Check for some other useful functions that are not ever-present. # diff --git a/configure.in b/configure.in index e7fe188ec1..21f80c2120 100644 --- a/configure.in +++ b/configure.in @@ -2011,48 +2011,6 @@ int has_tfo() { return (0); } esac AC_SUBST(ISC_PLATFORM_HAVETFO) -AC_ARG_ENABLE(getifaddrs, - AS_HELP_STRING([--enable-getifaddrs], - [enable the use of getifaddrs() [yes|no].]), - want_getifaddrs="$enableval", want_getifaddrs="yes") - -# -# This interface iteration code for getifaddrs() will fall back to using -# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6 -# addresses. -# -case $want_getifaddrs in -glibc) -AC_MSG_WARN("--enable-getifaddrs=glibc is no longer required") -AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS)) -;; -yes) -AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS)) -;; -no) -;; -esac - -# -# Look for a sysctl call to get the list of network interfaces. -# -case $ac_cv_header_sys_sysctl_h in -yes) -AC_MSG_CHECKING(for interface list sysctl) -AC_EGREP_CPP(found_rt_iflist, [ -#include -#include -#include -#ifdef NET_RT_IFLIST -found_rt_iflist -#endif -], - [AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_IFLIST_SYSCTL)], - [AC_MSG_RESULT(no)]) -;; -esac - # # Check for some other useful functions that are not ever-present. # diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c deleted file mode 100644 index 3fa64537ac..0000000000 --- a/lib/isc/unix/ifiter_ioctl.c +++ /dev/null @@ -1,818 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -#include - -#include - -/*! \file - * \brief - * Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. - * See netintro(4). - */ - -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) -#ifdef ISC_PLATFORM_HAVEIF_LADDRCONF -#define lifc_len iflc_len -#define lifc_buf iflc_buf -#define lifc_req iflc_req -#define LIFCONF if_laddrconf -#else -#define ISC_HAVE_LIFC_FAMILY 1 -#define ISC_HAVE_LIFC_FLAGS 1 -#define LIFCONF lifconf -#endif - -#ifdef ISC_PLATFORM_HAVEIF_LADDRREQ -#define lifr_addr iflr_addr -#define lifr_name iflr_name -#define lifr_dstaddr iflr_dstaddr -#define lifr_flags iflr_flags -#define ss_family sa_family -#define LIFREQ if_laddrreq -#else -#define LIFREQ lifreq -#endif -#endif - -#define IFITER_MAGIC ISC_MAGIC('I', 'F', 'I', 'T') -#define VALID_IFITER(t) ISC_MAGIC_VALID(t, IFITER_MAGIC) - -struct isc_interfaceiter { - unsigned int magic; /* Magic number. */ - isc_mem_t *mctx; - int mode; - int socket; - struct ifconf ifc; - void *buf; /* Buffer for sysctl data. */ - unsigned int bufsize; /* Bytes allocated. */ - unsigned int pos; /* Current offset in - SIOCGIFCONF data */ -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - int socket6; - struct LIFCONF lifc; - void *buf6; /* Buffer for sysctl data. */ - unsigned int bufsize6; /* Bytes allocated. */ - unsigned int pos6; /* Current offset in - SIOCGLIFCONF data */ - isc_result_t result6; /* Last result code. */ - bool first6; -#endif -#ifdef __linux - FILE * proc; - char entry[ISC_IF_INET6_SZ]; - isc_result_t valid; -#endif - isc_interface_t current; /* Current interface data. */ - isc_result_t result; /* Last result code. */ -}; - -/*% - * Size of buffer for SIOCGLIFCONF, in bytes. We assume no sane system - * will have more than a megabyte of interface configuration data. - */ -#define IFCONF_BUFSIZE_INITIAL 4096 -#define IFCONF_BUFSIZE_MAX 1048576 - -#ifdef __linux -#ifndef IF_NAMESIZE -# ifdef IFNAMSIZ -# define IF_NAMESIZE IFNAMSIZ -# else -# define IF_NAMESIZE 16 -# endif -#endif -#endif - -static isc_result_t -getbuf4(isc_interfaceiter_t *iter) { - char strbuf[ISC_STRERRORSIZE]; - - iter->bufsize = IFCONF_BUFSIZE_INITIAL; - - for (;;) { - iter->buf = isc_mem_get(iter->mctx, iter->bufsize); - if (iter->buf == NULL) - return (ISC_R_NOMEMORY); - - memset(&iter->ifc.ifc_len, 0, sizeof(iter->ifc.ifc_len)); - iter->ifc.ifc_len = iter->bufsize; - iter->ifc.ifc_buf = iter->buf; - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion". It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(iter->socket, SIOCGIFCONF, (char *)&iter->ifc) - == -1) { - if (errno != EINVAL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETIFCONFIG, - "get interface " - "configuration: %s"), - strbuf); - goto unexpected; - } - /* - * EINVAL. Retry with a bigger buffer. - */ - } else { - /* - * The ioctl succeeded. - * Some OS's just return what will fit rather - * than set EINVAL if the buffer is too small - * to fit all the interfaces in. If - * ifc.lifc_len is too near to the end of the - * buffer we will grow it just in case and - * retry. - */ - if (iter->ifc.ifc_len + 2 * sizeof(struct ifreq) - < iter->bufsize) - break; - } - if (iter->bufsize >= IFCONF_BUFSIZE_MAX) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_BUFFERMAX, - "get interface " - "configuration: " - "maximum buffer " - "size exceeded")); - goto unexpected; - } - isc_mem_put(iter->mctx, iter->buf, iter->bufsize); - - iter->bufsize *= 2; - } - return (ISC_R_SUCCESS); - - unexpected: - isc_mem_put(iter->mctx, iter->buf, iter->bufsize); - iter->buf = NULL; - return (ISC_R_UNEXPECTED); -} - -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) -static isc_result_t -getbuf6(isc_interfaceiter_t *iter) { - char strbuf[ISC_STRERRORSIZE]; - isc_result_t result; - - iter->bufsize6 = IFCONF_BUFSIZE_INITIAL; - - for (;;) { - iter->buf6 = isc_mem_get(iter->mctx, iter->bufsize6); - if (iter->buf6 == NULL) - return (ISC_R_NOMEMORY); - - memset(&iter->lifc, 0, sizeof(iter->lifc)); -#ifdef ISC_HAVE_LIFC_FAMILY - iter->lifc.lifc_family = AF_INET6; -#endif -#ifdef ISC_HAVE_LIFC_FLAGS - iter->lifc.lifc_flags = 0; -#endif - iter->lifc.lifc_len = iter->bufsize6; - iter->lifc.lifc_buf = iter->buf6; - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion". It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(iter->socket6, SIOCGLIFCONF, (char *)&iter->lifc) - == -1) { - if (errno != EINVAL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETIFCONFIG, - "get interface " - "configuration: %s"), - strbuf); - result = ISC_R_UNEXPECTED; - goto cleanup; - } - /* - * EINVAL. Retry with a bigger buffer. - */ - } else { - /* - * The ioctl succeeded. - * Some OS's just return what will fit rather - * than set EINVAL if the buffer is too small - * to fit all the interfaces in. If - * ifc.ifc_len is too near to the end of the - * buffer we will grow it just in case and - * retry. - */ - if (iter->lifc.lifc_len + 2 * sizeof(struct LIFREQ) - < iter->bufsize6) - break; - } - if (iter->bufsize6 >= IFCONF_BUFSIZE_MAX) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_BUFFERMAX, - "get interface " - "configuration: " - "maximum buffer " - "size exceeded")); - result = ISC_R_UNEXPECTED; - goto cleanup; - } - isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6); - - iter->bufsize6 *= 2; - } - - if (iter->lifc.lifc_len != 0) - iter->mode = 6; - return (ISC_R_SUCCESS); - - cleanup: - isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6); - iter->buf6 = NULL; - return (result); -} -#endif - -isc_result_t -isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { - isc_interfaceiter_t *iter; - isc_result_t result; - char strbuf[ISC_STRERRORSIZE]; - - REQUIRE(mctx != NULL); - REQUIRE(iterp != NULL); - REQUIRE(*iterp == NULL); - - iter = isc_mem_get(mctx, sizeof(*iter)); - if (iter == NULL) - return (ISC_R_NOMEMORY); - - iter->mctx = mctx; - iter->mode = 4; - iter->buf = NULL; - iter->pos = (unsigned int) -1; -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - iter->buf6 = NULL; - iter->pos6 = (unsigned int) -1; - iter->result6 = ISC_R_NOMORE; - iter->socket6 = -1; - iter->first6 = false; -#endif - - /* - * Get the interface configuration, allocating more memory if - * necessary. - */ - -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - result = isc_net_probeipv6(); - if (result == ISC_R_SUCCESS) { - /* - * Create an unbound datagram socket to do the SIOCGLIFCONF - * ioctl on. HP/UX requires an AF_INET6 socket for - * SIOCGLIFCONF to get IPv6 addresses. - */ - if ((iter->socket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_MAKESCANSOCKET, - "making interface " - "scan socket: %s"), - strbuf); - result = ISC_R_UNEXPECTED; - goto socket6_failure; - } - result = iter->result6 = getbuf6(iter); - if (result != ISC_R_NOTIMPLEMENTED && result != ISC_R_SUCCESS) - goto ioctl6_failure; - } -#endif - if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_MAKESCANSOCKET, - "making interface " - "scan socket: %s"), - strbuf); - result = ISC_R_UNEXPECTED; - goto socket_failure; - } - result = getbuf4(iter); - if (result != ISC_R_SUCCESS) - goto ioctl_failure; - - /* - * A newly created iterator has an undefined position - * until isc_interfaceiter_first() is called. - */ -#ifdef __linux - iter->proc = fopen("/proc/net/if_inet6", "r"); - iter->valid = ISC_R_FAILURE; -#endif - iter->result = ISC_R_FAILURE; - - iter->magic = IFITER_MAGIC; - *iterp = iter; - return (ISC_R_SUCCESS); - - ioctl_failure: - if (iter->buf != NULL) - isc_mem_put(mctx, iter->buf, iter->bufsize); - (void) close(iter->socket); - - socket_failure: -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - if (iter->buf6 != NULL) - isc_mem_put(mctx, iter->buf6, iter->bufsize6); - ioctl6_failure: - if (iter->socket6 != -1) - (void) close(iter->socket6); - socket6_failure: -#endif - - isc_mem_put(mctx, iter, sizeof(*iter)); - return (result); -} - -/* - * Get information about the current interface to iter->current. - * If successful, return ISC_R_SUCCESS. - * If the interface has an unsupported address family, or if - * some operation on it fails, return ISC_R_IGNORE to make - * the higher-level iterator code ignore it. - */ - -static isc_result_t -internal_current4(isc_interfaceiter_t *iter) { - struct ifreq *ifrp; - struct ifreq ifreq; - int family; - char strbuf[ISC_STRERRORSIZE]; -#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR) - struct lifreq lifreq; -#else - char sabuf[256]; -#endif - int i, bits, prefixlen; - - REQUIRE(VALID_IFITER(iter)); - - if (iter->ifc.ifc_len == 0 || - iter->pos == (unsigned int)iter->ifc.ifc_len) { -#ifdef __linux - return (linux_if_inet6_current(iter)); -#else - return (ISC_R_NOMORE); -#endif - } - - INSIST( iter->pos < (unsigned int) iter->ifc.ifc_len); - - ifrp = (struct ifreq *)((char *) iter->ifc.ifc_req + iter->pos); - - memset(&ifreq, 0, sizeof(ifreq)); - memmove(&ifreq, ifrp, sizeof(ifreq)); - - family = ifreq.ifr_addr.sa_family; - if (family != AF_INET && family != AF_INET6) - return (ISC_R_IGNORE); - - memset(&iter->current, 0, sizeof(iter->current)); - iter->current.af = family; - - INSIST(sizeof(ifreq.ifr_name) <= sizeof(iter->current.name)); - memset(iter->current.name, 0, sizeof(iter->current.name)); - memmove(iter->current.name, ifreq.ifr_name, sizeof(ifreq.ifr_name)); - - get_addr(family, &iter->current.address, - (struct sockaddr *)&ifrp->ifr_addr, ifreq.ifr_name); - - /* - * If the interface does not have a address ignore it. - */ - switch (family) { - case AF_INET: - if (iter->current.address.type.in.s_addr == htonl(INADDR_ANY)) - return (ISC_R_IGNORE); - break; - case AF_INET6: - if (memcmp(&iter->current.address.type.in6, &in6addr_any, - sizeof(in6addr_any)) == 0) - return (ISC_R_IGNORE); - break; - } - - /* - * Get interface flags. - */ - - iter->current.flags = 0; - - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion. It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(iter->socket, SIOCGIFFLAGS, (char *) &ifreq) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s: getting interface flags: %s", - ifreq.ifr_name, strbuf); - return (ISC_R_IGNORE); - } - - if ((ifreq.ifr_flags & IFF_UP) != 0) - iter->current.flags |= INTERFACE_F_UP; - -#ifdef IFF_POINTOPOINT - if ((ifreq.ifr_flags & IFF_POINTOPOINT) != 0) - iter->current.flags |= INTERFACE_F_POINTTOPOINT; -#endif - - if ((ifreq.ifr_flags & IFF_LOOPBACK) != 0) - iter->current.flags |= INTERFACE_F_LOOPBACK; - - if (family == AF_INET) - goto inet; - -#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR) - memset(&lifreq, 0, sizeof(lifreq)); - memmove(lifreq.lifr_name, iter->current.name, sizeof(lifreq.lifr_name)); - memmove(&lifreq.lifr_addr, &iter->current.address.type.in6, - sizeof(iter->current.address.type.in6)); - - if (ioctl(iter->socket, SIOCGLIFADDR, &lifreq) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s: getting interface address: %s", - ifreq.ifr_name, strbuf); - return (ISC_R_IGNORE); - } - prefixlen = lifreq.lifr_addrlen; -#else - isc_netaddr_format(&iter->current.address, sabuf, sizeof(sabuf)); - isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_INTERFACE, - ISC_LOG_INFO, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETIFCONFIG, - "prefix length for %s is unknown " - "(assume 128)"), sabuf); - prefixlen = 128; -#endif - - /* - * Netmask already zeroed. - */ - iter->current.netmask.family = family; - for (i = 0; i < 16; i++) { - if (prefixlen > 8) { - bits = 0; - prefixlen -= 8; - } else { - bits = 8 - prefixlen; - prefixlen = 0; - } - iter->current.netmask.type.in6.s6_addr[i] = - (~0U << bits) & 0xff; - } - return (ISC_R_SUCCESS); - - inet: - if (family != AF_INET) - return (ISC_R_IGNORE); -#ifdef IFF_POINTOPOINT - /* - * If the interface is point-to-point, get the destination address. - */ - if ((iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0) { - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion. It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(iter->socket, SIOCGIFDSTADDR, (char *)&ifreq) - < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETDESTADDR, - "%s: getting " - "destination address: %s"), - ifreq.ifr_name, strbuf); - return (ISC_R_IGNORE); - } - get_addr(family, &iter->current.dstaddress, - (struct sockaddr *)&ifreq.ifr_dstaddr, ifreq.ifr_name); - } -#endif - - /* - * Get the network mask. - */ - memset(&ifreq, 0, sizeof(ifreq)); - memmove(&ifreq, ifrp, sizeof(ifreq)); - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion. It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(iter->socket, SIOCGIFNETMASK, (char *)&ifreq) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETNETMASK, - "%s: getting netmask: %s"), - ifreq.ifr_name, strbuf); - return (ISC_R_IGNORE); - } - get_addr(family, &iter->current.netmask, - (struct sockaddr *)&ifreq.ifr_addr, ifreq.ifr_name); - return (ISC_R_SUCCESS); -} - -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) -static isc_result_t -internal_current6(isc_interfaceiter_t *iter) { - struct LIFREQ *ifrp; - struct LIFREQ lifreq; - int family; - char strbuf[ISC_STRERRORSIZE]; - int fd; - - REQUIRE(VALID_IFITER(iter)); - if (iter->result6 != ISC_R_SUCCESS) - return (iter->result6); - REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len); - - ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6); - - memset(&lifreq, 0, sizeof(lifreq)); - memmove(&lifreq, ifrp, sizeof(lifreq)); - - family = lifreq.lifr_addr.ss_family; - if (family != AF_INET && family != AF_INET6) - return (ISC_R_IGNORE); - - memset(&iter->current, 0, sizeof(iter->current)); - iter->current.af = family; - - INSIST(sizeof(lifreq.lifr_name) <= sizeof(iter->current.name)); - memset(iter->current.name, 0, sizeof(iter->current.name)); - memmove(iter->current.name, lifreq.lifr_name, sizeof(lifreq.lifr_name)); - - get_addr(family, &iter->current.address, - (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name); - - /* - * If the interface does not have a address ignore it. - */ - switch (family) { - case AF_INET: - if (iter->current.address.type.in.s_addr == htonl(INADDR_ANY)) - return (ISC_R_IGNORE); - break; - case AF_INET6: - if (memcmp(&iter->current.address.type.in6, &in6addr_any, - sizeof(in6addr_any)) == 0) - return (ISC_R_IGNORE); - break; - } - - /* - * Get interface flags. - */ - - iter->current.flags = 0; - - if (family == AF_INET6) - fd = iter->socket6; - else - fd = iter->socket; - - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion. It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(fd, SIOCGLIFFLAGS, (char *) &lifreq) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s: getting interface flags: %s", - lifreq.lifr_name, strbuf); - return (ISC_R_IGNORE); - } - - if ((lifreq.lifr_flags & IFF_UP) != 0) - iter->current.flags |= INTERFACE_F_UP; - -#ifdef IFF_POINTOPOINT - if ((lifreq.lifr_flags & IFF_POINTOPOINT) != 0) - iter->current.flags |= INTERFACE_F_POINTTOPOINT; -#endif - - if ((lifreq.lifr_flags & IFF_LOOPBACK) != 0) - iter->current.flags |= INTERFACE_F_LOOPBACK; - -#ifdef IFF_POINTOPOINT - /* - * If the interface is point-to-point, get the destination address. - */ - if ((iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0) { - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion. It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(fd, SIOCGLIFDSTADDR, (char *)&lifreq) - < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETDESTADDR, - "%s: getting " - "destination address: %s"), - lifreq.lifr_name, strbuf); - return (ISC_R_IGNORE); - } - get_addr(family, &iter->current.dstaddress, - (struct sockaddr *)&lifreq.lifr_dstaddr, - lifreq.lifr_name); - } -#endif - - /* - * Get the network mask. Netmask already zeroed. - */ - memset(&lifreq, 0, sizeof(lifreq)); - memmove(&lifreq, ifrp, sizeof(lifreq)); - -#ifdef lifr_addrlen - /* - * Special case: if the system provides lifr_addrlen member, the - * netmask of an IPv6 address can be derived from the length, since - * an IPv6 address always has a contiguous mask. - */ - if (family == AF_INET6) { - int i, bits; - - iter->current.netmask.family = family; - for (i = 0; i < lifreq.lifr_addrlen; i += 8) { - bits = lifreq.lifr_addrlen - i; - bits = (bits < 8) ? (8 - bits) : 0; - iter->current.netmask.type.in6.s6_addr[i / 8] = - (~0U << bits) & 0xff; - } - - return (ISC_R_SUCCESS); - } -#endif - - /* - * Ignore the HP/UX warning about "integer overflow during - * conversion. It comes from its own macro definition, - * and is really hard to shut up. - */ - if (ioctl(fd, SIOCGLIFNETMASK, (char *)&lifreq) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERIOCTL, - ISC_MSG_GETNETMASK, - "%s: getting netmask: %s"), - lifreq.lifr_name, strbuf); - return (ISC_R_IGNORE); - } - get_addr(family, &iter->current.netmask, - (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name); - - return (ISC_R_SUCCESS); -} -#endif - -static isc_result_t -internal_current(isc_interfaceiter_t *iter) { -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - if (iter->mode == 6) { - iter->result6 = internal_current6(iter); - if (iter->result6 != ISC_R_NOMORE) - return (iter->result6); - } -#endif - return (internal_current4(iter)); -} - -/* - * Step the iterator to the next interface. Unlike - * isc_interfaceiter_next(), this may leave the iterator - * positioned on an interface that will ultimately - * be ignored. Return ISC_R_NOMORE if there are no more - * interfaces, otherwise ISC_R_SUCCESS. - */ -static isc_result_t -internal_next4(isc_interfaceiter_t *iter) { - - if (iter->pos < (unsigned int) iter->ifc.ifc_len) { - iter->pos += sizeof(struct ifreq); - - } else { - INSIST(iter->pos == (unsigned int) iter->ifc.ifc_len); -#ifdef __linux - return (linux_if_inet6_next(iter)); -#else - return (ISC_R_NOMORE); -#endif - } - return (ISC_R_SUCCESS); -} - -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) -static isc_result_t -internal_next6(isc_interfaceiter_t *iter) { - - if (iter->result6 != ISC_R_SUCCESS && iter->result6 != ISC_R_IGNORE) - return (iter->result6); - - REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len); - - iter->pos6 += sizeof(struct LIFREQ); - - if (iter->pos6 >= (unsigned int) iter->lifc.lifc_len) - return (ISC_R_NOMORE); - - return (ISC_R_SUCCESS); -} -#endif - -static isc_result_t -internal_next(isc_interfaceiter_t *iter) { -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - if (iter->mode == 6) { - iter->result6 = internal_next6(iter); - if (iter->result6 != ISC_R_NOMORE) - return (iter->result6); - if (iter->first6) { - iter->first6 = false; - return (ISC_R_SUCCESS); - } - } -#endif - return (internal_next4(iter)); -} - -static void -internal_destroy(isc_interfaceiter_t *iter) { - (void) close(iter->socket); -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - if (iter->socket6 != -1) - (void) close(iter->socket6); - if (iter->buf6 != NULL) { - isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6); - } -#endif -#ifdef __linux - if (iter->proc != NULL) - fclose(iter->proc); -#endif -} - -static -void internal_first(isc_interfaceiter_t *iter) { - iter->pos = 0; -#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) - iter->pos6 = 0; - if (iter->result6 == ISC_R_NOMORE) - iter->result6 = ISC_R_SUCCESS; - iter->first6 = true; -#endif -#ifdef __linux - linux_if_inet6_first(iter); -#endif -} diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c deleted file mode 100644 index feb275e0f7..0000000000 --- a/lib/isc/unix/ifiter_sysctl.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -/*! \file - * \brief - * Obtain the list of network interfaces using sysctl. - * See TCP/IP Illustrated Volume 2, sections 19.8, 19.14, - * and 19.16. - */ - -#include - -#include -#include - -#include -#include - -#include - -/* XXX what about Alpha? */ -#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \ - : sizeof(long)) - -#define IFITER_MAGIC ISC_MAGIC('I', 'F', 'I', 'S') -#define VALID_IFITER(t) ISC_MAGIC_VALID(t, IFITER_MAGIC) - -struct isc_interfaceiter { - unsigned int magic; /* Magic number. */ - isc_mem_t *mctx; - void *buf; /* Buffer for sysctl data. */ - unsigned int bufsize; /* Bytes allocated. */ - unsigned int bufused; /* Bytes used. */ - unsigned int pos; /* Current offset in - sysctl data. */ - isc_interface_t current; /* Current interface data. */ - isc_result_t result; /* Last result code. */ -}; - -static int mib[6] = { - CTL_NET, - PF_ROUTE, - 0, - 0, /* Any address family. */ - NET_RT_IFLIST, - 0 /* Flags. */ -}; - -isc_result_t -isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { - isc_interfaceiter_t *iter; - isc_result_t result; - size_t bufsize; - size_t bufused; - char strbuf[ISC_STRERRORSIZE]; - - REQUIRE(mctx != NULL); - REQUIRE(iterp != NULL); - REQUIRE(*iterp == NULL); - - iter = isc_mem_get(mctx, sizeof(*iter)); - if (iter == NULL) - return (ISC_R_NOMEMORY); - - iter->mctx = mctx; - iter->buf = 0; - - /* - * Determine the amount of memory needed. - */ - bufsize = 0; - if (sysctl(mib, 6, NULL, &bufsize, NULL, (size_t) 0) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERSYSCTL, - ISC_MSG_GETIFLISTSIZE, - "getting interface " - "list size: sysctl: %s"), - strbuf); - result = ISC_R_UNEXPECTED; - goto failure; - } - iter->bufsize = bufsize; - - iter->buf = isc_mem_get(iter->mctx, iter->bufsize); - if (iter->buf == NULL) { - result = ISC_R_NOMEMORY; - goto failure; - } - - bufused = bufsize; - if (sysctl(mib, 6, iter->buf, &bufused, NULL, (size_t) 0) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_IFITERSYSCTL, - ISC_MSG_GETIFLIST, - "getting interface list: " - "sysctl: %s"), - strbuf); - result = ISC_R_UNEXPECTED; - goto failure; - } - iter->bufused = bufused; - INSIST(iter->bufused <= iter->bufsize); - - /* - * A newly created iterator has an undefined position - * until isc_interfaceiter_first() is called. - */ - iter->pos = (unsigned int) -1; - iter->result = ISC_R_FAILURE; - - iter->magic = IFITER_MAGIC; - *iterp = iter; - return (ISC_R_SUCCESS); - - failure: - if (iter->buf != NULL) - isc_mem_put(mctx, iter->buf, iter->bufsize); - isc_mem_put(mctx, iter, sizeof(*iter)); - return (result); -} - -/* - * Get information about the current interface to iter->current. - * If successful, return ISC_R_SUCCESS. - * If the interface has an unsupported address family, - * return ISC_R_IGNORE. In case of other failure, - * return ISC_R_UNEXPECTED. - */ - -static isc_result_t -internal_current(isc_interfaceiter_t *iter) { - struct ifa_msghdr *ifam, *ifam_end; - - REQUIRE(VALID_IFITER(iter)); - REQUIRE (iter->pos < (unsigned int) iter->bufused); - - ifam = (struct ifa_msghdr *) ((char *) iter->buf + iter->pos); - ifam_end = (struct ifa_msghdr *) ((char *) iter->buf + iter->bufused); - - if (ifam->ifam_type == RTM_IFINFO) { - struct if_msghdr *ifm = (struct if_msghdr *) ifam; - struct sockaddr_dl *sdl = (struct sockaddr_dl *) (ifm + 1); - unsigned int namelen; - - memset(&iter->current, 0, sizeof(iter->current)); - - namelen = sdl->sdl_nlen; - if (namelen > sizeof(iter->current.name) - 1) - namelen = sizeof(iter->current.name) - 1; - - memset(iter->current.name, 0, sizeof(iter->current.name)); - memmove(iter->current.name, sdl->sdl_data, namelen); - - iter->current.flags = 0; - - if ((ifam->ifam_flags & IFF_UP) != 0) - iter->current.flags |= INTERFACE_F_UP; - - if ((ifam->ifam_flags & IFF_POINTOPOINT) != 0) - iter->current.flags |= INTERFACE_F_POINTTOPOINT; - - if ((ifam->ifam_flags & IFF_LOOPBACK) != 0) - iter->current.flags |= INTERFACE_F_LOOPBACK; - - /* - * This is not an interface address. - * Force another iteration. - */ - return (ISC_R_IGNORE); - } else if (ifam->ifam_type == RTM_NEWADDR) { - int i; - int family; - struct sockaddr *mask_sa = NULL; - struct sockaddr *addr_sa = NULL; - struct sockaddr *dst_sa = NULL; - - struct sockaddr *sa = (struct sockaddr *)(ifam + 1); - family = sa->sa_family; - - for (i = 0; i < RTAX_MAX; i++) - { - if ((ifam->ifam_addrs & (1 << i)) == 0) - continue; - - INSIST(sa < (struct sockaddr *) ifam_end); - - switch (i) { - case RTAX_NETMASK: /* Netmask */ - mask_sa = sa; - break; - case RTAX_IFA: /* Interface address */ - addr_sa = sa; - break; - case RTAX_BRD: /* Broadcast or destination address */ - dst_sa = sa; - break; - } - sa = (struct sockaddr *)((char*)(sa) - + ROUNDUP(sizeof(struct sockaddr))); - } - - if (addr_sa == NULL) - return (ISC_R_IGNORE); - - family = addr_sa->sa_family; - if (family != AF_INET && family != AF_INET6) - return (ISC_R_IGNORE); - - iter->current.af = family; - - get_addr(family, &iter->current.address, addr_sa, - iter->current.name); - - if (mask_sa != NULL) - get_addr(family, &iter->current.netmask, mask_sa, - iter->current.name); - - if (dst_sa != NULL && - (iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0) - get_addr(family, &iter->current.dstaddress, dst_sa, - iter->current.name); - - return (ISC_R_SUCCESS); - } else { - printf("%s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_IFITERSYSCTL, - ISC_MSG_UNEXPECTEDTYPE, - "warning: unexpected interface list " - "message type\n")); - return (ISC_R_IGNORE); - } -} - -/* - * Step the iterator to the next interface. Unlike - * isc_interfaceiter_next(), this may leave the iterator - * positioned on an interface that will ultimately - * be ignored. Return ISC_R_NOMORE if there are no more - * interfaces, otherwise ISC_R_SUCCESS. - */ -static isc_result_t -internal_next(isc_interfaceiter_t *iter) { - struct ifa_msghdr *ifam; - REQUIRE (iter->pos < (unsigned int) iter->bufused); - - ifam = (struct ifa_msghdr *) ((char *) iter->buf + iter->pos); - - iter->pos += ifam->ifam_msglen; - - if (iter->pos >= iter->bufused) - return (ISC_R_NOMORE); - - return (ISC_R_SUCCESS); -} - -static void -internal_destroy(isc_interfaceiter_t *iter) { - UNUSED(iter); /* Unused. */ - /* - * Do nothing. - */ -} - -static -void internal_first(isc_interfaceiter_t *iter) { - iter->pos = 0; -} diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index ab59a2efc5..bb0e5e22e0 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -144,13 +144,7 @@ static isc_result_t linux_if_inet6_current(isc_interfaceiter_t *); static void linux_if_inet6_first(isc_interfaceiter_t *iter); #endif -#if HAVE_GETIFADDRS #include "ifiter_getifaddrs.c" -#elif HAVE_IFLIST_SYSCTL -#include "ifiter_sysctl.c" -#else -#include "ifiter_ioctl.c" -#endif #ifdef __linux static void From efd613e87443f0f0f906eab0a99e24732923a657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 15:10:32 +0200 Subject: [PATCH 23/30] memmove, strtoul, and strcasestr functions are part of ISO C90, remove the compatibility shim --- bin/dig/host.c | 1 - bin/dnssec/dnssec-signzone.c | 1 - bin/dnssec/dnssec-verify.c | 1 - bin/tests/optional/serial_test.c | 2 +- configure.in | 19 ----- lib/dns/dnsrps.c | 1 - lib/dns/rcode.c | 2 +- lib/dns/rdata.c | 1 - lib/dns/rpz.c | 1 - lib/isc/Makefile.in | 4 +- lib/isc/include/isc/platform.h.in | 15 ---- lib/isc/include/isc/stdlib.h | 33 --------- lib/isc/parseint.c | 2 +- lib/isc/strtoul.c | 117 ------------------------------ lib/isccc/cc.c | 1 - util/copyrights | 1 - 16 files changed, 5 insertions(+), 197 deletions(-) delete mode 100644 lib/isc/include/isc/stdlib.h delete mode 100644 lib/isc/strtoul.c diff --git a/bin/dig/host.c b/bin/dig/host.c index c134cbe079..ce2442d94a 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 45dc753c1c..39ccb4e57d 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c index 009b127585..4f09c0f9b6 100644 --- a/bin/dnssec/dnssec-verify.c +++ b/bin/dnssec/dnssec-verify.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/bin/tests/optional/serial_test.c b/bin/tests/optional/serial_test.c index 3ecb147c8b..cf3443db91 100644 --- a/bin/tests/optional/serial_test.c +++ b/bin/tests/optional/serial_test.c @@ -12,11 +12,11 @@ #include #include +#include #include #include #include -#include int main() { diff --git a/configure.in b/configure.in index 21f80c2120..821b6589d7 100644 --- a/configure.in +++ b/configure.in @@ -2014,20 +2014,6 @@ AC_SUBST(ISC_PLATFORM_HAVETFO) # # Check for some other useful functions that are not ever-present. # - -AC_CHECK_FUNC(memmove, - [ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"], - [ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"]) -AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE) - -AC_CHECK_FUNC(strtoul, - [ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL" - GENRANDOMLIB=""], - [ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1" - GENRANDOMLIB='${ISCLIBS}']) -AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL) -AC_SUBST(GENRANDOMLIB) - AC_CHECK_FUNC(strlcpy, [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"], [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"]) @@ -2038,11 +2024,6 @@ AC_CHECK_FUNC(strlcat, [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"]) AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT) -AC_CHECK_FUNC(strcasestr, - [ISC_PLATFORM_NEEDSTRCASESTR="#undef ISC_PLATFORM_NEEDSTRCASESTR"], - [ISC_PLATFORM_NEEDSTRCASESTR="#define ISC_PLATFORM_NEEDSTRCASESTR 1"]) -AC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR) - AC_SUBST(READLINE_LIB) AC_ARG_WITH(readline, AS_HELP_STRING([--with-readline[=LIBSPEC]], diff --git a/lib/dns/dnsrps.c b/lib/dns/dnsrps.c index 71dc878cd0..a85e48ca69 100644 --- a/lib/dns/dnsrps.c +++ b/lib/dns/dnsrps.c @@ -19,7 +19,6 @@ #ifdef USE_DNSRPS #include -#include #include #include diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 47e2ef5717..914ac47864 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 206528f23b..c3175553d4 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 2010ca0a8b..f5348b2f7b 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 098467b490..a9bfe1f882 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -57,7 +57,7 @@ OBJS = pk11.@O@ pk11_result.@O@ \ ratelimiter.@O@ refcount.@O@ region.@O@ regex.@O@ result.@O@ \ rwlock.@O@ \ serial.@O@ sha1.@O@ sha2.@O@ sockaddr.@O@ stats.@O@ \ - string.@O@ strtoul.@O@ symtab.@O@ task.@O@ taskpool.@O@ \ + string.@O@ symtab.@O@ task.@O@ taskpool.@O@ \ tm.@O@ timer.@O@ version.@O@ \ ${UNIXOBJS} ${NLSOBJS} ${THREADOBJS} SYMTBLOBJS = backtrace-emptytbl.@O@ @@ -74,7 +74,7 @@ SRCS = pk11.c pk11_result.c \ parseint.c portset.c quota.c radix.c random.c \ ratelimiter.c refcount.c region.c regex.c result.c rwlock.c \ serial.c sha1.c sha2.c sockaddr.c stats.c string.c \ - strtoul.c symtab.c task.c taskpool.c timer.c \ + symtab.c task.c taskpool.c timer.c \ tm.c version.c LIBS = @OPENSSL_LIBS@ @LIBS@ diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index e2d3622ccc..e30c02c55b 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -91,21 +91,6 @@ */ @ISC_PLATFORM_NEEDSTRLCAT@ -/* - * Define if this system needs strtoul. - */ -@ISC_PLATFORM_NEEDSTRTOUL@ - -/* - * Define if this system needs memmove. - */ -@ISC_PLATFORM_NEEDMEMMOVE@ - -/* - * Define if this system needs strcasestr. - */ -@ISC_PLATFORM_NEEDSTRCASESTR@ - /*** *** Miscellaneous. ***/ diff --git a/lib/isc/include/isc/stdlib.h b/lib/isc/include/isc/stdlib.h deleted file mode 100644 index c44b0ea605..0000000000 --- a/lib/isc/include/isc/stdlib.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_STDLIB_H -#define ISC_STDLIB_H 1 - -/*! \file isc/stdlib.h */ - -#include - -#include -#include - -#ifdef ISC_PLATFORM_NEEDSTRTOUL -#define strtoul isc_strtoul -#endif - -ISC_LANG_BEGINDECLS - -unsigned long isc_strtoul(const char *, char **, int); - -ISC_LANG_ENDDECLS - -#endif diff --git a/lib/isc/parseint.c b/lib/isc/parseint.c index 58593695ad..ced6911cc1 100644 --- a/lib/isc/parseint.c +++ b/lib/isc/parseint.c @@ -18,10 +18,10 @@ #include #include #include +#include #include #include -#include isc_result_t isc_parse_uint32(uint32_t *uip, const char *string, int base) { diff --git a/lib/isc/strtoul.c b/lib/isc/strtoul.c deleted file mode 100644 index 6f9bfd6e65..0000000000 --- a/lib/isc/strtoul.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -/* - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*! \file */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -#include -#include - -/*! - * Convert a string to an unsigned long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -unsigned long -isc_strtoul(const char *nptr, char **endptr, int base) { - const char *s = nptr; - unsigned long acc; - unsigned char c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) { - if (!isascii(c)) - break; - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = ULONG_MAX; - errno = ERANGE; - } else if (neg) - acc = -acc; - if (endptr != 0) - DE_CONST(any ? s - 1 : nptr, *endptr); - return (acc); -} diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index a4caca5266..960da65523 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -38,7 +38,6 @@ #include #include #include -#include #include diff --git a/util/copyrights b/util/copyrights index d490f0c32d..a5a915e457 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3438,7 +3438,6 @@ ./lib/isc/include/isc/socket.h C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2016,2018 ./lib/isc/include/isc/stats.h C 2009,2012,2016,2018 ./lib/isc/include/isc/stdio.h C 2000,2001,2004,2005,2006,2007,2013,2016,2018 -./lib/isc/include/isc/stdlib.h C 2003,2004,2005,2006,2007,2016,2018 ./lib/isc/include/isc/string.h C 2000,2001,2003,2004,2005,2006,2007,2014,2016,2018 ./lib/isc/include/isc/symtab.h C 1996,1997,1998,1999,2000,2001,2004,2005,2006,2007,2009,2011,2012,2013,2016,2018 ./lib/isc/include/isc/task.h C 1998,1999,2000,2001,2003,2004,2005,2006,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 From 167293571798b61e9000142a7c4d426b18b7f571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 15:27:42 +0200 Subject: [PATCH 24/30] Use strerror_r from POSIX.1-2001 (strerror_s on Windows) instead of custom isc__strerror() --- bin/named/unix/os.c | 55 ++- bin/named/win32/os.c | 9 +- configure.in | 2 - lib/dns/ssu_external.c | 9 +- lib/dns/zone.c | 9 +- lib/isc/Makefile.in | 2 +- lib/isc/include/isc/platform.h.in | 6 + lib/isc/pthreads/condition.c | 3 +- lib/isc/pthreads/mutex.c | 4 +- lib/isc/unix/Makefile.in | 7 +- lib/isc/unix/app.c | 24 +- lib/isc/unix/errno2result.c | 5 +- lib/isc/unix/ifiter_getifaddrs.c | 2 +- lib/isc/unix/include/isc/strerror.h | 38 -- lib/isc/unix/interfaceiter.c | 1 - lib/isc/unix/net.c | 21 +- lib/isc/unix/socket.c | 85 +++-- lib/isc/unix/strerror.c | 67 ---- lib/isc/unix/time.c | 5 +- lib/isc/win32/errno2result.c | 2 +- lib/isc/win32/include/isc/platform.h.in | 3 + lib/isc/win32/include/isc/strerror.h | 35 -- lib/isc/win32/interfaceiter.c | 8 +- lib/isc/win32/libisc.def.in | 1 - lib/isc/win32/net.c | 8 +- lib/isc/win32/socket.c | 38 +- lib/isc/win32/strerror.c | 452 ------------------------ util/copyrights | 4 - 28 files changed, 153 insertions(+), 752 deletions(-) delete mode 100644 lib/isc/unix/include/isc/strerror.h delete mode 100644 lib/isc/unix/strerror.c delete mode 100644 lib/isc/win32/include/isc/strerror.h delete mode 100644 lib/isc/win32/strerror.c diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index d462a225eb..0cff5fa403 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -130,7 +129,7 @@ linux_setcaps(cap_t caps) { return; } if (cap_set_proc(caps) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("cap_set_proc() failed: %s:" " please ensure that the capset kernel" " module is loaded. see insmod(8)", @@ -146,13 +145,13 @@ linux_setcaps(cap_t caps) { if (err != -1 && curval) { \ err = cap_set_flag(caps, CAP_EFFECTIVE, 1, &capval, CAP_SET); \ if (err == -1) { \ - isc__strerror(errno, strbuf, sizeof(strbuf)); \ + strerror_r(errno, strbuf, sizeof(strbuf)); \ named_main_earlyfatal("cap_set_proc failed: %s", strbuf); \ } \ \ err = cap_set_flag(caps, CAP_PERMITTED, 1, &capval, CAP_SET); \ if (err == -1) { \ - isc__strerror(errno, strbuf, sizeof(strbuf)); \ + strerror_r(errno, strbuf, sizeof(strbuf)); \ named_main_earlyfatal("cap_set_proc failed: %s", strbuf); \ } \ } \ @@ -161,12 +160,12 @@ linux_setcaps(cap_t caps) { do { \ caps = cap_init(); \ if (caps == NULL) { \ - isc__strerror(errno, strbuf, sizeof(strbuf)); \ + strerror_r(errno, strbuf, sizeof(strbuf)); \ named_main_earlyfatal("cap_init failed: %s", strbuf); \ } \ curcaps = cap_get_proc(); \ if (curcaps == NULL) { \ - isc__strerror(errno, strbuf, sizeof(strbuf)); \ + strerror_r(errno, strbuf, sizeof(strbuf)); \ named_main_earlyfatal("cap_get_proc failed: %s", strbuf); \ } \ } while (0) @@ -286,7 +285,7 @@ linux_keepcaps(void) { if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) { if (errno != EINVAL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("prctl() failed: %s", strbuf); } } else { @@ -331,13 +330,13 @@ named_os_daemonize(void) { char strbuf[ISC_STRERRORSIZE]; if (pipe(dfd) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("pipe(): %s", strbuf); } pid = fork(); if (pid == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("fork(): %s", strbuf); } if (pid != 0) { @@ -367,7 +366,7 @@ named_os_daemonize(void) { #endif if (setsid() == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("setsid(): %s", strbuf); } @@ -450,14 +449,14 @@ named_os_chroot(const char *root) { if (root != NULL) { #ifdef HAVE_CHROOT if (chroot(root) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("chroot(): %s", strbuf); } #else named_main_earlyfatal("chroot(): disabled"); #endif if (chdir("/") < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("chdir(/): %s", strbuf); } #ifdef HAVE_LIBSCF @@ -484,7 +483,7 @@ named_os_inituserinfo(const char *username) { if (getuid() == 0) { if (initgroups(runas_pw->pw_name, runas_pw->pw_gid) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("initgroups(): %s", strbuf); } } @@ -514,12 +513,12 @@ named_os_changeuser(void) { #endif if (setgid(runas_pw->pw_gid) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("setgid(): %s", strbuf); } if (setuid(runas_pw->pw_uid) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("setuid(): %s", strbuf); } @@ -529,7 +528,7 @@ named_os_changeuser(void) { * call has disabled it. */ if (prctl(PR_SET_DUMPABLE,1,0,0,0) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("prctl(PR_SET_DUMPABLE) failed: %s", strbuf); } @@ -648,7 +647,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) { if (stat(filename, &sb) == -1) { if (errno != ENOENT) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); (*report)("couldn't stat '%s': %s", filename, strbuf); goto error; @@ -668,7 +667,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) { mode |= S_IRGRP | S_IXGRP; /* g=rx */ mode |= S_IROTH | S_IXOTH; /* o=rx */ if (mkdir(filename, mode) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); (*report)("couldn't mkdir '%s': %s", filename, strbuf); goto error; @@ -676,7 +675,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) { if (runas_pw != NULL && chown(filename, runas_pw->pw_uid, runas_pw->pw_gid) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); (*report)("couldn't chown '%s': %s", filename, strbuf); } @@ -703,7 +702,7 @@ setperms(uid_t uid, gid_t gid) { #endif #if defined(HAVE_SETEGID) if (getegid() != gid && setegid(gid) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("unable to set effective " "gid to %ld: %s", (long)gid, strbuf); @@ -711,7 +710,7 @@ setperms(uid_t uid, gid_t gid) { #elif defined(HAVE_SETRESGID) if (getresgid(&tmpg, &oldgid, &tmpg) == -1 || oldgid != gid) { if (setresgid(-1, gid, -1) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("unable to set effective " "gid to %d: %s", gid, strbuf); } @@ -720,7 +719,7 @@ setperms(uid_t uid, gid_t gid) { #if defined(HAVE_SETEUID) if (geteuid() != uid && seteuid(uid) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("unable to set effective " "uid to %ld: %s", (long)uid, strbuf); @@ -728,7 +727,7 @@ setperms(uid_t uid, gid_t gid) { #elif defined(HAVE_SETRESUID) if (getresuid(&tmpu, &olduid, &tmpu) == -1 || olduid != uid) { if (setresuid(-1, uid, -1) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("unable to set effective " "uid to %d: %s", uid, strbuf); } @@ -747,7 +746,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { */ f = strdup(filename); if (f == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("couldn't strdup() '%s': %s", filename, strbuf); return (NULL); @@ -799,7 +798,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { } if (fd < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("could not open file '%s': %s", filename, strbuf); return (NULL); @@ -807,7 +806,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { fp = fdopen(fd, "w"); if (fp == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("could not fdopen() file '%s': %s", filename, strbuf); } @@ -835,7 +834,7 @@ named_os_writepidfile(const char *filename, bool first_time) { pidfile = strdup(filename); if (pidfile == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); (*report)("couldn't strdup() '%s': %s", filename, strbuf); return; } @@ -882,7 +881,7 @@ named_os_issingleton(const char *filename) { */ lockfile = strdup(filename); if (lockfile == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("couldn't allocate memory for '%s': %s", filename, strbuf); } else { diff --git a/bin/named/win32/os.c b/bin/named/win32/os.c index c3c566ca23..813cc6ce27 100644 --- a/bin/named/win32/os.c +++ b/bin/named/win32/os.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -231,7 +230,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) { UNUSED(switch_user); fd = safe_open(filename, mode, false); if (fd < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_s(strbuf, sizeof(strbuf), errno); named_main_earlywarning("could not open file '%s': %s", filename, strbuf); return (NULL); @@ -239,7 +238,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) { fp = fdopen(fd, "w"); if (fp == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_s(strbuf, sizeof(strbuf), errno); named_main_earlywarning("could not fdopen() file '%s': %s", filename, strbuf); close(fd); @@ -268,7 +267,7 @@ named_os_writepidfile(const char *filename, bool first_time) { pidfile = strdup(filename); if (pidfile == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_s(strbuf, sizeof(strbuf), errno); (*report)("couldn't strdup() '%s': %s", filename, strbuf); return; } @@ -312,7 +311,7 @@ named_os_issingleton(const char *filename) { lockfile = strdup(filename); if (lockfile == NULL) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_s(strbuf, sizeof(strbuf), errno); named_main_earlyfatal("couldn't allocate memory for '%s': %s", filename, strbuf); } diff --git a/configure.in b/configure.in index 821b6589d7..072661392e 100644 --- a/configure.in +++ b/configure.in @@ -2085,8 +2085,6 @@ then AC_CHECK_HEADERS(readline/history.h) fi - -AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR)) # # Use our own SPNEGO implementation? # diff --git a/lib/dns/ssu_external.c b/lib/dns/ssu_external.c index 566b3a00cc..b9c2de40a5 100644 --- a/lib/dns/ssu_external.c +++ b/lib/dns/ssu_external.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -82,7 +81,7 @@ ux_socket_connect(const char *path) { fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); ssu_e_log(3, "ssu_external: unable to create socket - %s", strbuf); return (-1); @@ -90,7 +89,7 @@ ux_socket_connect(const char *path) { if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); ssu_e_log(3, "ssu_external: unable to connect to " "socket '%s' - %s", path, strbuf); @@ -224,7 +223,7 @@ dns_ssu_external_match(const dns_name_t *identity, isc_mem_free(mctx, data); if (ret != (ssize_t) req_len) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); ssu_e_log(3, "ssu_external: unable to send request - %s", strbuf); close(fd); @@ -235,7 +234,7 @@ dns_ssu_external_match(const dns_name_t *identity, ret = read(fd, &reply, sizeof(uint32_t)); if (ret != (ssize_t) sizeof(uint32_t)) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); ssu_e_log(3, "ssu_external: unable to receive reply - %s", strbuf); close(fd); diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 623d728251..9ac304249b 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -4593,7 +4592,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, "removing journal file"); if (remove(zone->journal) < 0 && errno != ENOENT) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE, @@ -15112,7 +15111,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { zone->journal); if (result != ISC_R_SUCCESS) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); dns_zone_log(zone, ISC_LOG_ERROR, "ixfr-from-differences: failed: " "%s", strbuf); @@ -15134,7 +15133,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER) && remove(zone->masterfile) < 0 && errno != ENOENT) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE, @@ -15165,7 +15164,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { "removing journal file"); if (remove(zone->journal) < 0 && errno != ENOENT) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE, diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index a9bfe1f882..8f5233fffa 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -31,7 +31,7 @@ UNIXOBJS = unix/pk11_api.@O@ \ unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \ unix/interfaceiter.@O@ unix/keyboard.@O@ unix/meminfo.@O@ \ unix/net.@O@ unix/os.@O@ unix/resource.@O@ unix/socket.@O@ \ - unix/stdio.@O@ unix/stdtime.@O@ unix/strerror.@O@ \ + unix/stdio.@O@ unix/stdtime.@O@ \ unix/syslog.@O@ unix/time.@O@ NLSOBJS = nls/msgcat.@O@ diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index e30c02c55b..d2bcdd8aa1 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -26,6 +26,12 @@ #define thread_local __thread #endif +/*** + *** Default strerror_r buffer size + ***/ + +#define ISC_STRERRORSIZE 128 + /*** *** Network. ***/ diff --git a/lib/isc/pthreads/condition.c b/lib/isc/pthreads/condition.c index a7f1928126..2c3b07cc77 100644 --- a/lib/isc/pthreads/condition.c +++ b/lib/isc/pthreads/condition.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -64,7 +63,7 @@ isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) { return (ISC_R_TIMEDOUT); } while (presult == EINTR); - isc__strerror(presult, strbuf, sizeof(strbuf)); + strerror_r(presult, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "pthread_cond_timedwait() %s %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, diff --git a/lib/isc/pthreads/mutex.c b/lib/isc/pthreads/mutex.c index cd45e6b1f5..a04871219d 100644 --- a/lib/isc/pthreads/mutex.c +++ b/lib/isc/pthreads/mutex.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -23,7 +24,6 @@ #include #include #include -#include #include #if ISC_MUTEX_PROFILE @@ -292,7 +292,7 @@ isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line) { if (err == ENOMEM) return (ISC_R_NOMEMORY); if (err != 0) { - isc__strerror(err, strbuf, sizeof(strbuf)); + strerror_r(err, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(file, line, "isc_mutex_init() failed: %s", strbuf); result = ISC_R_UNEXPECTED; diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in index 190540cdaf..80e8bc6e55 100644 --- a/lib/isc/unix/Makefile.in +++ b/lib/isc/unix/Makefile.in @@ -26,19 +26,18 @@ OBJS = pk11_api.@O@ \ file.@O@ fsaccess.@O@ interfaceiter.@O@ \ keyboard.@O@ meminfo.@O@ \ net.@O@ os.@O@ resource.@O@ socket.@O@ stdio.@O@ stdtime.@O@ \ - strerror.@O@ syslog.@O@ time.@O@ + syslog.@O@ time.@O@ # Alphabetically SRCS = pk11_api.c \ app.c dir.c errno.c errno2result.c \ file.c fsaccess.c interfaceiter.c keyboard.c meminfo.c \ net.c os.c resource.c socket.c stdio.c stdtime.c \ - strerror.c syslog.c time.c + syslog.c time.c SUBDIRS = include TARGETS = ${OBJS} @BIND9_MAKE_RULES@ -interfaceiter.@O@: interfaceiter.c ifiter_ioctl.c ifiter_sysctl.c ifiter_getifaddrs.c - +interfaceiter.@O@: interfaceiter.c ifiter_getifaddrs.c diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index 3c6662632d..f81ef70f81 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -28,6 +28,7 @@ #include #endif +#include #include #include #include @@ -35,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -181,7 +181,7 @@ handle_signal(int sig, void (*handler)(int)) { if (sigfillset(&sa.sa_mask) != 0 || sigaction(sig, &sa, NULL) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_APP, ISC_MSG_SIGNALSETUP, @@ -213,7 +213,7 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { */ presult = pthread_init(); if (presult != 0) { - isc__strerror(presult, strbuf, sizeof(strbuf)); + strerror_r(presult, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() pthread_init: %s", strbuf); return (ISC_R_UNEXPECTED); @@ -302,7 +302,7 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { sigaddset(&sset, SIGHUP) != 0 || sigaddset(&sset, SIGINT) != 0 || sigaddset(&sset, SIGTERM) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() sigsetops: %s", strbuf); result = ISC_R_UNEXPECTED; @@ -310,7 +310,7 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { } presult = pthread_sigmask(SIG_BLOCK, &sset, NULL); if (presult != 0) { - isc__strerror(presult, strbuf, sizeof(strbuf)); + strerror_r(presult, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() pthread_sigmask: %s", strbuf); @@ -450,7 +450,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { sigaddset(&sset, SIGHUP) != 0 || sigaddset(&sset, SIGINT) != 0 || sigaddset(&sset, SIGTERM) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_run() sigsetops: %s", strbuf); @@ -502,7 +502,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { return (ISC_R_SUCCESS); if (sigemptyset(&sset) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_run() sigsetops: %s", strbuf); @@ -510,7 +510,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { } #ifdef HAVE_GPERFTOOLS_PROFILER if (sigaddset(&sset, SIGALRM) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_run() sigsetops: %s", strbuf); @@ -583,7 +583,7 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { result = pthread_kill(main_thread, SIGTERM); if (result != 0) { - isc__strerror(result, + strerror_r(result, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_shutdown() " @@ -596,7 +596,7 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { if (isc_bind9) { /* BIND9 internal, single context */ if (kill(getpid(), SIGTERM) < 0) { - isc__strerror(errno, + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_shutdown() " @@ -656,7 +656,7 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { result = pthread_kill(main_thread, SIGHUP); if (result != 0) { - isc__strerror(result, + strerror_r(result, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_reload() " @@ -669,7 +669,7 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { if (isc_bind9) { /* BIND9 internal, single context */ if (kill(getpid(), SIGHUP) < 0) { - isc__strerror(errno, + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_reload() " diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c index 2f12bcc8bc..604213a6e2 100644 --- a/lib/isc/unix/errno2result.c +++ b/lib/isc/unix/errno2result.c @@ -15,9 +15,10 @@ #include #include +#include +#include #include -#include #include #include "errno2result.h" @@ -109,7 +110,7 @@ isc___errno2result(int posixerrno, bool dolog, return (ISC_R_CONNREFUSED); default: if (dolog) { - isc__strerror(posixerrno, strbuf, sizeof(strbuf)); + strerror_r(posixerrno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(file, line, "unable to convert errno " "to isc_result: %d: %s", posixerrno, strbuf); diff --git a/lib/isc/unix/ifiter_getifaddrs.c b/lib/isc/unix/ifiter_getifaddrs.c index 184cec5132..18deb7ace0 100644 --- a/lib/isc/unix/ifiter_getifaddrs.c +++ b/lib/isc/unix/ifiter_getifaddrs.c @@ -77,7 +77,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { #endif if (getifaddrs(&iter->ifaddrs) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_IFITERGETIFADDRS, diff --git a/lib/isc/unix/include/isc/strerror.h b/lib/isc/unix/include/isc/strerror.h deleted file mode 100644 index fa0e429d95..0000000000 --- a/lib/isc/unix/include/isc/strerror.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_STRERROR_H -#define ISC_STRERROR_H - -/*! \file */ - -#include - -#include - -ISC_LANG_BEGINDECLS - -/*% String Error Size */ -#define ISC_STRERRORSIZE 128 - -/*% - * Provide a thread safe wrapper to strerror(). - * - * Requires: - * 'buf' to be non NULL. - */ -void -isc__strerror(int num, char *buf, size_t bufsize); - -ISC_LANG_ENDDECLS - -#endif /* ISC_STRERROR_H */ diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index bb0e5e22e0..fb1a389f82 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index e62cbbaf61..68757d7eff 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -137,7 +136,7 @@ try_proto(int domain) { #endif return (ISC_R_NOTFOUND); default: - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -245,7 +244,7 @@ try_ipv6only(void) { /* check for TCP sockets */ s = socket(PF_INET6, SOCK_STREAM, 0); if (s == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -268,7 +267,7 @@ try_ipv6only(void) { /* check for UDP sockets */ s = socket(PF_INET6, SOCK_DGRAM, 0); if (s == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -316,7 +315,7 @@ try_ipv6pktinfo(void) { /* we only use this for UDP sockets */ s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -429,7 +428,7 @@ make_nonblock(int fd) { #endif if (ret == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, #ifdef USE_FIONBIO_IOCTL "ioctl(%d, FIONBIO, &on): %s", fd, @@ -461,7 +460,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { isc_result_t result; if (bind(s, res->ai_addr, res->ai_addrlen) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), "bind: %s", strbuf); @@ -469,7 +468,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { } if (getsockname(s, (struct sockaddr *)&ss, &len) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), "getsockname: %s", strbuf); @@ -532,7 +531,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { default: debug = ISC_LOG_NOTICE; } - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); if (debug != ISC_LOG_NOTICE) { isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), @@ -604,7 +603,7 @@ try_dscp_v4(void) { s = socket(res0->ai_family, res0->ai_socktype, res0->ai_protocol); if (s == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), "socket: %s", strbuf); @@ -662,7 +661,7 @@ try_dscp_v6(void) { s = socket(res0->ai_family, res0->ai_socktype, res0->ai_protocol); if (s == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), "socket: %s", strbuf); diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index f20702d4aa..1f3deaeda6 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -959,7 +958,7 @@ unwatch_fd(isc__socketmgr_t *manager, int fd, int msg) { ret = epoll_ctl(manager->epoll_fd, op, fd, &event); if (ret == -1 && errno != ENOENT) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "epoll_ctl(DEL), %d: %s", fd, strbuf); result = ISC_R_UNEXPECTED; @@ -1107,7 +1106,7 @@ select_poke(isc__socketmgr_t *mgr, int fd, int msg) { } while (cc < 0 && SOFT_ERROR(errno)); if (cc < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_WRITEFAILED, @@ -1135,7 +1134,7 @@ select_readmsg(isc__socketmgr_t *mgr, int *fd, int *msg) { if (SOFT_ERROR(errno)) return; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_READFAILED, @@ -1171,7 +1170,7 @@ make_nonblock(int fd) { #endif if (ret == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, #ifdef USE_FIONBIO_IOCTL "ioctl(%d, FIONBIO, &on): %s", fd, @@ -1509,7 +1508,7 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, (void *)&dscp, sizeof(int)) < 0) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IP_TOS, %.02x)" " %s: %s", @@ -1539,7 +1538,7 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_TCLASS, (void *)&dscp, sizeof(int)) < 0) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_TCLASS, " "%.02x) %s: %s", @@ -1795,7 +1794,7 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { return (DOIO_SOFT); if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) { - isc__strerror(recv_errno, strbuf, sizeof(strbuf)); + strerror_r(recv_errno, strbuf, sizeof(strbuf)); socket_log(sock, NULL, IOEVENT, isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_DOIORECV, @@ -2033,7 +2032,7 @@ doio_send(isc__socket_t *sock, isc_socketevent_t *dev) { * a status. */ isc_sockaddr_format(&dev->address, addrbuf, sizeof(addrbuf)); - isc__strerror(send_errno, strbuf, sizeof(strbuf)); + strerror_r(send_errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_send: %s: %s", addrbuf, strbuf); dev->result = isc__errno2result(send_errno); @@ -2531,7 +2530,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, switch (errno) { case EMFILE: case ENFILE: - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, isc_msgcat, ISC_MSGSET_SOCKET, @@ -2556,7 +2555,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, return (ISC_R_FAMILYNOSUPPORT); default: - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "%s() %s: %s", err, isc_msgcat_get(isc_msgcat, @@ -2586,7 +2585,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if (sock->type != isc_sockettype_unix && bsdcompat && setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT, (void *)&on, sizeof(on)) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_BSDCOMPAT) %s: %s", sock->fd, @@ -2600,7 +2599,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, #ifdef SO_NOSIGPIPE if (setsockopt(sock->fd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&on, sizeof(on)) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_NOSIGPIPE) %s: %s", sock->fd, @@ -2627,7 +2626,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP, (void *)&on, sizeof(on)) < 0 && errno != ENOPROTOOPT) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_TIMESTAMP) %s: %s", sock->fd, @@ -2645,7 +2644,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if ((sock->pf == AF_INET6) && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, (void *)&on, sizeof(on)) < 0)) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_RECVPKTINFO) " "%s: %s", sock->fd, @@ -2660,7 +2659,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if ((sock->pf == AF_INET6) && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO, (void *)&on, sizeof(on)) < 0)) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_PKTINFO) %s: %s", sock->fd, @@ -2726,7 +2725,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, set_rcvbuf) == ISC_R_SUCCESS); if (setsockopt(sock->fd, SOL_SOCKET, SO_RCVBUF, (void *)&rcvbuf, sizeof(rcvbuf)) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_RCVBUF, %d) %s: %s", sock->fd, rcvbuf, @@ -2743,7 +2742,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if ((sock->pf == AF_INET6) && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVTCLASS, (void *)&on, sizeof(on)) < 0)) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_RECVTCLASS) " "%s: %s", sock->fd, @@ -2756,7 +2755,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if ((sock->pf == AF_INET) && (setsockopt(sock->fd, IPPROTO_IP, IP_RECVTOS, (void *)&on, sizeof(on)) < 0)) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IP_RECVTOS) " "%s: %s", sock->fd, @@ -3454,7 +3453,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { default: break; } - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_accept: %s() %s: %s", err, isc_msgcat_get(isc_msgcat, @@ -4146,7 +4145,7 @@ watcher(void *uap) { #endif /* USE_KQUEUE */ if (cc < 0 && !SOFT_ERROR(errno)) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, "%s %s: %s", fnname, isc_msgcat_get(isc_msgcat, @@ -4241,7 +4240,7 @@ setup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { manager->kqueue_fd = kqueue(); if (manager->kqueue_fd == -1) { result = isc__errno2result(errno); - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "kqueue %s: %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, @@ -4268,7 +4267,7 @@ setup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { manager->epoll_fd = epoll_create(manager->nevents); if (manager->epoll_fd == -1) { result = isc__errno2result(errno); - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "epoll_create %s: %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, @@ -4311,7 +4310,7 @@ setup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { manager->devpoll_fd = open("/dev/poll", O_RDWR); if (manager->devpoll_fd == -1) { result = isc__errno2result(errno); - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "open(/dev/poll) %s: %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, @@ -4514,7 +4513,7 @@ isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, * select/poll loop when something internal needs to be done. */ if (pipe(manager->pipe_fds) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "pipe() %s: %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, @@ -5143,7 +5142,7 @@ isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { if (active) { if (stat(sockaddr->type.sunix.sun_path, &sb) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, "isc_socket_cleanunix: stat(%s): %s", @@ -5158,7 +5157,7 @@ isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { return; } if (unlink(sockaddr->type.sunix.sun_path) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, "isc_socket_cleanunix: unlink(%s): %s", @@ -5169,7 +5168,7 @@ isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, "isc_socket_cleanunix: socket(%s): %s", @@ -5182,7 +5181,7 @@ isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { case ENOENT: /* We exited cleanly last time */ break; default: - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, "isc_socket_cleanunix: stat(%s): %s", @@ -5206,7 +5205,7 @@ isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { case ECONNREFUSED: case ECONNRESET: if (unlink(sockaddr->type.sunix.sun_path) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, @@ -5217,7 +5216,7 @@ isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { } break; default: - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, "isc_socket_cleanunix: connect(%s): %s", @@ -5263,7 +5262,7 @@ isc__socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm, #endif if (chmod(path, perm) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, "isc_socket_permunix: chmod(%s, %d): %s", @@ -5271,7 +5270,7 @@ isc__socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm, result = ISC_R_FAILURE; } if (chown(path, owner, group) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, "isc_socket_permunix: chown(%s, %d, %d): %s", @@ -5344,7 +5343,7 @@ isc__socket_bind(isc_socket_t *sock0, const isc_sockaddr_t *sockaddr, case EINVAL: return (ISC_R_BOUND); default: - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "bind: %s", strbuf); return (ISC_R_UNEXPECTED); @@ -5384,7 +5383,7 @@ isc__socket_filter(isc_socket_t *sock0, const char *filter) { strlcpy(afa.af_name, filter, sizeof(afa.af_name)); if (setsockopt(sock->fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa)) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_FILTER, "setsockopt(SO_ACCEPTFILTER): %s", strbuf); @@ -5447,7 +5446,7 @@ set_tcp_fastopen(isc__socket_t *sock, unsigned int backlog) { #endif if (setsockopt(sock->fd, IPPROTO_TCP, TCP_FASTOPEN, (void *)&backlog, sizeof(backlog)) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, TCP_FASTOPEN) failed with %s", sock->fd, strbuf); @@ -5488,7 +5487,7 @@ isc__socket_listen(isc_socket_t *sock0, unsigned int backlog) { if (listen(sock->fd, (int)backlog) < 0) { UNLOCK(&sock->lock); - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "listen: %s", strbuf); @@ -5676,7 +5675,7 @@ isc__socket_connect(isc_socket_t *sock0, const isc_sockaddr_t *addr, sock->connected = 0; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); isc_sockaddr_format(addr, addrbuf, sizeof(addrbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "connect(%s) %d/%s", addrbuf, errno, strbuf); @@ -5838,7 +5837,7 @@ internal_connect(isc_task_t *me, isc_event_t *ev) { result = ISC_R_UNEXPECTED; isc_sockaddr_format(&sock->peer_address, peerbuf, sizeof(peerbuf)); - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_connect: connect(%s) %s", peerbuf, strbuf); @@ -5903,7 +5902,7 @@ isc__socket_getsockname(isc_socket_t *sock0, isc_sockaddr_t *addressp) { len = sizeof(addressp->type); if (getsockname(sock->fd, &addressp->type.sa, (void *)&len) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "getsockname: %s", strbuf); result = ISC_R_UNEXPECTED; @@ -6082,7 +6081,7 @@ isc__socket_ipv6only(isc_socket_t *sock0, bool yes) { if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&onoff, sizeof(int)) < 0) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_V6ONLY) " "%s: %s", sock->fd, @@ -6109,7 +6108,7 @@ setdscp(isc__socket_t *sock, isc_dscp_t dscp) { if (setsockopt(sock->fd, IPPROTO_IP, IP_TOS, (void *)&value, sizeof(value)) < 0) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IP_TOS, %.02x) " "%s: %s", sock->fd, value >> 2, @@ -6126,7 +6125,7 @@ setdscp(isc__socket_t *sock, isc_dscp_t dscp) { if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_TCLASS, (void *)&value, sizeof(value)) < 0) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_TCLASS, %.02x) " "%s: %s", sock->fd, dscp >> 2, diff --git a/lib/isc/unix/strerror.c b/lib/isc/unix/strerror.c deleted file mode 100644 index e4fb7934cd..0000000000 --- a/lib/isc/unix/strerror.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -/*! \file */ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#ifdef HAVE_STRERROR -/*% - * We need to do this this way for profiled locks. - */ -static isc_mutex_t isc_strerror_lock; -static void init_lock(void) { - RUNTIME_CHECK(isc_mutex_init(&isc_strerror_lock) == ISC_R_SUCCESS); -} -#else -extern const char * const sys_errlist[]; -extern const int sys_nerr; -#endif - -void -isc__strerror(int num, char *buf, size_t size) { -#ifdef HAVE_STRERROR - char *msg; - unsigned int unum = (unsigned int)num; - static isc_once_t once = ISC_ONCE_INIT; - - REQUIRE(buf != NULL); - - RUNTIME_CHECK(isc_once_do(&once, init_lock) == ISC_R_SUCCESS); - - LOCK(&isc_strerror_lock); - msg = strerror(num); - if (msg != NULL) - snprintf(buf, size, "%s", msg); - else - snprintf(buf, size, "Unknown error: %u", unum); - UNLOCK(&isc_strerror_lock); -#else - unsigned int unum = (unsigned int)num; - - REQUIRE(buf != NULL); - - if (num >= 0 && num < sys_nerr) - snprintf(buf, size, "%s", sys_errlist[num]); - else - snprintf(buf, size, "Unknown error: %u", unum); -#endif -} diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c index 7957e11f92..b5e83c8722 100644 --- a/lib/isc/unix/time.c +++ b/lib/isc/unix/time.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -149,7 +148,7 @@ isc_time_now(isc_time_t *t) { REQUIRE(t != NULL); if (gettimeofday(&tv, NULL) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "%s", strbuf); return (ISC_R_UNEXPECTED); } @@ -193,7 +192,7 @@ isc_time_nowplusinterval(isc_time_t *t, const isc_interval_t *i) { INSIST(i->nanoseconds < NS_PER_S); if (gettimeofday(&tv, NULL) == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "%s", strbuf); return (ISC_R_UNEXPECTED); } diff --git a/lib/isc/win32/errno2result.c b/lib/isc/win32/errno2result.c index f1f3b247c4..c8f6ea3d1f 100644 --- a/lib/isc/win32/errno2result.c +++ b/lib/isc/win32/errno2result.c @@ -101,7 +101,7 @@ isc__errno2resultx(int posixerrno, bool dolog, return (ISC_R_NORESOURCES); default: if (dolog) { - isc__strerror(posixerrno, strbuf, sizeof(strbuf)); + strerror_r(posixerrno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(file, line, "unable to convert errno " "to isc_result: %d: %s", diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 80df0a0b11..eea970e6a9 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -28,6 +28,9 @@ #if defined(_WIN32) || defined(_WIN64) /* We are on Windows */ # define strtok_r strtok_s +# define strerror_r(errnum, buf, buflen) strerror_s(buf, buflen, errnum) + +#define ISC_STRERRORSIZE 128 #ifndef strtoull #define strtoull _strtoui64 diff --git a/lib/isc/win32/include/isc/strerror.h b/lib/isc/win32/include/isc/strerror.h deleted file mode 100644 index ae040a439a..0000000000 --- a/lib/isc/win32/include/isc/strerror.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_STRERROR_H -#define ISC_STRERROR_H - -#include - -#include - -ISC_LANG_BEGINDECLS - -#define ISC_STRERRORSIZE 128 - -/* - * Provide a thread safe wrapper to strerrror(). - * - * Requires: - * 'buf' to be non NULL. - */ -void -isc__strerror(int num, char *buf, size_t bufsize); - -ISC_LANG_ENDDECLS - -#endif /* ISC_STRERROR_H */ diff --git a/lib/isc/win32/interfaceiter.c b/lib/isc/win32/interfaceiter.c index 1bbd0f89fe..4c56531edc 100644 --- a/lib/isc/win32/interfaceiter.c +++ b/lib/isc/win32/interfaceiter.c @@ -141,7 +141,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { error = WSAGetLastError(); if (error == WSAEAFNOSUPPORT) goto inet6_only; - isc__strerror(error, strbuf, sizeof(strbuf)); + strerror_r(error, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "making interface scan socket: %s", strbuf); @@ -169,7 +169,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { error = WSAGetLastError(); if (error != WSAEFAULT && error != WSAENOBUFS) { errno = error; - isc__strerror(error, strbuf, sizeof(strbuf)); + strerror_r(error, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "get interface configuration: %s", strbuf); @@ -222,7 +222,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { error = WSAGetLastError(); if (error == WSAEAFNOSUPPORT) goto inet_only; - isc__strerror(error, strbuf, sizeof(strbuf)); + strerror_r(error, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "making interface scan socket: %s", strbuf); @@ -251,7 +251,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { error = WSAGetLastError(); if (error != WSAEFAULT && error != WSAENOBUFS) { errno = error; - isc__strerror(error, strbuf, sizeof(strbuf)); + strerror_r(error, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "sio address list query: %s", strbuf); diff --git a/lib/isc/win32/libisc.def.in b/lib/isc/win32/libisc.def.in index aa4e71178f..e05c83e15d 100644 --- a/lib/isc/win32/libisc.def.in +++ b/lib/isc/win32/libisc.def.in @@ -101,7 +101,6 @@ isc__socketmgr_destroy isc__socketmgr_getmaxsockets isc__socketmgr_setreserved isc__socketmgr_setstats -isc__strerror isc__task_getname isc__task_gettag isc__task_unsendrange diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index 2b536aae7d..7328f8e54c 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -65,7 +65,7 @@ try_proto(int domain) { case WSAEINVAL: return (ISC_R_NOTFOUND); default: - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -133,7 +133,7 @@ try_ipv6only(void) { /* check for TCP sockets */ s = socket(PF_INET6, SOCK_STREAM, 0); if (s == INVALID_SOCKET) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -157,7 +157,7 @@ try_ipv6only(void) { /* check for UDP sockets */ s = socket(PF_INET6, SOCK_DGRAM, 0); if (s == INVALID_SOCKET) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -213,7 +213,7 @@ try_ipv6pktinfo(void) { /* we only use this for UDP sockets */ s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s == INVALID_SOCKET) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index f89d323589..ffcc0cc9e1 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -461,7 +461,7 @@ signal_iocompletionport_exit(isc_socketmgr_t *manager) { if (!PostQueuedCompletionStatus(manager->hIoCompletionPort, 0, 0, 0)) { errval = GetLastError(); - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_FAILED, @@ -491,7 +491,7 @@ iocompletionport_createthreads(int total_threads, isc_socketmgr_t *manager) { &manager->dwIOCPThreadIds[i]); if (manager->hIOCPThreads[i] == NULL) { errval = GetLastError(); - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_FAILED, @@ -517,7 +517,7 @@ iocompletionport_init(isc_socketmgr_t *manager) { hHeapHandle = HeapCreate(0, 10 * sizeof(IoCompletionInfo), 0); if (hHeapHandle == NULL) { errval = GetLastError(); - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_FAILED, @@ -534,7 +534,7 @@ iocompletionport_init(isc_socketmgr_t *manager) { 0, manager->maxIOCPThreads); if (manager->hIoCompletionPort == NULL) { errval = GetLastError(); - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_FAILED, @@ -565,7 +565,7 @@ iocompletionport_update(isc_socket_t *sock) { if (hiocp == NULL) { DWORD errval = GetLastError(); - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, @@ -631,7 +631,7 @@ initialise(void) { err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { char strbuf[ISC_STRERRORSIZE]; - isc__strerror(err, strbuf, sizeof(strbuf)); + strerror_r(err, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, "WSAStartup() %s: %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, ISC_MSG_FAILED, "failed"), @@ -898,7 +898,7 @@ make_nonblock(SOCKET fd) { ret = ioctlsocket(fd, FIONBIO, &flags); if (ret == -1) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "ioctlsocket(%d, FIOBIO, %d): %s", fd, flags, strbuf); @@ -1216,7 +1216,7 @@ map_socket_error(isc_socket_t *sock, int windows_errno, int *isc_errno, break; } if (doreturn == DOIO_HARD) { - isc__strerror(windows_errno, errorstring, bufsize); + strerror_r(windows_errno, errorstring, bufsize); } return (doreturn); } @@ -1410,7 +1410,7 @@ startio_send(isc_socket_t *sock, isc_socketevent_t *dev, int *nbytes, * If we got this far then something is wrong */ if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) { - isc__strerror(*send_errno, strbuf, sizeof(strbuf)); + strerror_r(*send_errno, strbuf, sizeof(strbuf)); socket_log(__LINE__, sock, NULL, IOEVENT, isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALSEND, @@ -1719,7 +1719,7 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, return (ISC_R_FAMILYNOSUPPORT); default: - isc__strerror(socket_errno, strbuf, sizeof(strbuf)); + strerror_r(socket_errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "socket() %s: %s", isc_msgcat_get(isc_msgcat, @@ -1757,7 +1757,7 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, if ((pf == AF_INET6) && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, (char *)&on, sizeof(on)) < 0)) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); + strerror_r(WSAGetLastError(), strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_RECVPKTINFO) " "%s: %s", sock->fd, @@ -1772,7 +1772,7 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, if ((pf == AF_INET6) && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO, (char *)&on, sizeof(on)) < 0)) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); + strerror_r(WSAGetLastError(), strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_PKTINFO) %s: %s", sock->fd, @@ -2194,7 +2194,7 @@ internal_connect(isc_socket_t *sock, IoCompletionInfo *lpo, int connect_errno) { #undef ERROR_MATCH default: result = ISC_R_UNEXPECTED; - isc__strerror(connect_errno, strbuf, sizeof(strbuf)); + strerror_r(connect_errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_connect: connect() %s", strbuf); @@ -2486,7 +2486,7 @@ SocketIoThread(LPVOID ThreadContext) { if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL)) { errval = GetLastError(); - isc__strerror(errval, strbuf, sizeof(strbuf)); + strerror_r(errval, strbuf, sizeof(strbuf)); FATAL_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_FAILED, @@ -3281,7 +3281,7 @@ isc__socket_bind(isc_socket_t *sock, const isc_sockaddr_t *sockaddr, case WSAEINVAL: return (ISC_R_BOUND); default: - isc__strerror(bind_errno, strbuf, sizeof(strbuf)); + strerror_r(bind_errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "bind: %s", strbuf); return (ISC_R_UNEXPECTED); @@ -3344,7 +3344,7 @@ isc__socket_listen(isc_socket_t *sock, unsigned int backlog) { if (listen(sock->fd, (int)backlog) < 0) { UNLOCK(&sock->lock); - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); + strerror_r(WSAGetLastError(), strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "listen: %s", strbuf); @@ -3354,7 +3354,7 @@ isc__socket_listen(isc_socket_t *sock, unsigned int backlog) { #if defined(ISC_PLATFORM_HAVETFO) && defined(TCP_FASTOPEN) if (setsockopt(sock->fd, IPPROTO_TCP, TCP_FASTOPEN, &on, sizeof(on)) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); + strerror_r(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, TCP_FASTOPEN) failed with %s", sock->fd, strbuf); @@ -3546,7 +3546,7 @@ isc__socket_connect(isc_socket_t *sock, const isc_sockaddr_t *addr, case WSAEINVAL: return (ISC_R_BOUND); default: - isc__strerror(bind_errno, strbuf, + strerror_r(bind_errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "bind: %s", strbuf); @@ -3682,7 +3682,7 @@ isc__socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { len = sizeof(addressp->type); if (getsockname(sock->fd, &addressp->type.sa, (void *)&len) < 0) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); + strerror_r(WSAGetLastError(), strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "getsockname: %s", strbuf); result = ISC_R_UNEXPECTED; diff --git a/lib/isc/win32/strerror.c b/lib/isc/win32/strerror.c deleted file mode 100644 index 36c9b7985c..0000000000 --- a/lib/isc/win32/strerror.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -/* - * Forward declarations - */ - -char * -FormatError(int error); - -char * -GetWSAErrorMessage(int errval); - -char * -NTstrerror(int err, BOOL *bfreebuf); - -/* - * We need to do this this way for profiled locks. - */ - -static isc_mutex_t isc_strerror_lock; -static void init_lock(void) { - RUNTIME_CHECK(isc_mutex_init(&isc_strerror_lock) == ISC_R_SUCCESS); -} - -/* - * This routine needs to free up any buffer allocated by FormatMessage - * if that routine gets used. - */ - -void -isc__strerror(int num, char *buf, size_t size) { - char *msg; - BOOL freebuf; - unsigned int unum = num; - static isc_once_t once = ISC_ONCE_INIT; - - REQUIRE(buf != NULL); - - RUNTIME_CHECK(isc_once_do(&once, init_lock) == ISC_R_SUCCESS); - - LOCK(&isc_strerror_lock); - freebuf = FALSE; - msg = NTstrerror(num, &freebuf); - if (msg != NULL) - snprintf(buf, size, "%s", msg); - else - snprintf(buf, size, "Unknown error: %u", unum); - if(freebuf && msg != NULL) { - LocalFree(msg); - } - UNLOCK(&isc_strerror_lock); -} - -/* - * Note this will cause a memory leak unless the memory allocated here - * is freed by calling LocalFree. isc__strerror does this before unlocking. - * This only gets called if there is a system type of error and will likely - * be an unusual event. - */ -char * -FormatError(int error) { - LPVOID lpMsgBuf = NULL; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - error, - /* Default language */ - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, - NULL); - - return (lpMsgBuf); -} - -/* - * This routine checks the error value and calls the WSA Windows Sockets - * Error message function GetWSAErrorMessage below if it's within that range - * since those messages are not available in the system error messages. - */ -char * -NTstrerror(int err, BOOL *bfreebuf) { - char *retmsg = NULL; - - /* Copy the error value first in case of other errors */ - DWORD errval = err; - - *bfreebuf = FALSE; - - /* Get the Winsock2 error messages */ - if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) { - retmsg = GetWSAErrorMessage(errval); - if (retmsg != NULL) - return (retmsg); - } - /* - * If it's not one of the standard Unix error codes, - * try a system error message - */ - if (errval > (DWORD) _sys_nerr) { - *bfreebuf = TRUE; - return (FormatError(errval)); - } else { - return (strerror(errval)); - } -} - -/* - * This is a replacement for perror - */ -void __cdecl -NTperror(char *errmsg) { - /* Copy the error value first in case of other errors */ - int errval = errno; - BOOL bfreebuf = FALSE; - char *msg; - - msg = NTstrerror(errval, &bfreebuf); - fprintf(stderr, "%s: %s\n", errmsg, msg); - if(bfreebuf == TRUE) { - LocalFree(msg); - } - -} - -/* - * Return the error string related to Winsock2 errors. - * This function is necessary since FormatMessage knows nothing about them - * and there is no function to get them. - */ -char * -GetWSAErrorMessage(int errval) { - char *msg; - - switch (errval) { - - case WSAEINTR: - msg = "Interrupted system call"; - break; - - case WSAEBADF: - msg = "Bad file number"; - break; - - case WSAEACCES: - msg = "Permission denied"; - break; - - case WSAEFAULT: - msg = "Bad address"; - break; - - case WSAEINVAL: - msg = "Invalid argument"; - break; - - case WSAEMFILE: - msg = "Too many open sockets"; - break; - - case WSAEWOULDBLOCK: - msg = "Operation would block"; - break; - - case WSAEINPROGRESS: - msg = "Operation now in progress"; - break; - - case WSAEALREADY: - msg = "Operation already in progress"; - break; - - case WSAENOTSOCK: - msg = "Socket operation on non-socket"; - break; - - case WSAEDESTADDRREQ: - msg = "Destination address required"; - break; - - case WSAEMSGSIZE: - msg = "Message too long"; - break; - - case WSAEPROTOTYPE: - msg = "Protocol wrong type for socket"; - break; - - case WSAENOPROTOOPT: - msg = "Bad protocol option"; - break; - - case WSAEPROTONOSUPPORT: - msg = "Protocol not supported"; - break; - - case WSAESOCKTNOSUPPORT: - msg = "Socket type not supported"; - break; - - case WSAEOPNOTSUPP: - msg = "Operation not supported on socket"; - break; - - case WSAEPFNOSUPPORT: - msg = "Protocol family not supported"; - break; - - case WSAEAFNOSUPPORT: - msg = "Address family not supported"; - break; - - case WSAEADDRINUSE: - msg = "Address already in use"; - break; - - case WSAEADDRNOTAVAIL: - msg = "Can't assign requested address"; - break; - - case WSAENETDOWN: - msg = "Network is down"; - break; - - case WSAENETUNREACH: - msg = "Network is unreachable"; - break; - - case WSAENETRESET: - msg = "Net connection reset"; - break; - - case WSAECONNABORTED: - msg = "Software caused connection abort"; - break; - - case WSAECONNRESET: - msg = "Connection reset by peer"; - break; - - case WSAENOBUFS: - msg = "No buffer space available"; - break; - - case WSAEISCONN: - msg = "Socket is already connected"; - break; - - case WSAENOTCONN: - msg = "Socket is not connected"; - break; - - case WSAESHUTDOWN: - msg = "Can't send after socket shutdown"; - break; - - case WSAETOOMANYREFS: - msg = "Too many references: can't splice"; - break; - - case WSAETIMEDOUT: - msg = "Connection timed out"; - break; - - case WSAECONNREFUSED: - msg = "Connection refused"; - break; - - case WSAELOOP: - msg = "Too many levels of symbolic links"; - break; - - case WSAENAMETOOLONG: - msg = "File name too long"; - break; - - case WSAEHOSTDOWN: - msg = "Host is down"; - break; - - case WSAEHOSTUNREACH: - msg = "No route to host"; - break; - - case WSAENOTEMPTY: - msg = "Directory not empty"; - break; - - case WSAEPROCLIM: - msg = "Too many processes"; - break; - - case WSAEUSERS: - msg = "Too many users"; - break; - - case WSAEDQUOT: - msg = "Disc quota exceeded"; - break; - - case WSAESTALE: - msg = "Stale NFS file handle"; - break; - - case WSAEREMOTE: - msg = "Too many levels of remote in path"; - break; - - case WSASYSNOTREADY: - msg = "Network system is unavailable"; - break; - - case WSAVERNOTSUPPORTED: - msg = "Winsock version out of range"; - break; - - case WSANOTINITIALISED: - msg = "WSAStartup not yet called"; - break; - - case WSAEDISCON: - msg = "Graceful shutdown in progress"; - break; -/* - case WSAHOST_NOT_FOUND: - msg = "Host not found"; - break; - - case WSANO_DATA: - msg = "No host data of that type was found"; - break; -*/ - default: - msg = NULL; - break; - } - return (msg); -} - -/* - * These error messages are more informative about CryptAPI Errors than the - * standard error messages - */ - -char * -GetCryptErrorMessage(int errval) { - char *msg; - - switch (errval) { - - case NTE_BAD_FLAGS: - msg = "The dwFlags parameter has an illegal value."; - break; - case NTE_BAD_KEYSET: - msg = "The Registry entry for the key container " - "could not be opened and may not exist."; - break; - case NTE_BAD_KEYSET_PARAM: - msg = "The pszContainer or pszProvider parameter " - "is set to an illegal value."; - break; - case NTE_BAD_PROV_TYPE: - msg = "The value of the dwProvType parameter is out " - "of range. All provider types must be from " - "1 to 999, inclusive."; - break; - case NTE_BAD_SIGNATURE: - msg = "The provider DLL signature did not verify " - "correctly. Either the DLL or the digital " - "signature has been tampered with."; - break; - case NTE_EXISTS: - msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key" - " container already exists."; - break; - case NTE_KEYSET_ENTRY_BAD: - msg = "The Registry entry for the pszContainer key container " - "was found (in the HKEY_CURRENT_USER window), but is " - "corrupt. See the section System Administration for " - " etails about CryptoAPI's Registry usage."; - break; - case NTE_KEYSET_NOT_DEF: - msg = "No Registry entry exists in the HKEY_CURRENT_USER " - "window for the key container specified by " - "pszContainer."; - break; - case NTE_NO_MEMORY: - msg = "The CSP ran out of memory during the operation."; - break; - case NTE_PROV_DLL_NOT_FOUND: - msg = "The provider DLL file does not exist or is not on the " - "current path."; - break; - case NTE_PROV_TYPE_ENTRY_BAD: - msg = "The Registry entry for the provider type specified by " - "dwProvType is corrupt. This error may relate to " - "either the user default CSP list or the machine " - "default CSP list. See the section System " - "Administration for details about CryptoAPI's " - "Registry usage."; - break; - case NTE_PROV_TYPE_NO_MATCH: - msg = "The provider type specified by dwProvType does not " - "match the provider type found in the Registry. Note " - "that this error can only occur when pszProvider " - "specifies an actual CSP name."; - break; - case NTE_PROV_TYPE_NOT_DEF: - msg = "No Registry entry exists for the provider type " - "specified by dwProvType."; - break; - case NTE_PROVIDER_DLL_FAIL: - msg = "The provider DLL file could not be loaded, and " - "may not exist. If it exists, then the file is " - "not a valid DLL."; - break; - case NTE_SIGNATURE_FILE_BAD: - msg = "An error occurred while loading the DLL file image, " - "prior to verifying its signature."; - break; - - default: - msg = NULL; - break; - } - return msg; -} - diff --git a/util/copyrights b/util/copyrights index a5a915e457..a77958d087 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3562,7 +3562,6 @@ ./lib/isc/unix/include/isc/offset.h C 2000,2001,2004,2005,2007,2008,2016,2018 ./lib/isc/unix/include/isc/stat.h C 2004,2007,2014,2016,2018 ./lib/isc/unix/include/isc/stdtime.h C 1999,2000,2001,2004,2005,2007,2011,2012,2016,2018 -./lib/isc/unix/include/isc/strerror.h C 2001,2004,2005,2007,2008,2016,2018 ./lib/isc/unix/include/isc/syslog.h C 1999,2000,2001,2004,2005,2007,2016,2018 ./lib/isc/unix/include/isc/time.h C 1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2012,2014,2015,2016,2017,2018 ./lib/isc/unix/include/pkcs11/cryptoki.h X 2014,2018 @@ -3578,7 +3577,6 @@ ./lib/isc/unix/socket_p.h C 2000,2001,2004,2005,2007,2008,2009,2016,2018 ./lib/isc/unix/stdio.c C 2000,2001,2004,2007,2011,2012,2013,2014,2016,2018 ./lib/isc/unix/stdtime.c C 1999,2000,2001,2004,2005,2007,2016,2018 -./lib/isc/unix/strerror.c C 2001,2004,2005,2007,2009,2016,2018 ./lib/isc/unix/syslog.c C 2001,2004,2005,2007,2016,2018 ./lib/isc/unix/time.c C 1998,1999,2000,2001,2003,2004,2005,2006,2007,2008,2011,2012,2014,2015,2016,2017,2018 ./lib/isc/version.c C 1998,1999,2000,2001,2004,2005,2007,2016,2018 @@ -3608,7 +3606,6 @@ ./lib/isc/win32/include/isc/platform.h.in C 2001,2004,2005,2007,2008,2009,2013,2014,2015,2016,2017,2018 ./lib/isc/win32/include/isc/stat.h C 2000,2001,2003,2004,2007,2009,2012,2016,2018 ./lib/isc/win32/include/isc/stdtime.h C 1999,2000,2001,2004,2005,2007,2011,2012,2016,2018 -./lib/isc/win32/include/isc/strerror.h C 2001,2004,2007,2016,2018 ./lib/isc/win32/include/isc/syslog.h C 1999,2000,2001,2004,2007,2016,2018 ./lib/isc/win32/include/isc/thread.h C 1998,1999,2000,2001,2004,2005,2007,2009,2013,2016,2017,2018 ./lib/isc/win32/include/isc/time.h C 1998,1999,2000,2001,2004,2006,2007,2008,2009,2012,2014,2015,2016,2017,2018 @@ -3635,7 +3632,6 @@ ./lib/isc/win32/socket.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 ./lib/isc/win32/stdio.c C 2000,2001,2004,2007,2013,2016,2018 ./lib/isc/win32/stdtime.c C 1999,2000,2001,2004,2007,2013,2016,2018 -./lib/isc/win32/strerror.c C 2001,2002,2004,2007,2016,2018 ./lib/isc/win32/syslog.c C 2001,2002,2003,2004,2007,2014,2016,2018 ./lib/isc/win32/syslog.h C 2001,2002,2004,2007,2016,2018 ./lib/isc/win32/thread.c C 1998,1999,2000,2001,2004,2005,2007,2016,2017,2018 From a11a271b28ccd35fe539178eaeecdabad6e2976e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 15:29:49 +0200 Subject: [PATCH 25/30] Assume non-broken recvmsg --- config.h.in | 4 ---- configure | 54 ------------------------------------------- configure.in | 11 --------- lib/isc/unix/socket.c | 18 --------------- 4 files changed, 87 deletions(-) diff --git a/config.h.in b/config.h.in index ae9a89cc7b..06188f2240 100644 --- a/config.h.in +++ b/config.h.in @@ -92,10 +92,6 @@ /* define if ATF unit tests are to be built. */ #undef ATF_TEST -/* Define if recvmsg() does not meet all of the BSD socket API specifications. - */ -#undef BROKEN_RECVMSG - /* Define if you cannot bind() before connect() for TCP sockets. */ #undef BROKEN_TCP_BIND_BEFORE_CONNECT diff --git a/configure b/configure index dff9c52199..9c500585cc 100755 --- a/configure +++ b/configure @@ -729,12 +729,8 @@ DST_EXTRA_SRCS DST_EXTRA_OBJS USE_ISC_SPNEGO READLINE_LIB -ISC_PLATFORM_NEEDSTRCASESTR ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSTRLCPY -GENRANDOMLIB -ISC_PLATFORM_NEEDSTRTOUL -ISC_PLATFORM_NEEDMEMMOVE ISC_PLATFORM_HAVETFO ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ @@ -17963,28 +17959,6 @@ esac # # Check for some other useful functions that are not ever-present. # - -ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : - ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE" -else - ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1" -fi - - - -ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" -if test "x$ac_cv_func_strtoul" = xyes; then : - ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL" - GENRANDOMLIB="" -else - ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1" - GENRANDOMLIB='${ISCLIBS}' -fi - - - - ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" if test "x$ac_cv_func_strlcpy" = xyes; then : ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY" @@ -18003,15 +17977,6 @@ fi -ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr" -if test "x$ac_cv_func_strcasestr" = xyes; then : - ISC_PLATFORM_NEEDSTRCASESTR="#undef ISC_PLATFORM_NEEDSTRCASESTR" -else - ISC_PLATFORM_NEEDSTRCASESTR="#define ISC_PLATFORM_NEEDSTRCASESTR 1" -fi - - - # Check whether --with-readline was given. @@ -18154,13 +18119,6 @@ done fi - -ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" -if test "x$ac_cv_func_strerror" = xyes; then : - $as_echo "#define HAVE_STRERROR 1" >>confdefs.h - -fi - # # Use our own SPNEGO implementation? # @@ -18424,18 +18382,6 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# Some hosts need msg_namelen to match the size of the socket structure. -# Some hosts don't set msg_namelen appropriately on return from recvmsg(). -# -case $host in -*os2*|*hp-mpeix*) - -$as_echo "#define BROKEN_RECVMSG 1" >>confdefs.h - - ;; -esac - # # Microsoft has their own way of handling shared libraries that requires # additional qualifiers on extern variables. Unix systems don't need it. diff --git a/configure.in b/configure.in index 072661392e..7b58c42558 100644 --- a/configure.in +++ b/configure.in @@ -2193,17 +2193,6 @@ AC_TRY_COMPILE([#include ],[struct stat s; return(s.st_mtim.tv_nsec ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"]) AC_SUBST(ISC_PLATFORM_HAVESTATNSEC) -# -# Some hosts need msg_namelen to match the size of the socket structure. -# Some hosts don't set msg_namelen appropriately on return from recvmsg(). -# -case $host in -*os2*|*hp-mpeix*) - AC_DEFINE(BROKEN_RECVMSG, 1, - [Define if recvmsg() does not meet all of the BSD socket API specifications.]) - ;; -esac - # # Microsoft has their own way of handling shared libraries that requires # additional qualifiers on extern variables. Unix systems don't need it. diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 1f3deaeda6..2b5645a1ba 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1591,26 +1591,8 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev, if (sock->type == isc_sockettype_udp) { memset(&dev->address, 0, sizeof(dev->address)); -#ifdef BROKEN_RECVMSG - if (sock->pf == AF_INET) { - msg->msg_name = (void *)&dev->address.type.sin; - msg->msg_namelen = sizeof(dev->address.type.sin6); - } else if (sock->pf == AF_INET6) { - msg->msg_name = (void *)&dev->address.type.sin6; - msg->msg_namelen = sizeof(dev->address.type.sin6); -#ifdef ISC_PLATFORM_HAVESYSUNH - } else if (sock->pf == AF_UNIX) { - msg->msg_name = (void *)&dev->address.type.sunix; - msg->msg_namelen = sizeof(dev->address.type.sunix); -#endif - } else { - msg->msg_name = (void *)&dev->address.type.sa; - msg->msg_namelen = sizeof(dev->address.type); - } -#else msg->msg_name = (void *)&dev->address.type.sa; msg->msg_namelen = sizeof(dev->address.type); -#endif } else { /* TCP */ msg->msg_name = NULL; msg->msg_namelen = 0; From 52e1c451565c3334fdfe34162fd5da61c85addce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 15:33:08 +0200 Subject: [PATCH 26/30] Assume PTHREAD_ONCE_INIT is not broken (remove support for ancient Solaris) --- configure | 35 ----------------------------- configure.in | 20 ----------------- lib/isc/include/isc/platform.h.in | 6 ----- lib/isc/pthreads/include/isc/once.h | 10 --------- 4 files changed, 71 deletions(-) diff --git a/configure b/configure index 9c500585cc..6d3b3c2ce5 100755 --- a/configure +++ b/configure @@ -719,7 +719,6 @@ ISC_PLATFORM_HAVEXADD ISC_PLATFORM_HAVESTDATOMIC ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVESTRINGSH -ISC_PLATFORM_BRACEPTHREADONCEINIT IRS_PLATFORM_USEDECLSPEC ISC_PLATFORM_USEDECLSPEC ISC_PLATFORM_HAVESTATNSEC @@ -18396,40 +18395,6 @@ IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" # XXXDCL print messages to indicate some compensation is being done? # -ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT" - -case "$host" in - *-solaris2.[89]) - hack_shutup_pthreadonceinit=yes - ;; - *-solaris2.1[0-9]) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include -int -main () -{ - static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - hack_shutup_pthreadonceinit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -esac - -case "$hack_shutup_pthreadonceinit" in - yes) - # - # Shut up PTHREAD_ONCE_INIT unbraced initializer warnings. - # - ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1" - ;; -esac - for ac_header in strings.h do : ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" diff --git a/configure.in b/configure.in index 7b58c42558..be9a178edc 100644 --- a/configure.in +++ b/configure.in @@ -2206,26 +2206,6 @@ IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" # Random remaining OS-specific issues involving compiler warnings. # XXXDCL print messages to indicate some compensation is being done? # -AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT) -ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT" - -case "$host" in - [*-solaris2.[89]]) - hack_shutup_pthreadonceinit=yes - ;; - *-solaris2.1[[0-9]]) - AC_TRY_COMPILE([ #include ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], ) - ;; -esac - -case "$hack_shutup_pthreadonceinit" in - yes) - # - # Shut up PTHREAD_ONCE_INIT unbraced initializer warnings. - # - ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1" - ;; -esac AC_CHECK_HEADERS(strings.h, ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1" diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index d2bcdd8aa1..a2d3a37a03 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -134,12 +134,6 @@ */ @ISC_PLATFORM_HAVELONGLONG@ -/* - * Define if PTHREAD_ONCE_INIT should be surrounded by braces to - * prevent compiler warnings (such as with gcc on Solaris 2.8). - */ -@ISC_PLATFORM_BRACEPTHREADONCEINIT@ - /* * Used to control how extern data is linked; needed for Win32 platforms. */ diff --git a/lib/isc/pthreads/include/isc/once.h b/lib/isc/pthreads/include/isc/once.h index a0e955939c..71cd16b82f 100644 --- a/lib/isc/pthreads/include/isc/once.h +++ b/lib/isc/pthreads/include/isc/once.h @@ -22,17 +22,7 @@ typedef pthread_once_t isc_once_t; -#ifdef ISC_PLATFORM_BRACEPTHREADONCEINIT -/*! - * This accomodates systems that define PTHRAD_ONCE_INIT improperly. - */ -#define ISC_ONCE_INIT { PTHREAD_ONCE_INIT } -#else -/*! - * This is the usual case. - */ #define ISC_ONCE_INIT PTHREAD_ONCE_INIT -#endif /* XXX We could do fancier error handling... */ From f1d658764c0f23a1d38ba17e165287f79c4e868f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 21 Aug 2018 15:34:24 +0200 Subject: [PATCH 27/30] Remove dead check for long long support --- configure | 25 ------------------------- configure.in | 7 ------- lib/isc/include/isc/platform.h.in | 5 ----- 3 files changed, 37 deletions(-) diff --git a/configure b/configure index 6d3b3c2ce5..415c731db2 100755 --- a/configure +++ b/configure @@ -788,7 +788,6 @@ ISC_PLATFORM_HAVEKQUEUE ISC_PLATFORM_HAVELIFCONF ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE -ISC_PLATFORM_HAVELONGLONG ISC_SOCKADDR_LEN_T expanded_sysconfdir PYTHON_INSTALL_LIB @@ -13976,30 +13975,6 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long" >&5 -$as_echo_n "checking for long long... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -long long i = 0; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # # check for uname library routine diff --git a/configure.in b/configure.in index be9a178edc..bc22b893dc 100644 --- a/configure.in +++ b/configure.in @@ -518,13 +518,6 @@ int getsockname(int, struct sockaddr *, size_t *); ]) AC_SUBST(ISC_SOCKADDR_LEN_T) AC_HEADER_TIME -AC_MSG_CHECKING(for long long) -AC_TRY_COMPILE([],[long long i = 0; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"]) -AC_SUBST(ISC_PLATFORM_HAVELONGLONG) # # check for uname library routine diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index a2d3a37a03..977364722b 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -129,11 +129,6 @@ */ @ISC_PLATFORM_HAVESTATNSEC@ -/* - * Define if your compiler supports "long long int". - */ -@ISC_PLATFORM_HAVELONGLONG@ - /* * Used to control how extern data is linked; needed for Win32 platforms. */ From a8b868e820672a0ea7841b34767842777cb82e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 28 Aug 2018 10:28:43 +0200 Subject: [PATCH 28/30] Add release notes entry. --- doc/arm/notes.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml index b680339d5c..f3c4e2017a 100644 --- a/doc/arm/notes.xml +++ b/doc/arm/notes.xml @@ -269,6 +269,13 @@ BIND 8 when processing an IXFR stream. 'no-change' deltas will now trigger a fallback to AXFR as the recovery mechanism. + + BIND 9 will no longer build on platforms that doesn't have + proper IPv6 support. BIND 9 now also requires non-broken + POSIX-compatible pthread support. Such platforms are + usually long after their end-of-life date and they are + neither developed nor supported by their respective vendors. + From 19a374e45db3ffa8134b93f045a8b8f916140ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 28 Aug 2018 10:36:25 +0200 Subject: [PATCH 29/30] Cleanup util/copyrights --- util/copyrights | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/util/copyrights b/util/copyrights index a77958d087..e3f86dba55 100644 --- a/util/copyrights +++ b/util/copyrights @@ -2576,9 +2576,6 @@ ./contrib/queryperf/configure.in X 2001,2004,2007,2012,2018 ./contrib/queryperf/input/sample.0 X 2001,2018 ./contrib/queryperf/input/sample.1 X 2001,2018 -./contrib/queryperf/missing/addrinfo.h X 2004,2018 -./contrib/queryperf/missing/getaddrinfo.c X 2004,2018 -./contrib/queryperf/missing/getnameinfo.c X 2004,2018 ./contrib/queryperf/queryperf.c X 2001,2002,2003,2004,2005,2007,2012,2013,2014,2018 ./contrib/queryperf/utils/gen-data-queryperf.py X 2003,2008,2016,2018 ./contrib/scripts/check-secure-delegation.pl.in PERL 2010,2012,2014,2016,2018 @@ -3392,7 +3389,6 @@ ./lib/isc/include/isc/ht.h C 2016,2017,2018 ./lib/isc/include/isc/httpd.h C 2006,2007,2008,2014,2016,2018 ./lib/isc/include/isc/interfaceiter.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018 -./lib/isc/include/isc/ipv6.h C 1999,2000,2001,2002,2004,2005,2007,2016,2017,2018 ./lib/isc/include/isc/iterated_hash.h C 2008,2014,2016,2018 ./lib/isc/include/isc/json.h C 2013,2015,2016,2018 ./lib/isc/include/isc/lang.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018 @@ -3457,8 +3453,6 @@ ./lib/isc/include/pkcs11/pkcs11.h X 2014,2016,2018 ./lib/isc/include/pkcs11/pkcs11f.h X 2014,2016,2018 ./lib/isc/include/pkcs11/pkcs11t.h X 2014,2016,2018 -./lib/isc/inet_ntop.c C 1996,1997,1998,1999,2000,2001,2004,2005,2007,2009,2016,2017,2018 -./lib/isc/inet_pton.c C 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2007,2013,2014,2016,2017,2018 ./lib/isc/iterated_hash.c C 2006,2008,2009,2016,2018 ./lib/isc/lex.c C 1998,1999,2000,2001,2002,2003,2004,2005,2007,2013,2014,2015,2016,2017,2018 ./lib/isc/lfsr.c C 1999,2000,2001,2002,2004,2005,2007,2016,2018 @@ -3506,7 +3500,6 @@ ./lib/isc/sparc64/include/isc/atomic.h C 2005,2007,2013,2016,2018 ./lib/isc/stats.c C 2009,2012,2013,2014,2015,2016,2017,2018 ./lib/isc/string.c C 1999,2000,2001,2003,2004,2005,2006,2007,2011,2012,2014,2015,2016,2018 -./lib/isc/strtoul.c C 2003,2004,2005,2007,2014,2016,2018 ./lib/isc/symtab.c C 1996,1997,1998,1999,2000,2001,2004,2005,2007,2011,2012,2013,2016,2018 ./lib/isc/task.c C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 ./lib/isc/taskpool.c C 1999,2000,2001,2004,2005,2007,2011,2012,2013,2016,2018 @@ -3553,8 +3546,6 @@ ./lib/isc/unix/file.c C 2000,2001,2002,2004,2005,2007,2009,2011,2012,2013,2014,2015,2016,2017,2018 ./lib/isc/unix/fsaccess.c C 2000,2001,2004,2005,2006,2007,2016,2018 ./lib/isc/unix/ifiter_getifaddrs.c C 2003,2004,2005,2007,2008,2009,2014,2016,2018 -./lib/isc/unix/ifiter_ioctl.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2014,2015,2016,2017,2018 -./lib/isc/unix/ifiter_sysctl.c C 1999,2000,2001,2002,2003,2004,2005,2007,2014,2015,2016,2018 ./lib/isc/unix/include/isc/dir.h C 1999,2000,2001,2004,2005,2007,2016,2018 ./lib/isc/unix/include/isc/keyboard.h C 2000,2001,2004,2005,2007,2016,2018 ./lib/isc/unix/include/isc/net.h C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2012,2013,2014,2016,2017,2018 @@ -3566,7 +3557,6 @@ ./lib/isc/unix/include/isc/time.h C 1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2012,2014,2015,2016,2017,2018 ./lib/isc/unix/include/pkcs11/cryptoki.h X 2014,2018 ./lib/isc/unix/interfaceiter.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2014,2016,2017,2018 -./lib/isc/unix/ipv6.c C 1999,2000,2001,2004,2005,2006,2007,2016,2018 ./lib/isc/unix/keyboard.c C 2000,2001,2004,2007,2016,2018 ./lib/isc/unix/meminfo.c C 2015,2016,2018 ./lib/isc/unix/net.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2012,2013,2014,2015,2016,2017,2018 From 2c198771978bab454b4c2d58b35bb4618787681d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 28 Aug 2018 10:30:44 +0200 Subject: [PATCH 30/30] Add CHANGES entry for GL #192 5016. [cleanup] Remove wrappers that try to fix broken or incomplete implementations of IPv6, pthreads and other core functionality required and used by BIND. [GL #192] --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index c4fc88a616..dfb597b73a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5023. [cleanup] Remove wrappers that try to fix broken or incomplete + implementations of IPv6, pthreads and other core + functionality required and used by BIND. [GL #192] + 5022. [doc] Update ms-self, ms-subdomain, krb5-self, and krb5-subdomain documentation. [GL !708]