From: Ondřej Surý Date: Tue, 21 Aug 2018 11:48:48 +0000 (+0200) Subject: Remove support for legacy systems without inet_{ntop,pton} w/ IPv6 support X-Git-Tag: v9.13.3~30^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=388d6db5a1d3deac1ddf910f40d8988e4d540719;p=thirdparty%2Fbind9.git Remove support for legacy systems without inet_{ntop,pton} w/ IPv6 support --- diff --git a/configure.in b/configure.in index 98e327a584b..d8550c6ff86 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 d4e316865ab..098467b4902 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 3db6b55f876..18cec640cea 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 fb06f850fd6..00000000000 --- 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 bde88e3bec6..00000000000 --- 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 a8e7e0fc1f8..335b1dbb64a 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 ab40a71d8c9..b1005e7e9b2 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 3349845d0d4..fe570b56f8f 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 2bfe9deb957..00000000000 --- 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 09fcfa8e0ca..84c5fc9e7ac 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 85c424976f4..1fe214002bd 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 4be866fe997..dea6cb94c95 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 d276fa8067a..d490f0c32d9 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