summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-01-06 17:41:31 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-01-06 17:41:31 +0000
commitf8c8dc76c3b32d96388af756126dda8c14a18cf7 (patch)
tree50463fb34e4e96ef16c359fe8c5e5b98422880cb /usr.sbin
parent7e026badb3e71f0b65f5f78ccc6d85f03c0b92d3 (diff)
We only need the config parser from liblwres.
This pulls out the config object (lwres_conf_t) from the context (lwres_context_t), switches to libc functions (lwres_net_ntop vs inet_ntop etc ) and removes a lwres_ prefix from number types (lwres_uint8_t vs uint8_t etc). With that we can nearly empty out lib/lwres and lose about 20k lines in the process. OK sthen
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bind/bin/dig/dighost.c41
-rw-r--r--usr.sbin/bind/configure68
-rw-r--r--usr.sbin/bind/configure.in80
-rw-r--r--usr.sbin/bind/lib/lwres/Atffile5
-rw-r--r--usr.sbin/bind/lib/lwres/Makefile.in39
-rw-r--r--usr.sbin/bind/lib/lwres/api13
-rw-r--r--usr.sbin/bind/lib/lwres/assert_p.h35
-rw-r--r--usr.sbin/bind/lib/lwres/compat.c155
-rw-r--r--usr.sbin/bind/lib/lwres/context.c515
-rw-r--r--usr.sbin/bind/lib/lwres/context_p.h66
-rw-r--r--usr.sbin/bind/lib/lwres/gai_strerror.c83
-rw-r--r--usr.sbin/bind/lib/lwres/getaddrinfo.c806
-rw-r--r--usr.sbin/bind/lib/lwres/gethost.c364
-rw-r--r--usr.sbin/bind/lib/lwres/getipnode.c1165
-rw-r--r--usr.sbin/bind/lib/lwres/getnameinfo.c346
-rw-r--r--usr.sbin/bind/lib/lwres/getrrset.c291
-rw-r--r--usr.sbin/bind/lib/lwres/herror.c119
-rw-r--r--usr.sbin/bind/lib/lwres/include/Makefile.in24
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/Makefile.in51
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/context.h135
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/int.h33
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/ipv6.h123
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/lang.h32
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/lwbuffer.h405
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/lwpacket.h158
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/lwres.h442
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/netdb.h.in521
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/platform.h.in124
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/stdlib.h37
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/string.h37
-rw-r--r--usr.sbin/bind/lib/lwres/include/lwres/version.h27
-rw-r--r--usr.sbin/bind/lib/lwres/lwbuffer.c360
-rw-r--r--usr.sbin/bind/lib/lwres/lwconfig.c193
-rw-r--r--usr.sbin/bind/lib/lwres/lwinetaton.c201
-rw-r--r--usr.sbin/bind/lib/lwres/lwinetntop.c196
-rw-r--r--usr.sbin/bind/lib/lwres/lwinetpton.c214
-rw-r--r--usr.sbin/bind/lib/lwres/lwpacket.c128
-rw-r--r--usr.sbin/bind/lib/lwres/lwres_gabn.c504
-rw-r--r--usr.sbin/bind/lib/lwres/lwres_gnba.c414
-rw-r--r--usr.sbin/bind/lib/lwres/lwres_grbn.c425
-rw-r--r--usr.sbin/bind/lib/lwres/lwres_noop.c341
-rw-r--r--usr.sbin/bind/lib/lwres/lwresutil.c575
-rw-r--r--usr.sbin/bind/lib/lwres/man/Makefile.in308
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres.3184
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres.html256
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_buffer.3260
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_buffer.html457
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_config.3124
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_config.html177
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_context.3189
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_context.html302
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gabn.3225
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gabn.html312
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.3148
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html168
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.3262
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html382
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gethostent.3337
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gethostent.html485
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getipnode.3228
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getipnode.html324
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.3135
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html207
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.3178
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html212
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gnba.3210
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_gnba.html312
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_hstrerror.3118
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html134
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_inetntop.396
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_inetntop.html120
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_noop.3210
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_noop.html306
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_packet.3194
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_packet.html272
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_resutil.3193
-rw-r--r--usr.sbin/bind/lib/lwres/man/lwres_resutil.html268
-rw-r--r--usr.sbin/bind/lib/lwres/print.c583
-rw-r--r--usr.sbin/bind/lib/lwres/print_p.h94
-rw-r--r--usr.sbin/bind/lib/lwres/unix/Makefile.in24
-rw-r--r--usr.sbin/bind/lib/lwres/unix/include/Makefile.in24
-rw-r--r--usr.sbin/bind/lib/lwres/unix/include/lwres/Makefile.in38
-rw-r--r--usr.sbin/bind/lib/lwres/unix/include/lwres/net.h134
-rw-r--r--usr.sbin/bind/lib/lwres/version.c27
84 files changed, 111 insertions, 18997 deletions
diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c
index 06aeb8b8110..c05590f8eac 100644
--- a/usr.sbin/bind/bin/dig/dighost.c
+++ b/usr.sbin/bind/bin/dig/dighost.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.21 2019/12/17 01:52:25 sthen Exp $ */
+/* $Id: dighost.c,v 1.22 2020/01/06 17:41:29 florian Exp $ */
/*! \file
* \note
@@ -97,7 +97,6 @@
#include <isccfg/namedconf.h>
#include <lwres/lwres.h>
-#include <lwres/net.h>
#include <bind9/getaddresses.h>
@@ -115,8 +114,8 @@
#define NS_IN6ADDRSZ 16
#endif
-static lwres_context_t *lwctx = NULL;
-static lwres_conf_t *lwconf;
+static lwres_conf_t confdata;
+static lwres_conf_t *lwconf = &confdata;
dig_lookuplist_t lookup_list;
dig_serverlist_t server_list;
@@ -404,16 +403,6 @@ check_next_lookup(dig_lookup_t *lookup);
static isc_boolean_t
next_origin(dig_lookup_t *oldlookup);
-static void *
-mem_alloc(void *arg, size_t size) {
- return (isc_mem_get(arg, size));
-}
-
-static void
-mem_free(void *arg, void *mem, size_t size) {
- isc_mem_put(arg, mem, size);
-}
-
char *
next_token(char **stringp, const char *delim) {
char *res;
@@ -660,7 +649,7 @@ copy_server_list(lwres_conf_t *confdata, dig_serverlist_t *dest) {
if (af == AF_INET6 && !have_ipv6)
continue;
- lwres_net_ntop(af, confdata->nameservers[i].address,
+ inet_ntop(af, confdata->nameservers[i].address,
tmp, sizeof(tmp));
if (af == AF_INET6 && confdata->nameservers[i].zone != 0) {
char buf[sizeof("%4000000000")];
@@ -739,7 +728,7 @@ add_nameserver(lwres_conf_t *confdata, const char *addr, int af) {
return (ISC_R_FAILURE);
}
- if (lwres_net_pton(af, addr, &confdata->nameservers[i].address) == 1) {
+ if (inet_pton(af, addr, &confdata->nameservers[i].address) == 1) {
confdata->nsnext++;
return (ISC_R_SUCCESS);
}
@@ -1424,7 +1413,6 @@ void
setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) {
dig_searchlist_t *domain = NULL;
lwres_result_t lwresult;
- unsigned int lwresflags;
isc_result_t result;
debug("setup_system()");
@@ -1447,23 +1435,11 @@ setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) {
}
}
- lwresflags = LWRES_CONTEXT_SERVERMODE;
- if (have_ipv4)
- lwresflags |= LWRES_CONTEXT_USEIPV4;
- if (have_ipv6)
- lwresflags |= LWRES_CONTEXT_USEIPV6;
-
- lwresult = lwres_context_create(&lwctx, mctx, mem_alloc, mem_free,
- lwresflags);
- if (lwresult != LWRES_R_SUCCESS)
- fatal("lwres_context_create failed");
-
- lwresult = lwres_conf_parse(lwctx, RESOLV_CONF);
+ lwres_conf_init(lwconf);
+ lwresult = lwres_conf_parse(lwconf, RESOLV_CONF);
if (lwresult != LWRES_R_SUCCESS && lwresult != LWRES_R_NOTFOUND)
fatal("parse of %s failed", RESOLV_CONF);
- lwconf = lwres_conf_get(lwctx);
-
/* Make the search list */
if (lwconf->searchnxt > 0)
create_search_list(lwconf);
@@ -4454,8 +4430,7 @@ destroy_libs(void) {
free_now = ISC_TRUE;
- lwres_conf_clear(lwctx);
- lwres_context_destroy(&lwctx);
+ lwres_conf_clear(lwconf);
flush_server_list();
diff --git a/usr.sbin/bind/configure b/usr.sbin/bind/configure
index 44af44ea01e..fd320e2e432 100644
--- a/usr.sbin/bind/configure
+++ b/usr.sbin/bind/configure
@@ -716,20 +716,16 @@ ISC_PLATFORM_HAVESTDATOMIC
ISC_PLATFORM_HAVEIFNAMETOINDEX
ISC_PLATFORM_HAVESTRINGSH
ISC_PLATFORM_BRACEPTHREADONCEINIT
-LWRES_PLATFORM_USEDECLSPEC
ISC_PLATFORM_USEDECLSPEC
ISC_PLATFORM_RLIMITTYPE
ISC_PLATFORM_HAVESTATNSEC
ISC_PLATFORM_HAVESYSUNH
-LWRES_PLATFORM_QUADFORMAT
ISC_PLATFORM_QUADFORMAT
DST_EXTRA_SRCS
DST_EXTRA_OBJS
USE_ISC_SPNEGO
ISC_EXTRA_SRCS
ISC_EXTRA_OBJS
-LWRES_PLATFORM_NEEDVSNPRINTF
-LWRES_PLATFORM_NEEDSPRINTF
ISC_PLATFORM_NEEDVSNPRINTF
ISC_PLATFORM_NEEDSPRINTF
ISC_PLATFORM_NEEDFPRINTF
@@ -737,10 +733,8 @@ ISC_PLATFORM_NEEDPRINTF
READLINE_LIB
ISC_PLATFORM_NEEDSTRCASESTR
ISC_PLATFORM_NEEDSTRLCAT
-LWRES_PLATFORM_NEEDSTRLCPY
ISC_PLATFORM_NEEDSTRLCPY
GENRANDOMLIB
-LWRES_PLATFORM_NEEDSTRTOUL
ISC_PLATFORM_NEEDSTRTOUL
ISC_PLATFORM_NEEDMEMMOVE
ISC_PLATFORM_NEEDSTRSEP
@@ -758,7 +752,6 @@ ISC_LWRES_NEEDRRSETINFO
ISC_LWRES_NEEDADDRINFO
ISC_PLATFORM_NEEDPORTT
ISC_PLATFORM_MSGHDRFLAVOR
-LWRES_PLATFORM_HAVESALEN
ISC_PLATFORM_HAVESALEN
ISC_PLATFORM_NEEDPTON
ISC_PLATFORM_NEEDNTOP
@@ -773,17 +766,11 @@ ISC_IPV6_H
ISC_PLATFORM_HAVESOCKADDRSTORAGE
ISC_PLATFORM_FIXIN6ISADDR
ISC_PLATFORM_HAVEIN6PKTINFO
-LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK
ISC_PLATFORM_NEEDIN6ADDRLOOPBACK
-LWRES_PLATFORM_NEEDIN6ADDRANY
ISC_PLATFORM_NEEDIN6ADDRANY
-LWRES_PLATFORM_HAVEINADDR6
ISC_PLATFORM_HAVEINADDR6
-LWRES_PLATFORM_NEEDNETINET6IN6H
ISC_PLATFORM_NEEDNETINET6IN6H
-LWRES_PLATFORM_NEEDNETINETIN6H
ISC_PLATFORM_NEEDNETINETIN6H
-LWRES_PLATFORM_HAVEIPV6
ISC_PLATFORM_HAVEIPV6
BIND9_CO_RULE
LIBTOOL_IN_MAIN
@@ -862,7 +849,6 @@ ISC_PLATFORM_HAVEGSSAPI
KRB5_CONFIG
GEOIPLINKOBJS
GEOIPLINKSRCS
-LWRES_PLATFORM_NEEDSYSSELECTH
ISC_PLATFORM_NEEDSYSSELECTH
ISC_PLATFORM_HAVEDEVPOLL
ISC_PLATFORM_HAVEEPOLL
@@ -13540,14 +13526,12 @@ if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
- LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
case $ac_cv_header_sys_select_h in
yes)
ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
- LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
;;
no)
as_fn_error $? "need either working unistd.h or sys/select.h" "$LINENO" 5
@@ -13561,7 +13545,6 @@ no)
case $ac_cv_header_sys_select_h in
yes)
ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
- LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
;;
no)
as_fn_error $? "need either unistd.h or sys/select.h" "$LINENO" 5
@@ -13571,7 +13554,6 @@ no)
esac
-
#
# Find the machine's endian flavor.
#
@@ -17947,12 +17929,10 @@ esac
case "$host" in
*-bsdi4.[01]*)
ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
- LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
isc_netinet6in6_hack="#include <netinet6/in6.h>"
;;
*)
ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
- LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
isc_netinet6in6_hack=""
;;
esac
@@ -17965,13 +17945,11 @@ case "$host" in
*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
# UnixWare
ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
- LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
isc_netinetin6_hack="#include <netinet/in6.h>"
;;
*)
ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
- LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
isc_netinetin6_hack=""
;;
@@ -17983,7 +17961,6 @@ esac
case "$found_ipv6" in
yes)
ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
- LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for in6_addr" >&5
$as_echo_n "checking for in6_addr... " >&6; }
@@ -18008,13 +17985,11 @@ 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"
- LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_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"
- LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
isc_in_addr6_hack="#define in6_addr in_addr6"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -18043,12 +18018,10 @@ 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"
- LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_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"
- LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
@@ -18077,12 +18050,10 @@ 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"
- LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_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"
- LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
@@ -18152,9 +18123,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
no)
ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
- LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
- LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
@@ -18210,12 +18179,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
@@ -18388,17 +18351,14 @@ 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"
- LWRES_PLATFORM_HAVESALEN="#define LWRES_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"
- LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
#
# Look for a 4.4BSD or 4.3BSD struct msghdr
#
@@ -18851,30 +18811,24 @@ 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"
- LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
GENRANDOMLIB=""
else
ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
- LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_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"
- LWRES_PLATFORM_NEEDSTRLCPY="#undef LWRES_PLATFORM_NEEDSTRLCPY"
else
ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"
- LWRES_PLATFORM_NEEDSTRLCPY="#define LWRES_PLATFORM_NEEDSTRLCPY 1"
fi
-
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"
@@ -19041,7 +18995,6 @@ ISC_PLATFORM_NEEDPRINTF='#undef ISC_PLATFORM_NEEDPRINTF'
ISC_PLATFORM_NEEDFPRINTF='#undef ISC_PLATFORM_NEEDFPRINTF'
ISC_PLATFORM_NEEDSPRINTF='#undef ISC_PLATFORM_NEEDSPRINTF'
ISC_PLATFORM_NEEDVSNPRINTF='#undef ISC_PLATFORM_NEEDVSNPRINTF'
-LWRES_PLATFORM_NEEDVSNPRINTF='#undef LWRES_PLATFORM_NEEDVSNPRINTF'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sprintf return type" >&5
$as_echo_n "checking sprintf return type... " >&6; }
@@ -19064,7 +19017,6 @@ $as_echo "char *" >&6; }
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
-LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: int" >&5
@@ -19079,7 +19031,6 @@ else
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
- LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"
fi
@@ -19116,7 +19067,6 @@ $as_echo "no" >&6; }
ISC_PLATFORM_NEEDFPRINTF='#define ISC_PLATFORM_NEEDFPRINTF 1'
ISC_PLATFORM_NEEDFSRINTF='#define ISC_PLATFORM_NEEDSPRINTF 1'
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
- LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -19128,8 +19078,6 @@ fi
-
-
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
@@ -19191,7 +19139,6 @@ if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming target platform uses ll" >&5
$as_echo "assuming target platform uses ll" >&6; }
ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
- LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -19211,12 +19158,10 @@ if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ll" >&5
$as_echo "ll" >&6; }
ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
- LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: l" >&5
$as_echo "l" >&6; }
ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
- LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -19225,7 +19170,6 @@ fi
-
#
# Security Stuff
#
@@ -19672,8 +19616,6 @@ esac
ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
-LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
-
#
# Random remaining OS-specific issues involving compiler warnings.
# XXXDCL print messages to indicate some compensation is being done?
@@ -21904,7 +21846,7 @@ DNS_CRYPTO_LIBS="$NEWFLAGS"
# elsewhere if there's a good reason for doing so.
#
-ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/dig/Makefile lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile"
+ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/dig/Makefile lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile"
#
@@ -22933,14 +22875,6 @@ do
"lib/isccfg/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccfg/include/Makefile" ;;
"lib/isccfg/include/isccfg/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccfg/include/isccfg/Makefile" ;;
"lib/lwres/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/Makefile" ;;
- "lib/lwres/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/include/Makefile" ;;
- "lib/lwres/include/lwres/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/include/lwres/Makefile" ;;
- "lib/lwres/include/lwres/netdb.h") CONFIG_FILES="$CONFIG_FILES lib/lwres/include/lwres/netdb.h" ;;
- "lib/lwres/include/lwres/platform.h") CONFIG_FILES="$CONFIG_FILES lib/lwres/include/lwres/platform.h" ;;
- "lib/lwres/man/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/man/Makefile" ;;
- "lib/lwres/unix/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/unix/Makefile" ;;
- "lib/lwres/unix/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/unix/include/Makefile" ;;
- "lib/lwres/unix/include/lwres/Makefile") CONFIG_FILES="$CONFIG_FILES lib/lwres/unix/include/lwres/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
diff --git a/usr.sbin/bind/configure.in b/usr.sbin/bind/configure.in
index 46de7bae716..9aad7abf672 100644
--- a/usr.sbin/bind/configure.in
+++ b/usr.sbin/bind/configure.in
@@ -739,13 +739,11 @@ AC_TRY_COMPILE([
#include <unistd.h>],
[fd_set read_set; return (0);],
[AC_MSG_RESULT(yes)
- ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
- LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
+ ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"],
[AC_MSG_RESULT(no)
case $ac_cv_header_sys_select_h in
yes)
ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
- LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
;;
no)
AC_MSG_ERROR([need either working unistd.h or sys/select.h])
@@ -757,7 +755,6 @@ no)
case $ac_cv_header_sys_select_h in
yes)
ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
- LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
;;
no)
AC_MSG_ERROR([need either unistd.h or sys/select.h])
@@ -766,7 +763,6 @@ no)
;;
esac
AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
-AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
#
# Find the machine's endian flavor.
@@ -2965,12 +2961,10 @@ changequote({, })
case "$host" in
*-bsdi4.[01]*)
ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
- LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
isc_netinet6in6_hack="#include <netinet6/in6.h>"
;;
*)
ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
- LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
isc_netinet6in6_hack=""
;;
esac
@@ -2983,13 +2977,11 @@ case "$host" in
*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
# UnixWare
ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
- LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
isc_netinetin6_hack="#include <netinet/in6.h>"
;;
*)
ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
- LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
isc_netinetin6_hack=""
;;
@@ -3001,7 +2993,6 @@ esac
case "$found_ipv6" in
yes)
ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
- LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
AC_MSG_CHECKING(for in6_addr)
AC_TRY_COMPILE([
@@ -3014,11 +3005,9 @@ $isc_netinet6in6_hack
[struct in6_addr in6; return (0);],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
- LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
isc_in_addr6_hack=""],
[AC_MSG_RESULT(no)
ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
- LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
isc_in_addr6_hack="#define in6_addr in_addr6"])
AC_MSG_CHECKING(for in6addr_any)
@@ -3032,11 +3021,9 @@ $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"
- LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
+ ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"],
[AC_MSG_RESULT(no)
- ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
- LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
+ ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"])
AC_MSG_CHECKING(for in6addr_loopback)
AC_TRY_LINK([
@@ -3049,11 +3036,9 @@ $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"
- LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
+ ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"],
[AC_MSG_RESULT(no)
- ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
- LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
+ ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
AC_TRY_COMPILE([
@@ -3088,9 +3073,7 @@ $isc_netinet6in6_hack
;;
no)
ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
- LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
- LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
@@ -3115,17 +3098,11 @@ ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"],
ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"])
AC_SUBST(ISC_PLATFORM_HAVEIPV6)
-AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
-AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
-AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
-AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
-AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
-AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE)
@@ -3227,13 +3204,10 @@ AC_TRY_COMPILE([
#include <sys/socket.h>],
[struct sockaddr sa; sa.sa_len = 0; return (0);],
[AC_MSG_RESULT(yes)
- ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
- LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
+ ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"],
[AC_MSG_RESULT(no)
- ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
- LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
+ ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"])
AC_SUBST(ISC_PLATFORM_HAVESALEN)
-AC_SUBST(LWRES_PLATFORM_HAVESALEN)
#
# Look for a 4.4BSD or 4.3BSD struct msghdr
@@ -3442,22 +3416,16 @@ AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
AC_CHECK_FUNC(strtoul,
[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
- LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
GENRANDOMLIB=""],
[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
- LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
GENRANDOMLIB='${ISCLIBS}'])
AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
-AC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
AC_SUBST(GENRANDOMLIB)
AC_CHECK_FUNC(strlcpy,
- [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"
- LWRES_PLATFORM_NEEDSTRLCPY="#undef LWRES_PLATFORM_NEEDSTRLCPY"],
- [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"
- LWRES_PLATFORM_NEEDSTRLCPY="#define LWRES_PLATFORM_NEEDSTRLCPY 1"])
+ [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
+ [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
-AC_SUBST(LWRES_PLATFORM_NEEDSTRLCPY)
AC_CHECK_FUNC(strlcat,
[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
@@ -3536,7 +3504,6 @@ ISC_PLATFORM_NEEDPRINTF='#undef ISC_PLATFORM_NEEDPRINTF'
ISC_PLATFORM_NEEDFPRINTF='#undef ISC_PLATFORM_NEEDFPRINTF'
ISC_PLATFORM_NEEDSPRINTF='#undef ISC_PLATFORM_NEEDSPRINTF'
ISC_PLATFORM_NEEDVSNPRINTF='#undef ISC_PLATFORM_NEEDVSNPRINTF'
-LWRES_PLATFORM_NEEDVSNPRINTF='#undef LWRES_PLATFORM_NEEDVSNPRINTF'
AC_MSG_CHECKING(sprintf return type)
AC_TRY_COMPILE([
@@ -3547,14 +3514,12 @@ AC_TRY_COMPILE([
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
-LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
],[AC_MSG_RESULT(int)])
AC_CHECK_FUNC(vsnprintf, [],
[ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
- ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
- LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
+ ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"])
AC_MSG_CHECKING(printf for %z support)
AC_TRY_RUN([
@@ -3576,16 +3541,13 @@ main() {
ISC_PLATFORM_NEEDPRINTF='#define ISC_PLATFORM_NEEDPRINTF 1'
ISC_PLATFORM_NEEDFPRINTF='#define ISC_PLATFORM_NEEDFPRINTF 1'
ISC_PLATFORM_NEEDFSRINTF='#define ISC_PLATFORM_NEEDSPRINTF 1'
- ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
- LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"],
+ ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"],
[AC_MSG_RESULT(assuming target platform supports %z)])
AC_SUBST(ISC_PLATFORM_NEEDPRINTF)
AC_SUBST(ISC_PLATFORM_NEEDFPRINTF)
AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
-AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
-AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
@@ -3646,16 +3608,12 @@ main() {
}
],
[AC_MSG_RESULT(ll)
- ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
- LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'],
[AC_MSG_RESULT(l)
- ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
- LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'],
[AC_MSG_RESULT(assuming target platform uses ll)
- ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
- LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'])
AC_SUBST(ISC_PLATFORM_QUADFORMAT)
-AC_SUBST(LWRES_PLATFORM_QUADFORMAT)
#
@@ -3824,8 +3782,6 @@ esac
#
AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
-AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
-LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
#
# Random remaining OS-specific issues involving compiler warnings.
@@ -5037,14 +4993,6 @@ AC_CONFIG_FILES([
lib/isccfg/include/Makefile
lib/isccfg/include/isccfg/Makefile
lib/lwres/Makefile
- lib/lwres/include/Makefile
- lib/lwres/include/lwres/Makefile
- lib/lwres/include/lwres/netdb.h
- lib/lwres/include/lwres/platform.h
- lib/lwres/man/Makefile
- lib/lwres/unix/Makefile
- lib/lwres/unix/include/Makefile
- lib/lwres/unix/include/lwres/Makefile
])
#
diff --git a/usr.sbin/bind/lib/lwres/Atffile b/usr.sbin/bind/lib/lwres/Atffile
deleted file mode 100644
index 1edb838c66c..00000000000
--- a/usr.sbin/bind/lib/lwres/Atffile
+++ /dev/null
@@ -1,5 +0,0 @@
-Content-Type: application/X-atf-atffile; version="1"
-
-prop: test-suite = bind9
-
-tp: tests
diff --git a/usr.sbin/bind/lib/lwres/Makefile.in b/usr.sbin/bind/lib/lwres/Makefile.in
index e9f3b344d6b..d7376aec5f7 100644
--- a/usr.sbin/bind/lib/lwres/Makefile.in
+++ b/usr.sbin/bind/lib/lwres/Makefile.in
@@ -12,63 +12,42 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:38 sthen Exp $
+# $Id: Makefile.in,v 1.4 2020/01/06 17:41:29 florian Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
-VERSION=@BIND9_VERSION@
-
@LIBLWRES_API@
@BIND9_MAKE_INCLUDES@
-CINCLUDES = -I${srcdir}/unix/include \
- -I. -I./include -I${srcdir}/include ${ISC_INCLUDES}
+CINCLUDES = -I. -I./include -I${srcdir}/include ${ISC_INCLUDES}
CDEFINES =
CWARNINGS =
# Alphabetically
-OBJS = compat.@O@ context.@O@ \
- gai_strerror.@O@ getaddrinfo.@O@ gethost.@O@ \
- getipnode.@O@ getnameinfo.@O@ getrrset.@O@ herror.@O@ \
- lwbuffer.@O@ lwconfig.@O@ lwpacket.@O@ lwresutil.@O@ \
- lwres_gabn.@O@ lwres_gnba.@O@ lwres_grbn.@O@ lwres_noop.@O@ \
- lwinetaton.@O@ lwinetpton.@O@ lwinetntop.@O@ print.@O@
+OBJS = lwconfig.@O@
# Alphabetically
-SRCS = compat.c context.c gai_strerror.c getaddrinfo.c gethost.c \
- getipnode.c getnameinfo.c getrrset.c herror.c \
- lwbuffer.c lwconfig.c lwpacket.c lwresutil.c \
- lwres_gabn.c lwres_gnba.c lwres_grbn.c lwres_noop.c \
- lwinetaton.c lwinetpton.c lwinetntop.c print.c
+SRCS = lwconfig.c
LIBS = @LIBS@
-SUBDIRS = include man unix
+SUBDIRS =
TARGETS = timestamp
TESTDIRS = @UNITTESTS@
@BIND9_MAKE_RULES@
-version.@O@: version.c
- ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
- -DVERSION=\"${VERSION}\" \
- -DLIBINTERFACE=${LIBINTERFACE} \
- -DLIBREVISION=${LIBREVISION} \
- -DLIBAGE=${LIBAGE} \
- -c ${srcdir}/version.c
-
-liblwres.@SA@: ${OBJS} version.@O@
- ${AR} ${ARFLAGS} $@ ${OBJS} version.@O@
+liblwres.@SA@: ${OBJS}
+ ${AR} ${ARFLAGS} $@ ${OBJS}
${RANLIB} $@
-liblwres.la: ${OBJS} version.@O@
+liblwres.la: ${OBJS}
${LIBTOOL_MODE_LINK} \
${CC} ${ALL_CFLAGS} ${LDFLAGS} -o liblwres.la -rpath ${libdir} \
- -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
- ${OBJS} version.@O@ ${LIBS}
+ ${OBJS} ${LIBS}
timestamp: liblwres.@A@
touch timestamp
diff --git a/usr.sbin/bind/lib/lwres/api b/usr.sbin/bind/lib/lwres/api
deleted file mode 100644
index e70183f6dd2..00000000000
--- a/usr.sbin/bind/lib/lwres/api
+++ /dev/null
@@ -1,13 +0,0 @@
-# LIBINTERFACE ranges
-# 9.6: 50-59, 110-119
-# 9.7: 60-79
-# 9.8: 80-89, 120-129
-# 9.9: 90-109, 170-179
-# 9.9-sub: 130-139, 150-159, 200-209
-# 9.10: 140-149, 190-199
-# 9.10-sub: 180-189
-# 9.11: 160-169,1100-1199
-# 9.12: 1200-1299
-LIBINTERFACE = 141
-LIBREVISION = 5
-LIBAGE = 0
diff --git a/usr.sbin/bind/lib/lwres/assert_p.h b/usr.sbin/bind/lib/lwres/assert_p.h
deleted file mode 100644
index 23362c48707..00000000000
--- a/usr.sbin/bind/lib/lwres/assert_p.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: assert_p.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_ASSERT_P_H
-#define LWRES_ASSERT_P_H 1
-
-/*! \file */
-
-#include <assert.h> /* Required for assert() prototype. */
-
-#define REQUIRE(x) assert(x)
-#define INSIST(x) assert(x)
-
-#define UNUSED(x) ((void)(x))
-#define POST(x) ((void)(x))
-
-#define SPACE_OK(b, s) (LWRES_BUFFER_AVAILABLECOUNT(b) >= (s))
-#define SPACE_REMAINING(b, s) (LWRES_BUFFER_REMAINING(b) >= (s))
-
-#endif /* LWRES_ASSERT_P_H */
diff --git a/usr.sbin/bind/lib/lwres/compat.c b/usr.sbin/bind/lib/lwres/compat.c
deleted file mode 100644
index e12ea77f431..00000000000
--- a/usr.sbin/bind/lib/lwres/compat.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * 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 <config.h>
-
-#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include <lwres/stdlib.h>
-#include <lwres/string.h>
-
-#define DE_CONST(konst, var) \
- do { \
- union { const void *k; void *v; } _u; \
- _u.k = konst; \
- var = _u.v; \
- } while (0)
-
-/*!
- * 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
-lwres_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)
- /* XXX: acc was declared unsigned! */
- acc = -acc;
- if (endptr != 0)
- DE_CONST(any ? s - 1 : nptr, *endptr);
- return (acc);
-}
-
-size_t
-lwres_strlcpy(char *dst, const char *src, size_t size) {
- char *d = dst;
- const char *s = src;
- size_t n = size;
-
- /* Copy as many bytes as will fit */
- if (n != 0U && --n != 0U) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0U);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0U) {
- if (size != 0U)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
diff --git a/usr.sbin/bind/lib/lwres/context.c b/usr.sbin/bind/lib/lwres/context.c
deleted file mode 100644
index d73e886cfe8..00000000000
--- a/usr.sbin/bind/lib/lwres/context.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: context.c,v 1.9 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file context.c
- lwres_context_create() creates a #lwres_context_t structure for use in
- lightweight resolver operations. It holds a socket and other data
- needed for communicating with a resolver daemon. The new
- lwres_context_t is returned through contextp, a pointer to a
- lwres_context_t pointer. This lwres_context_t pointer must initially
- be NULL, and is modified to point to the newly created
- lwres_context_t.
-
- When the lightweight resolver needs to perform dynamic memory
- allocation, it will call malloc_function to allocate memory and
- free_function to free it. If malloc_function and free_function are
- NULL, memory is allocated using malloc and free. It is not
- permitted to have a NULL malloc_function and a non-NULL free_function
- or vice versa. arg is passed as the first parameter to the memory
- allocation functions. If malloc_function and free_function are NULL,
- arg is unused and should be passed as NULL.
-
- Once memory for the structure has been allocated, it is initialized
- using lwres_conf_init() and returned via *contextp.
-
- lwres_context_destroy() destroys a #lwres_context_t, closing its
- socket. contextp is a pointer to a pointer to the context that is to
- be destroyed. The pointer will be set to NULL when the context has
- been destroyed.
-
- The context holds a serial number that is used to identify resolver
- request packets and associate responses with the corresponding
- requests. This serial number is controlled using
- lwres_context_initserial() and lwres_context_nextserial().
- lwres_context_initserial() sets the serial number for context *ctx to
- serial. lwres_context_nextserial() increments the serial number and
- returns the previous value.
-
- Memory for a lightweight resolver context is allocated and freed using
- lwres_context_allocmem() and lwres_context_freemem(). These use
- whatever allocations were defined when the context was created with
- lwres_context_create(). lwres_context_allocmem() allocates len bytes
- of memory and if successful returns a pointer to the allocated
- storage. lwres_context_freemem() frees len bytes of space starting at
- location mem.
-
- lwres_context_sendrecv() performs I/O for the context ctx. Data are
- read and written from the context's socket. It writes data from
- sendbase -- typically a lightweight resolver query packet -- and waits
- for a reply which is copied to the receive buffer at recvbase. The
- number of bytes that were written to this receive buffer is returned
- in *recvd_len.
-
-\section context_return Return Values
-
- lwres_context_create() returns #LWRES_R_NOMEMORY if memory for the
- struct lwres_context could not be allocated, #LWRES_R_SUCCESS
- otherwise.
-
- Successful calls to the memory allocator lwres_context_allocmem()
- return a pointer to the start of the allocated space. It returns NULL
- if memory could not be allocated.
-
- #LWRES_R_SUCCESS is returned when lwres_context_sendrecv() completes
- successfully. #LWRES_R_IOERROR is returned if an I/O error occurs and
- #LWRES_R_TIMEOUT is returned if lwres_context_sendrecv() times out
- waiting for a response.
-
-\section context_see See Also
-
- lwres_conf_init(), malloc, free.
- */
-#include <config.h>
-
-#include <fcntl.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <lwres/lwres.h>
-#include <lwres/net.h>
-#include <lwres/platform.h>
-
-#ifdef LWRES_PLATFORM_NEEDSYSSELECTH
-#include <sys/select.h>
-#endif
-
-#include "context_p.h"
-#include "assert_p.h"
-
-/*!
- * Some systems define the socket length argument as an int, some as size_t,
- * some as socklen_t. The last is what the current POSIX standard mandates.
- * This definition is here so it can be portable but easily changed if needed.
- */
-#ifndef LWRES_SOCKADDR_LEN_T
-#define LWRES_SOCKADDR_LEN_T unsigned int
-#endif
-
-/*!
- * Make a socket nonblocking.
- */
-#ifndef MAKE_NONBLOCKING
-#define MAKE_NONBLOCKING(sd, retval) \
-do { \
- retval = fcntl(sd, F_GETFL, 0); \
- if (retval != -1) { \
- retval |= O_NONBLOCK; \
- retval = fcntl(sd, F_SETFL, retval); \
- } \
-} while (0)
-#endif
-
-LIBLWRES_EXTERNAL_DATA lwres_uint16_t lwres_udp_port = LWRES_UDP_PORT;
-LIBLWRES_EXTERNAL_DATA const char *lwres_resolv_conf = LWRES_RESOLV_CONF;
-
-static void *
-lwres_malloc(void *, size_t);
-
-static void
-lwres_free(void *, void *, size_t);
-
-/*!
- * lwres_result_t
- */
-static lwres_result_t
-context_connect(lwres_context_t *);
-
-/*%
- * Creates a #lwres_context_t structure for use in
- * lightweight resolver operations.
- */
-lwres_result_t
-lwres_context_create(lwres_context_t **contextp, void *arg,
- lwres_malloc_t malloc_function,
- lwres_free_t free_function,
- unsigned int flags)
-{
- lwres_context_t *ctx;
-
- REQUIRE(contextp != NULL && *contextp == NULL);
-
- /*
- * If we were not given anything special to use, use our own
- * functions. These are just wrappers around malloc() and free().
- */
- if (malloc_function == NULL || free_function == NULL) {
- REQUIRE(malloc_function == NULL);
- REQUIRE(free_function == NULL);
- malloc_function = lwres_malloc;
- free_function = lwres_free;
- }
-
- ctx = malloc_function(arg, sizeof(lwres_context_t));
- if (ctx == NULL)
- return (LWRES_R_NOMEMORY);
-
- /*
- * Set up the context.
- */
- ctx->malloc = malloc_function;
- ctx->free = free_function;
- ctx->arg = arg;
- ctx->sock = -1;
-
- ctx->timeout = LWRES_DEFAULT_TIMEOUT;
-#ifndef WIN32
- ctx->serial = time(NULL); /* XXXMLG or BEW */
-#else
- ctx->serial = _time32(NULL);
-#endif
-
- ctx->use_ipv4 = 1;
- ctx->use_ipv6 = 1;
- if ((flags & (LWRES_CONTEXT_USEIPV4 | LWRES_CONTEXT_USEIPV6)) ==
- LWRES_CONTEXT_USEIPV6) {
- ctx->use_ipv4 = 0;
- }
- if ((flags & (LWRES_CONTEXT_USEIPV4 | LWRES_CONTEXT_USEIPV6)) ==
- LWRES_CONTEXT_USEIPV4) {
- ctx->use_ipv6 = 0;
- }
-
- /*
- * Init resolv.conf bits.
- */
- lwres_conf_init(ctx);
-
- *contextp = ctx;
- return (LWRES_R_SUCCESS);
-}
-
-/*%
-Destroys a #lwres_context_t, closing its socket.
-contextp is a pointer to a pointer to the context that is
-to be destroyed. The pointer will be set to NULL
-when the context has been destroyed.
- */
-void
-lwres_context_destroy(lwres_context_t **contextp) {
- lwres_context_t *ctx;
-
- REQUIRE(contextp != NULL && *contextp != NULL);
-
- ctx = *contextp;
- *contextp = NULL;
-
- if (ctx->sock != -1) {
-#ifdef WIN32
- DestroySockets();
-#endif
- (void)close(ctx->sock);
- ctx->sock = -1;
- }
-
- CTXFREE(ctx, sizeof(lwres_context_t));
-}
-/*% Increments the serial number and returns the previous value. */
-lwres_uint32_t
-lwres_context_nextserial(lwres_context_t *ctx) {
- REQUIRE(ctx != NULL);
-
- return (ctx->serial++);
-}
-
-/*% Sets the serial number for context *ctx to serial. */
-void
-lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) {
- REQUIRE(ctx != NULL);
-
- ctx->serial = serial;
-}
-
-/*% Frees len bytes of space starting at location mem. */
-void
-lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) {
- REQUIRE(mem != NULL);
- REQUIRE(len != 0U);
-
- CTXFREE(mem, len);
-}
-
-/*% Allocates len bytes of memory and if successful returns a pointer to the allocated storage. */
-void *
-lwres_context_allocmem(lwres_context_t *ctx, size_t len) {
- REQUIRE(len != 0U);
-
- return (CTXMALLOC(len));
-}
-
-static void *
-lwres_malloc(void *arg, size_t len) {
- void *mem;
-
- UNUSED(arg);
-
- mem = malloc(len);
- if (mem == NULL)
- return (NULL);
-
- memset(mem, 0xe5, len);
-
- return (mem);
-}
-
-static void
-lwres_free(void *arg, void *mem, size_t len) {
- UNUSED(arg);
-
- memset(mem, 0xa9, len);
- free(mem);
-}
-
-static lwres_result_t
-context_connect(lwres_context_t *ctx) {
-#ifndef WIN32
- int s;
-#else
- SOCKET s;
-#endif
- int ret;
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
- struct sockaddr *sa;
- LWRES_SOCKADDR_LEN_T salen;
- int domain;
-
- if (ctx->confdata.lwnext != 0) {
- memmove(&ctx->address, &ctx->confdata.lwservers[0],
- sizeof(lwres_addr_t));
- LWRES_LINK_INIT(&ctx->address, link);
- } else {
- /* The default is the IPv4 loopback address 127.0.0.1. */
- memset(&ctx->address, 0, sizeof(ctx->address));
- ctx->address.family = LWRES_ADDRTYPE_V4;
- ctx->address.length = 4;
- ctx->address.address[0] = 127;
- ctx->address.address[1] = 0;
- ctx->address.address[2] = 0;
- ctx->address.address[3] = 1;
- }
-
- if (ctx->address.family == LWRES_ADDRTYPE_V4) {
- memmove(&sin.sin_addr, ctx->address.address,
- sizeof(sin.sin_addr));
- sin.sin_port = htons(lwres_udp_port);
- sin.sin_family = AF_INET;
- sa = (struct sockaddr *)&sin;
- salen = sizeof(sin);
- domain = PF_INET;
- } else if (ctx->address.family == LWRES_ADDRTYPE_V6) {
- memmove(&sin6.sin6_addr, ctx->address.address,
- sizeof(sin6.sin6_addr));
- sin6.sin6_port = htons(lwres_udp_port);
- sin6.sin6_family = AF_INET6;
- sa = (struct sockaddr *)&sin6;
- salen = sizeof(sin6);
- domain = PF_INET6;
- } else
- return (LWRES_R_IOERROR);
-
-#ifdef WIN32
- InitSockets();
-#endif
- s = socket(domain, SOCK_DGRAM, IPPROTO_UDP);
-#ifndef WIN32
- if (s < 0) {
- return (LWRES_R_IOERROR);
- }
-#else
- if (s == INVALID_SOCKET) {
- DestroySockets();
- return (LWRES_R_IOERROR);
- }
-#endif
-
- ret = connect(s, sa, salen);
- if (ret != 0) {
-#ifdef WIN32
- DestroySockets();
-#endif
- (void)close(s);
- return (LWRES_R_IOERROR);
- }
-
- MAKE_NONBLOCKING(s, ret);
- if (ret < 0) {
-#ifdef WIN32
- DestroySockets();
-#endif
- (void)close(s);
- return (LWRES_R_IOERROR);
- }
-
- ctx->sock = (int)s;
-
- return (LWRES_R_SUCCESS);
-}
-
-int
-lwres_context_getsocket(lwres_context_t *ctx) {
- return (ctx->sock);
-}
-
-lwres_result_t
-lwres_context_send(lwres_context_t *ctx,
- void *sendbase, int sendlen) {
- int ret;
- lwres_result_t lwresult;
-
- if (ctx->sock == -1) {
- lwresult = context_connect(ctx);
- if (lwresult != LWRES_R_SUCCESS)
- return (lwresult);
- INSIST(ctx->sock >= 0);
- }
-
- ret = sendto(ctx->sock, sendbase, sendlen, 0, NULL, 0);
- if (ret < 0)
- return (LWRES_R_IOERROR);
- if (ret != sendlen)
- return (LWRES_R_IOERROR);
-
- return (LWRES_R_SUCCESS);
-}
-
-lwres_result_t
-lwres_context_recv(lwres_context_t *ctx,
- void *recvbase, int recvlen,
- int *recvd_len)
-{
- LWRES_SOCKADDR_LEN_T fromlen;
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
- struct sockaddr *sa;
- int ret;
-
- if (ctx->address.family == LWRES_ADDRTYPE_V4) {
- sa = (struct sockaddr *)&sin;
- fromlen = sizeof(sin);
- } else {
- sa = (struct sockaddr *)&sin6;
- fromlen = sizeof(sin6);
- }
-
- /*
- * The address of fromlen is cast to void * to shut up compiler
- * warnings, namely on systems that have the sixth parameter
- * prototyped as a signed int when LWRES_SOCKADDR_LEN_T is
- * defined as unsigned.
- */
- ret = recvfrom(ctx->sock, recvbase, recvlen, 0, sa, (void *)&fromlen);
-
- if (ret < 0)
- return (LWRES_R_IOERROR);
-
- if (ret == recvlen)
- return (LWRES_R_TOOLARGE);
-
- /*
- * If we got something other than what we expect, have the caller
- * wait for another packet. This can happen if an old result
- * comes in, or if someone is sending us random stuff.
- */
- if (ctx->address.family == LWRES_ADDRTYPE_V4) {
- if (fromlen != sizeof(sin)
- || memcmp(&sin.sin_addr, ctx->address.address,
- sizeof(sin.sin_addr)) != 0
- || sin.sin_port != htons(lwres_udp_port))
- return (LWRES_R_RETRY);
- } else {
- if (fromlen != sizeof(sin6)
- || memcmp(&sin6.sin6_addr, ctx->address.address,
- sizeof(sin6.sin6_addr)) != 0
- || sin6.sin6_port != htons(lwres_udp_port))
- return (LWRES_R_RETRY);
- }
-
- if (recvd_len != NULL)
- *recvd_len = ret;
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% performs I/O for the context ctx. */
-lwres_result_t
-lwres_context_sendrecv(lwres_context_t *ctx,
- void *sendbase, int sendlen,
- void *recvbase, int recvlen,
- int *recvd_len)
-{
- lwres_result_t result;
- int ret2;
- fd_set readfds;
- struct timeval timeout;
-
- /*
- * Type of tv_sec is 32 bits long.
- */
- if (ctx->timeout <= 0x7FFFFFFFU)
- timeout.tv_sec = (int)ctx->timeout;
- else
- timeout.tv_sec = 0x7FFFFFFF;
-
- timeout.tv_usec = 0;
-
- result = lwres_context_send(ctx, sendbase, sendlen);
- if (result != LWRES_R_SUCCESS)
- return (result);
-
- /*
- * If this is not checked, select() can overflow,
- * causing corruption elsewhere.
- */
- if (ctx->sock >= (int)FD_SETSIZE) {
- close(ctx->sock);
- ctx->sock = -1;
- return (LWRES_R_IOERROR);
- }
-
- again:
- FD_ZERO(&readfds);
- FD_SET(ctx->sock, &readfds);
- ret2 = select(ctx->sock + 1, &readfds, NULL, NULL, &timeout);
-
- /*
- * What happened with select?
- */
- if (ret2 < 0)
- return (LWRES_R_IOERROR);
- if (ret2 == 0)
- return (LWRES_R_TIMEOUT);
-
- result = lwres_context_recv(ctx, recvbase, recvlen, recvd_len);
- if (result == LWRES_R_RETRY)
- goto again;
-
- return (result);
-}
diff --git a/usr.sbin/bind/lib/lwres/context_p.h b/usr.sbin/bind/lib/lwres/context_p.h
deleted file mode 100644
index 0a9c363d95b..00000000000
--- a/usr.sbin/bind/lib/lwres/context_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: context_p.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_CONTEXT_P_H
-#define LWRES_CONTEXT_P_H 1
-
-/*! \file */
-
-/*@{*/
-/**
- * Helper functions, assuming the context is always called "ctx" in
- * the scope these functions are called from.
- */
-#define CTXMALLOC(len) ctx->malloc(ctx->arg, (len))
-#define CTXFREE(addr, len) ctx->free(ctx->arg, (addr), (len))
-/*@}*/
-
-#define LWRES_DEFAULT_TIMEOUT 120 /* 120 seconds for a reply */
-
-/**
- * Not all the attributes here are actually settable by the application at
- * this time.
- */
-struct lwres_context {
- unsigned int timeout; /*%< time to wait for reply */
- lwres_uint32_t serial; /*%< serial number state */
-
- /*
- * For network I/O.
- */
- int sock; /*%< socket to send on */
- lwres_addr_t address; /*%< address to send to */
- int use_ipv4; /*%< use IPv4 transaction */
- int use_ipv6; /*%< use IPv6 transaction */
-
- /*@{*/
- /*
- * Function pointers for allocating memory.
- */
- lwres_malloc_t malloc;
- lwres_free_t free;
- void *arg;
- /*@}*/
-
- /*%
- * resolv.conf-like data
- */
- lwres_conf_t confdata;
-};
-
-#endif /* LWRES_CONTEXT_P_H */
diff --git a/usr.sbin/bind/lib/lwres/gai_strerror.c b/usr.sbin/bind/lib/lwres/gai_strerror.c
deleted file mode 100644
index 9c3b7764a73..00000000000
--- a/usr.sbin/bind/lib/lwres/gai_strerror.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: gai_strerror.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file gai_strerror.c
- * lwres_gai_strerror() returns an error message corresponding to an
- * error code returned by getaddrinfo(). The following error codes and
- * their meaning are defined in \link netdb.h include/lwres/netdb.h.\endlink
- *
- * \li #EAI_ADDRFAMILY address family for hostname not supported
- * \li #EAI_AGAIN temporary failure in name resolution
- * \li #EAI_BADFLAGS invalid value for #ai_flags
- * \li #EAI_FAIL non-recoverable failure in name resolution
- * \li #EAI_FAMILY ai_family not supported
- * \li #EAI_MEMORY memory allocation failure
- * \li #EAI_NODATA no address associated with hostname
- * \li #EAI_NONAME hostname or servname not provided, or not known
- * \li #EAI_SERVICE servname not supported for ai_socktype
- * \li #EAI_SOCKTYPE ai_socktype not supported
- * \li #EAI_SYSTEM system error returned in errno
- *
- * The message invalid error code is returned if ecode is out of range.
- *
- * ai_flags, ai_family and ai_socktype are elements of the struct
- * addrinfo used by lwres_getaddrinfo().
- *
- * \section gai_strerror_see See Also
- *
- * strerror, lwres_getaddrinfo(), getaddrinfo(), RFC2133.
- */
-
-#include <config.h>
-
-#include <lwres/netdb.h>
-
-/*% Text of error messages. */
-static const char *gai_messages[] = {
- "no error",
- "address family for hostname not supported",
- "temporary failure in name resolution",
- "invalid value for ai_flags",
- "non-recoverable failure in name resolution",
- "ai_family not supported",
- "memory allocation failure",
- "no address associated with hostname",
- "hostname nor servname provided, or not known",
- "servname not supported for ai_socktype",
- "ai_socktype not supported",
- "system error returned in errno",
- "bad hints",
- "bad protocol",
- "overflow"
-};
-
-/*% Returns an error message corresponding to an error code returned by getaddrinfo() */
-char *
-lwres_gai_strerror(int ecode) {
- union {
- const char *const_ptr;
- char *deconst_ptr;
- } ptr;
-
- if ((ecode < 0) ||
- (ecode >= (int)(sizeof(gai_messages)/sizeof(*gai_messages))))
- ptr.const_ptr = "invalid error code";
- else
- ptr.const_ptr = gai_messages[ecode];
- return (ptr.deconst_ptr);
-}
diff --git a/usr.sbin/bind/lib/lwres/getaddrinfo.c b/usr.sbin/bind/lib/lwres/getaddrinfo.c
deleted file mode 100644
index 763be95055f..00000000000
--- a/usr.sbin/bind/lib/lwres/getaddrinfo.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This code is derived from software contributed to ISC by
- * Berkeley Software Design, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND BERKELEY SOFTWARE DESIGN, INC.
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
- * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: getaddrinfo.c,v 1.8 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * lwres_getaddrinfo() is used to get a list of IP addresses and port
- * numbers for host hostname and service servname. The function is the
- * lightweight resolver's implementation of getaddrinfo() as defined in
- * RFC2133. hostname and servname are pointers to null-terminated strings
- * or NULL. hostname is either a host name or a numeric host address
- * string: a dotted decimal IPv4 address or an IPv6 address. servname is
- * either a decimal port number or a service name as listed in
- * /etc/services.
- *
- * If the operating system does not provide a struct addrinfo, the
- * following structure is used:
- *
- * \code
- * 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
- * };
- * \endcode
- *
- *
- * hints is an optional pointer to a struct addrinfo. This structure can
- * be used to provide hints concerning the type of socket that the caller
- * supports or wishes to use. The caller can supply the following
- * structure elements in *hints:
- *
- * <ul>
- * <li>ai_family:
- * The protocol family that should be used. When ai_family is set
- * to PF_UNSPEC, it means the caller will accept any protocol
- * family supported by the operating system.</li>
- *
- * <li>ai_socktype:
- * denotes the type of socket -- SOCK_STREAM, SOCK_DGRAM or
- * SOCK_RAW -- that is wanted. When ai_socktype is zero the caller
- * will accept any socket type.</li>
- *
- * <li>ai_protocol:
- * indicates which transport protocol is wanted: IPPROTO_UDP or
- * IPPROTO_TCP. If ai_protocol is zero the caller will accept any
- * protocol.</li>
- *
- * <li>ai_flags:
- * Flag bits. If the AI_CANONNAME bit is set, a successful call to
- * lwres_getaddrinfo() will return a null-terminated string
- * containing the canonical name of the specified hostname in
- * ai_canonname of the first addrinfo structure returned. Setting
- * the AI_PASSIVE bit indicates that the returned socket address
- * structure is intended for used in a call to bind(2). In this
- * case, if the hostname argument is a NULL pointer, then the IP
- * address portion of the socket address structure will be set to
- * INADDR_ANY for an IPv4 address or IN6ADDR_ANY_INIT for an IPv6
- * address.<br /><br />
- *
- * When ai_flags does not set the AI_PASSIVE bit, the returned
- * socket address structure will be ready for use in a call to
- * connect(2) for a connection-oriented protocol or connect(2),
- * sendto(2), or sendmsg(2) if a connectionless protocol was
- * chosen. The IP address portion of the socket address structure
- * will be set to the loopback address if hostname is a NULL
- * pointer and AI_PASSIVE is not set in ai_flags.<br /><br />
- *
- * If ai_flags is set to AI_NUMERICHOST it indicates that hostname
- * should be treated as a numeric string defining an IPv4 or IPv6
- * address and no name resolution should be attempted.
- * </li></ul>
- *
- * All other elements of the struct addrinfo passed via hints must be
- * zero.
- *
- * A hints of NULL is treated as if the caller provided a struct addrinfo
- * initialized to zero with ai_familyset to PF_UNSPEC.
- *
- * After a successful call to lwres_getaddrinfo(), *res is a pointer to a
- * linked list of one or more addrinfo structures. Each struct addrinfo
- * in this list cn be processed by following the ai_next pointer, until a
- * NULL pointer is encountered. The three members ai_family, ai_socktype,
- * and ai_protocol in each returned addrinfo structure contain the
- * corresponding arguments for a call to socket(2). For each addrinfo
- * structure in the list, the ai_addr member points to a filled-in socket
- * address structure of length ai_addrlen.
- *
- * All of the information returned by lwres_getaddrinfo() is dynamically
- * allocated: the addrinfo structures, and the socket address structures
- * and canonical host name strings pointed to by the addrinfostructures.
- * Memory allocated for the dynamically allocated structures created by a
- * successful call to lwres_getaddrinfo() is released by
- * lwres_freeaddrinfo(). ai is a pointer to a struct addrinfo created by
- * a call to lwres_getaddrinfo().
- *
- * \section lwresreturn RETURN VALUES
- *
- * lwres_getaddrinfo() returns zero on success or one of the error codes
- * listed in gai_strerror() if an error occurs. If both hostname and
- * servname are NULL lwres_getaddrinfo() returns #EAI_NONAME.
- *
- * \section lwressee SEE ALSO
- *
- * lwres(3), lwres_getaddrinfo(), lwres_freeaddrinfo(),
- * lwres_gai_strerror(), RFC2133, getservbyname(3), connect(2),
- * sendto(2), sendmsg(2), socket(2).
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <string.h>
-
-#include <lwres/lwres.h>
-#include <lwres/net.h>
-#include <lwres/netdb.h>
-#include <lwres/stdlib.h>
-#include <lwres/string.h>
-
-#define SA(addr) ((struct sockaddr *)(addr))
-#define SIN(addr) ((struct sockaddr_in *)(addr))
-#define SIN6(addr) ((struct sockaddr_in6 *)(addr))
-#define SLOCAL(addr) ((struct sockaddr_un *)(addr))
-
-/*! \struct addrinfo
- */
-static struct addrinfo
- *ai_reverse(struct addrinfo *oai),
- *ai_clone(struct addrinfo *oai, int family),
- *ai_alloc(int family, int addrlen);
-#ifdef AF_LOCAL
-static int get_local(const char *name, int socktype, struct addrinfo **res);
-#endif
-
-static int add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
- int socktype, int port);
-static int add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
- int socktype, int port);
-static void set_order(int, int (**)(const char *, int, struct addrinfo **,
- int, int));
-
-#define FOUND_IPV4 0x1
-#define FOUND_IPV6 0x2
-#define FOUND_MAX 2
-
-#define ISC_AI_MASK (AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST)
-/*% Get a list of IP addresses and port numbers for host hostname and service servname. */
-int
-lwres_getaddrinfo(const char *hostname, const char *servname,
- const struct addrinfo *hints, struct addrinfo **res)
-{
- struct servent *sp;
- const char *proto;
- int family, socktype, flags, protocol;
- struct addrinfo *ai, *ai_list;
- int port, err, i;
- int (*net_order[FOUND_MAX+1])(const char *, int, struct addrinfo **,
- int, int);
-
- if (hostname == NULL && servname == NULL)
- return (EAI_NONAME);
-
- proto = NULL;
- if (hints != NULL) {
- if ((hints->ai_flags & ~(ISC_AI_MASK)) != 0)
- return (EAI_BADFLAGS);
- if (hints->ai_addrlen || hints->ai_canonname ||
- hints->ai_addr || hints->ai_next) {
- errno = EINVAL;
- return (EAI_SYSTEM);
- }
- family = hints->ai_family;
- socktype = hints->ai_socktype;
- protocol = hints->ai_protocol;
- flags = hints->ai_flags;
- switch (family) {
- case AF_UNSPEC:
- switch (hints->ai_socktype) {
- case SOCK_STREAM:
- proto = "tcp";
- break;
- case SOCK_DGRAM:
- proto = "udp";
- break;
- }
- break;
- case AF_INET:
- case AF_INET6:
- switch (hints->ai_socktype) {
- case 0:
- break;
- case SOCK_STREAM:
- proto = "tcp";
- break;
- case SOCK_DGRAM:
- proto = "udp";
- break;
- case SOCK_RAW:
- break;
- default:
- return (EAI_SOCKTYPE);
- }
- break;
-#ifdef AF_LOCAL
- case AF_LOCAL:
- switch (hints->ai_socktype) {
- case 0:
- break;
- case SOCK_STREAM:
- break;
- case SOCK_DGRAM:
- break;
- default:
- return (EAI_SOCKTYPE);
- }
- break;
-#endif
- default:
- return (EAI_FAMILY);
- }
- } else {
- protocol = 0;
- family = 0;
- socktype = 0;
- flags = 0;
- }
-
-#ifdef AF_LOCAL
- /*!
- * First, deal with AF_LOCAL. If the family was not set,
- * then assume AF_LOCAL if the first character of the
- * hostname/servname is '/'.
- */
-
- if (hostname != NULL &&
- (family == AF_LOCAL || (family == 0 && *hostname == '/')))
- return (get_local(hostname, socktype, res));
-
- if (servname != NULL &&
- (family == AF_LOCAL || (family == 0 && *servname == '/')))
- return (get_local(servname, socktype, res));
-#endif
-
- /*
- * Ok, only AF_INET and AF_INET6 left.
- */
- ai_list = NULL;
-
- /*
- * First, look up the service name (port) if it was
- * requested. If the socket type wasn't specified, then
- * try and figure it out.
- */
- if (servname != NULL) {
- char *e;
-
- port = strtol(servname, &e, 10);
- if (*e == '\0') {
- if (socktype == 0)
- return (EAI_SOCKTYPE);
- if (port < 0 || port > 65535)
- return (EAI_SERVICE);
- port = htons((unsigned short) port);
- } else {
- sp = getservbyname(servname, proto);
- if (sp == NULL)
- return (EAI_SERVICE);
- port = sp->s_port;
- if (socktype == 0) {
- if (strcmp(sp->s_proto, "tcp") == 0)
- socktype = SOCK_STREAM;
- else if (strcmp(sp->s_proto, "udp") == 0)
- socktype = SOCK_DGRAM;
- }
- }
- } else
- port = 0;
-
- /*
- * Next, deal with just a service name, and no hostname.
- * (we verified that one of them was non-null up above).
- */
- if (hostname == NULL && (flags & AI_PASSIVE) != 0) {
- if (family == AF_INET || family == 0) {
- ai = ai_alloc(AF_INET, sizeof(struct sockaddr_in));
- if (ai == NULL)
- return (EAI_MEMORY);
- ai->ai_socktype = socktype;
- ai->ai_protocol = protocol;
- SIN(ai->ai_addr)->sin_port = port;
- ai->ai_next = ai_list;
- ai_list = ai;
- }
-
- if (family == AF_INET6 || family == 0) {
- ai = ai_alloc(AF_INET6, sizeof(struct sockaddr_in6));
- if (ai == NULL) {
- lwres_freeaddrinfo(ai_list);
- return (EAI_MEMORY);
- }
- ai->ai_socktype = socktype;
- ai->ai_protocol = protocol;
- SIN6(ai->ai_addr)->sin6_port = port;
- ai->ai_next = ai_list;
- ai_list = ai;
- }
-
- *res = ai_list;
- return (0);
- }
-
- /*
- * If the family isn't specified or AI_NUMERICHOST specified,
- * check first to see if it is a numeric address.
- * Though the gethostbyname2() routine
- * will recognize numeric addresses, it will only recognize
- * the format that it is being called for. Thus, a numeric
- * AF_INET address will be treated by the AF_INET6 call as
- * a domain name, and vice versa. Checking for both numerics
- * here avoids that.
- */
- if (hostname != NULL &&
- (family == 0 || (flags & AI_NUMERICHOST) != 0)) {
- char abuf[sizeof(struct in6_addr)];
- char nbuf[NI_MAXHOST];
- int addrsize, addroff;
-#ifdef LWRES_HAVE_SIN6_SCOPE_ID
- char *p, *ep;
- char ntmp[NI_MAXHOST];
- lwres_uint32_t scopeid;
-#endif
-
-#ifdef LWRES_HAVE_SIN6_SCOPE_ID
- /*
- * Scope identifier portion.
- */
- ntmp[0] = '\0';
- if (strchr(hostname, '%') != NULL) {
- strncpy(ntmp, hostname, sizeof(ntmp) - 1);
- ntmp[sizeof(ntmp) - 1] = '\0';
- p = strchr(ntmp, '%');
- ep = NULL;
-
- /*
- * Vendors may want to support non-numeric
- * scopeid around here.
- */
-
- if (p != NULL)
- scopeid = (lwres_uint32_t)strtoul(p + 1,
- &ep, 10);
- if (p != NULL && ep != NULL && ep[0] == '\0')
- *p = '\0';
- else {
- ntmp[0] = '\0';
- scopeid = 0;
- }
- } else
- scopeid = 0;
-#endif
-
- if (lwres_net_pton(AF_INET, hostname, (struct in_addr *)abuf)
- == 1)
- {
- if (family == AF_INET6) {
- /*
- * Convert to a V4 mapped address.
- */
- struct in6_addr *a6 = (struct in6_addr *)abuf;
- memmove(&a6->s6_addr[12], &a6->s6_addr[0], 4);
- memset(&a6->s6_addr[10], 0xff, 2);
- memset(&a6->s6_addr[0], 0, 10);
- goto inet6_addr;
- }
- addrsize = sizeof(struct in_addr);
- addroff = offsetof(struct sockaddr_in, sin_addr);
- family = AF_INET;
- goto common;
-#ifdef LWRES_HAVE_SIN6_SCOPE_ID
- } else if (ntmp[0] != '\0' &&
- lwres_net_pton(AF_INET6, ntmp, abuf) == 1)
- {
- if (family && family != AF_INET6)
- return (EAI_NONAME);
- addrsize = sizeof(struct in6_addr);
- addroff = offsetof(struct sockaddr_in6, sin6_addr);
- family = AF_INET6;
- goto common;
-#endif
- } else if (lwres_net_pton(AF_INET6, hostname, abuf) == 1) {
- if (family != 0 && family != AF_INET6)
- return (EAI_NONAME);
- inet6_addr:
- addrsize = sizeof(struct in6_addr);
- addroff = offsetof(struct sockaddr_in6, sin6_addr);
- family = AF_INET6;
-
- common:
- ai = ai_clone(ai_list, family);
- if (ai == NULL)
- return (EAI_MEMORY);
- ai_list = ai;
- ai->ai_socktype = socktype;
- SIN(ai->ai_addr)->sin_port = port;
- memmove((char *)ai->ai_addr + addroff, abuf, addrsize);
- if (flags & AI_CANONNAME) {
-#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
- if (ai->ai_family == AF_INET6)
- SIN6(ai->ai_addr)->sin6_scope_id =
- scopeid;
-#endif
- if (lwres_getnameinfo(ai->ai_addr,
- ai->ai_addrlen, nbuf, sizeof(nbuf),
- NULL, 0,
- NI_NUMERICHOST) == 0) {
- ai->ai_canonname = strdup(nbuf);
- if (ai->ai_canonname == NULL) {
- lwres_freeaddrinfo(ai_list);
- return (EAI_MEMORY);
- }
- } else {
- /* XXX raise error? */
- ai->ai_canonname = NULL;
- }
- }
- goto done;
- } else if ((flags & AI_NUMERICHOST) != 0) {
- return (EAI_NONAME);
- }
- }
-
- set_order(family, net_order);
- for (i = 0; i < FOUND_MAX; i++) {
- if (net_order[i] == NULL)
- break;
- err = (net_order[i])(hostname, flags, &ai_list,
- socktype, port);
- if (err != 0)
- return (err);
- }
-
- if (ai_list == NULL)
- return (EAI_NODATA);
-
-done:
- ai_list = ai_reverse(ai_list);
-
- *res = ai_list;
- return (0);
-}
-
-static char *
-lwres_strsep(char **stringp, const char *delim) {
- char *string = *stringp;
- char *s;
- const char *d;
- char sc, dc;
-
- if (string == NULL)
- return (NULL);
-
- for (s = string; *s != '\0'; s++) {
- sc = *s;
- for (d = delim; (dc = *d) != '\0'; d++)
- if (sc == dc) {
- *s++ = '\0';
- *stringp = s;
- return (string);
- }
- }
- *stringp = NULL;
- return (string);
-}
-
-static void
-set_order(int family, int (**net_order)(const char *, int, struct addrinfo **,
- int, int))
-{
- char *order, *tok;
- int found;
-
- if (family) {
- switch (family) {
- case AF_INET:
- *net_order++ = add_ipv4;
- break;
- case AF_INET6:
- *net_order++ = add_ipv6;
- break;
- }
- } else {
- order = getenv("NET_ORDER");
- found = 0;
- while (order != NULL) {
- /*
- * We ignore any unknown names.
- */
- tok = lwres_strsep(&order, ":");
- if (strcasecmp(tok, "inet6") == 0) {
- if ((found & FOUND_IPV6) == 0)
- *net_order++ = add_ipv6;
- found |= FOUND_IPV6;
- } else if (strcasecmp(tok, "inet") == 0 ||
- strcasecmp(tok, "inet4") == 0) {
- if ((found & FOUND_IPV4) == 0)
- *net_order++ = add_ipv4;
- found |= FOUND_IPV4;
- }
- }
-
- /*
- * Add in anything that we didn't find.
- */
- if ((found & FOUND_IPV4) == 0)
- *net_order++ = add_ipv4;
- if ((found & FOUND_IPV6) == 0)
- *net_order++ = add_ipv6;
- }
- *net_order = NULL;
- return;
-}
-
-static char v4_loop[4] = { 127, 0, 0, 1 };
-
-/*
- * The test against 0 is there to keep the Solaris compiler
- * from complaining about "end-of-loop code not reached".
- */
-#define SETERROR(code) \
- do { result = (code); \
- if (result != 0) goto cleanup; \
- } while (0)
-
-static int
-add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
- int socktype, int port)
-{
- struct addrinfo *ai;
- lwres_context_t *lwrctx = NULL;
- lwres_gabnresponse_t *by = NULL;
- lwres_addr_t *addr;
- lwres_result_t lwres;
- int result = 0;
-
- lwres = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (lwres != LWRES_R_SUCCESS)
- SETERROR(EAI_FAIL);
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
- if (hostname == NULL && (flags & AI_PASSIVE) == 0) {
- ai = ai_clone(*aip, AF_INET);
- if (ai == NULL)
- SETERROR(EAI_MEMORY);
-
- *aip = ai;
- ai->ai_socktype = socktype;
- SIN(ai->ai_addr)->sin_port = port;
- memmove(&SIN(ai->ai_addr)->sin_addr, v4_loop, 4);
- } else {
- lwres = lwres_getaddrsbyname(lwrctx, hostname,
- LWRES_ADDRTYPE_V4, &by);
- if (lwres != LWRES_R_SUCCESS) {
- if (lwres == LWRES_R_NOTFOUND)
- goto cleanup;
- else
- SETERROR(EAI_FAIL);
- }
- addr = LWRES_LIST_HEAD(by->addrs);
- while (addr != NULL) {
- ai = ai_clone(*aip, AF_INET);
- if (ai == NULL)
- SETERROR(EAI_MEMORY);
- *aip = ai;
- ai->ai_socktype = socktype;
- SIN(ai->ai_addr)->sin_port = port;
- memmove(&SIN(ai->ai_addr)->sin_addr,
- addr->address, 4);
- if (flags & AI_CANONNAME) {
- ai->ai_canonname = strdup(by->realname);
- if (ai->ai_canonname == NULL)
- SETERROR(EAI_MEMORY);
- }
- addr = LWRES_LIST_NEXT(addr, link);
- }
- }
- cleanup:
- if (by != NULL)
- lwres_gabnresponse_free(lwrctx, &by);
- if (lwrctx != NULL) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- }
- return (result);
-}
-
-static char v6_loop[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
-
-static int
-add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
- int socktype, int port)
-{
- struct addrinfo *ai;
- lwres_context_t *lwrctx = NULL;
- lwres_gabnresponse_t *by = NULL;
- lwres_addr_t *addr;
- lwres_result_t lwres;
- int result = 0;
-
- lwres = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (lwres != LWRES_R_SUCCESS)
- SETERROR(EAI_FAIL);
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
-
- if (hostname == NULL && (flags & AI_PASSIVE) == 0) {
- ai = ai_clone(*aip, AF_INET6);
- if (ai == NULL)
- SETERROR(EAI_MEMORY);
-
- *aip = ai;
- ai->ai_socktype = socktype;
- SIN6(ai->ai_addr)->sin6_port = port;
- memmove(&SIN6(ai->ai_addr)->sin6_addr, v6_loop, 16);
- } else {
- lwres = lwres_getaddrsbyname(lwrctx, hostname,
- LWRES_ADDRTYPE_V6, &by);
- if (lwres != LWRES_R_SUCCESS) {
- if (lwres == LWRES_R_NOTFOUND)
- goto cleanup;
- else
- SETERROR(EAI_FAIL);
- }
- addr = LWRES_LIST_HEAD(by->addrs);
- while (addr != NULL) {
- ai = ai_clone(*aip, AF_INET6);
- if (ai == NULL)
- SETERROR(EAI_MEMORY);
- *aip = ai;
- ai->ai_socktype = socktype;
- SIN6(ai->ai_addr)->sin6_port = port;
- memmove(&SIN6(ai->ai_addr)->sin6_addr,
- addr->address, 16);
- if (flags & AI_CANONNAME) {
- ai->ai_canonname = strdup(by->realname);
- if (ai->ai_canonname == NULL)
- SETERROR(EAI_MEMORY);
- }
- addr = LWRES_LIST_NEXT(addr, link);
- }
- }
- cleanup:
- if (by != NULL)
- lwres_gabnresponse_free(lwrctx, &by);
- if (lwrctx != NULL) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- }
- return (result);
-}
-
-/*% Free address info. */
-void
-lwres_freeaddrinfo(struct addrinfo *ai) {
- struct addrinfo *ai_next;
-
- while (ai != NULL) {
- ai_next = ai->ai_next;
- if (ai->ai_addr != NULL)
- free(ai->ai_addr);
- if (ai->ai_canonname)
- free(ai->ai_canonname);
- free(ai);
- ai = ai_next;
- }
-}
-
-#ifdef AF_LOCAL
-static int
-get_local(const char *name, int socktype, struct addrinfo **res) {
- struct addrinfo *ai;
- struct sockaddr_un *slocal;
-
- if (socktype == 0)
- return (EAI_SOCKTYPE);
-
- if (strlen(name) >= sizeof(slocal->sun_path))
- return (EAI_OVERFLOW);
-
- ai = ai_alloc(AF_LOCAL, sizeof(*slocal));
- if (ai == NULL)
- return (EAI_MEMORY);
-
- slocal = SLOCAL(ai->ai_addr);
- strncpy(slocal->sun_path, name, sizeof(slocal->sun_path));
- slocal->sun_path[sizeof(slocal->sun_path) - 1] = '\0';
-
- ai->ai_socktype = socktype;
- /*
- * ai->ai_flags, ai->ai_protocol, ai->ai_canonname,
- * and ai->ai_next were initialized to zero.
- */
-
- *res = ai;
- return (0);
-}
-#endif
-
-/*!
- * Allocate an addrinfo structure, and a sockaddr structure
- * of the specificed length. We initialize:
- * ai_addrlen
- * ai_family
- * ai_addr
- * ai_addr->sa_family
- * ai_addr->sa_len (LWRES_PLATFORM_HAVESALEN)
- * and everything else is initialized to zero.
- */
-static struct addrinfo *
-ai_alloc(int family, int addrlen) {
- struct addrinfo *ai;
-
- ai = (struct addrinfo *)calloc(1, sizeof(*ai));
- if (ai == NULL)
- return (NULL);
-
- ai->ai_addr = SA(calloc(1, addrlen));
- if (ai->ai_addr == NULL) {
- free(ai);
- return (NULL);
- }
- ai->ai_addrlen = addrlen;
- ai->ai_family = family;
- ai->ai_addr->sa_family = family;
-#ifdef LWRES_PLATFORM_HAVESALEN
- ai->ai_addr->sa_len = addrlen;
-#endif
- return (ai);
-}
-
-static struct addrinfo *
-ai_clone(struct addrinfo *oai, int family) {
- struct addrinfo *ai;
-
- ai = ai_alloc(family, ((family == AF_INET6) ?
- sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)));
-
- if (ai == NULL) {
- lwres_freeaddrinfo(oai);
- return (NULL);
- }
- if (oai == NULL)
- return (ai);
-
- ai->ai_flags = oai->ai_flags;
- ai->ai_socktype = oai->ai_socktype;
- ai->ai_protocol = oai->ai_protocol;
- ai->ai_canonname = NULL;
- ai->ai_next = oai;
- return (ai);
-}
-
-static struct addrinfo *
-ai_reverse(struct addrinfo *oai) {
- struct addrinfo *nai, *tai;
-
- nai = NULL;
-
- while (oai != NULL) {
- /*
- * Grab one off the old list.
- */
- tai = oai;
- oai = oai->ai_next;
- /*
- * Put it on the front of the new list.
- */
- tai->ai_next = nai;
- nai = tai;
- }
- return (nai);
-}
diff --git a/usr.sbin/bind/lib/lwres/gethost.c b/usr.sbin/bind/lib/lwres/gethost.c
deleted file mode 100644
index 2e2d6a7803f..00000000000
--- a/usr.sbin/bind/lib/lwres/gethost.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: gethost.c,v 1.6 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * These functions provide hostname-to-address and address-to-hostname
- * lookups by means of the lightweight resolver. They are similar to the
- * standard gethostent(3) functions provided by most operating systems.
- * They use a struct hostent which is usually defined in <namedb.h>.
- *
- * \code
- * struct hostent {
- * char *h_name; // official name of host
- * char **h_aliases; // alias list
- * int h_addrtype; // host address type
- * int h_length; // length of address
- * char **h_addr_list; // list of addresses from name server
- * };
- * #define h_addr h_addr_list[0] // address, for backward compatibility
- * \endcode
- *
- * The members of this structure are:
- *
- * \li h_name:
- * The official (canonical) name of the host.
- *
- * \li h_aliases:
- * A NULL-terminated array of alternate names (nicknames) for the
- * host.
- *
- * \li h_addrtype:
- * The type of address being returned -- PF_INET or PF_INET6.
- *
- * \li h_length:
- * The length of the address in bytes.
- *
- * \li h_addr_list:
- * A NULL terminated array of network addresses for the host. Host
- * addresses are returned in network byte order.
- *
- * For backward compatibility with very old software, h_addr is the first
- * address in h_addr_list.
- *
- * lwres_gethostent(), lwres_sethostent(), lwres_endhostent(),
- * lwres_gethostent_r(), lwres_sethostent_r() and lwres_endhostent_r()
- * provide iteration over the known host entries on systems that provide
- * such functionality through facilities like /etc/hosts or NIS. The
- * lightweight resolver does not currently implement these functions; it
- * only provides them as stub functions that always return failure.
- *
- * lwres_gethostbyname() and lwres_gethostbyname2() look up the hostname
- * name. lwres_gethostbyname() always looks for an IPv4 address while
- * lwres_gethostbyname2() looks for an address of protocol family af:
- * either PF_INET or PF_INET6 -- IPv4 or IPV6 addresses respectively.
- * Successful calls of the functions return a struct hostent for the name
- * that was looked up. NULL is returned if the lookups by
- * lwres_gethostbyname() or lwres_gethostbyname2() fail.
- *
- * Reverse lookups of addresses are performed by lwres_gethostbyaddr().
- * addr is an address of length len bytes and protocol family type --
- * PF_INET or PF_INET6. lwres_gethostbyname_r() is a thread-safe function
- * for forward lookups. If an error occurs, an error code is returned in
- * *error. resbuf is a pointer to a struct hostent which is initialised
- * by a successful call to lwres_gethostbyname_r() . buf is a buffer of
- * length len bytes which is used to store the h_name, h_aliases, and
- * h_addr_list elements of the struct hostent returned in resbuf.
- * Successful calls to lwres_gethostbyname_r() return resbuf, which is a
- * pointer to the struct hostent it created.
- *
- * lwres_gethostbyaddr_r() is a thread-safe function that performs a
- * reverse lookup of address addr which is len bytes long and is of
- * protocol family type -- PF_INET or PF_INET6. If an error occurs, the
- * error code is returned in *error. The other function parameters are
- * identical to those in lwres_gethostbyname_r(). resbuf is a pointer to
- * a struct hostent which is initialised by a successful call to
- * lwres_gethostbyaddr_r(). buf is a buffer of length len bytes which is
- * used to store the h_name, h_aliases, and h_addr_list elements of the
- * struct hostent returned in resbuf. Successful calls to
- * lwres_gethostbyaddr_r() return resbuf, which is a pointer to the
- * struct hostent it created.
- *
- * \section gethost_return Return Values
- *
- * The functions lwres_gethostbyname(), lwres_gethostbyname2(),
- * lwres_gethostbyaddr(), and lwres_gethostent() return NULL to indicate
- * an error. In this case the global variable lwres_h_errno will contain
- * one of the following error codes defined in \link netdb.h <lwres/netdb.h>:\endlink
- *
- * \li #HOST_NOT_FOUND:
- * The host or address was not found.
- *
- * \li #TRY_AGAIN:
- * A recoverable error occurred, e.g., a timeout. Retrying the
- * lookup may succeed.
- *
- * \li #NO_RECOVERY:
- * A non-recoverable error occurred.
- *
- * \li #NO_DATA:
- * The name exists, but has no address information associated with
- * it (or vice versa in the case of a reverse lookup). The code
- * NO_ADDRESS is accepted as a synonym for NO_DATA for backwards
- * compatibility.
- *
- * lwres_hstrerror() translates these error codes to suitable error
- * messages.
- *
- * lwres_gethostent() and lwres_gethostent_r() always return NULL.
- *
- * Successful calls to lwres_gethostbyname_r() and
- * lwres_gethostbyaddr_r() return resbuf, a pointer to the struct hostent
- * that was initialised by these functions. They return NULL if the
- * lookups fail or if buf was too small to hold the list of addresses and
- * names referenced by the h_name, h_aliases, and h_addr_list elements of
- * the struct hostent. If buf was too small, both lwres_gethostbyname_r()
- * and lwres_gethostbyaddr_r() set the global variable errno to ERANGE.
- *
- * \section gethost_see See Also
- *
- * gethostent(), \link getipnode.c getipnode\endlink, lwres_hstrerror()
- *
- * \section gethost_bugs Bugs
- *
- * lwres_gethostbyname(), lwres_gethostbyname2(), lwres_gethostbyaddr()
- * and lwres_endhostent() are not thread safe; they return pointers to
- * static data and provide error codes through a global variable.
- * Thread-safe versions for name and address lookup are provided by
- * lwres_gethostbyname_r(), and lwres_gethostbyaddr_r() respectively.
- *
- * The resolver daemon does not currently support any non-DNS name
- * services such as /etc/hosts or NIS, consequently the above functions
- * don't, either.
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <string.h>
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h> /* uintptr_t */
-#endif
-
-#include <lwres/net.h>
-#include <lwres/netdb.h>
-
-#include "assert_p.h"
-
-#define LWRES_ALIGNBYTES (sizeof(char *) - 1)
-#define LWRES_ALIGN(p) \
- (((uintptr_t)(p) + LWRES_ALIGNBYTES) &~ LWRES_ALIGNBYTES)
-
-static struct hostent *he = NULL;
-static int copytobuf(struct hostent *, struct hostent *, char *, int);
-
-/*% Always looks for an IPv4 address. */
-struct hostent *
-lwres_gethostbyname(const char *name) {
-
- if (he != NULL)
- lwres_freehostent(he);
-
- he = lwres_getipnodebyname(name, AF_INET, 0, &lwres_h_errno);
- return (he);
-}
-
-/*% Looks for either an IPv4 or IPv6 address. */
-struct hostent *
-lwres_gethostbyname2(const char *name, int af) {
- if (he != NULL)
- lwres_freehostent(he);
-
- he = lwres_getipnodebyname(name, af, 0, &lwres_h_errno);
- return (he);
-}
-
-/*% Reverse lookup of addresses. */
-struct hostent *
-lwres_gethostbyaddr(const char *addr, int len, int type) {
-
- if (he != NULL)
- lwres_freehostent(he);
-
- he = lwres_getipnodebyaddr(addr, len, type, &lwres_h_errno);
- return (he);
-}
-
-/*% Stub function. Always returns failure. */
-struct hostent *
-lwres_gethostent(void) {
- if (he != NULL)
- lwres_freehostent(he);
-
- return (NULL);
-}
-
-/*% Stub function. Always returns failure. */
-void
-lwres_sethostent(int stayopen) {
- /*
- * Empty.
- */
- UNUSED(stayopen);
-}
-
-/*% Stub function. Always returns failure. */
-void
-lwres_endhostent(void) {
- /*
- * Empty.
- */
-}
-
-/*% Thread-safe function for forward lookups. */
-struct hostent *
-lwres_gethostbyname_r(const char *name, struct hostent *resbuf,
- char *buf, int buflen, int *error)
-{
- struct hostent *myhe;
- int res;
-
- myhe = lwres_getipnodebyname(name, AF_INET, 0, error);
- if (myhe == NULL)
- return (NULL);
- res = copytobuf(myhe, resbuf, buf, buflen);
- lwres_freehostent(myhe);
- if (res != 0) {
- errno = ERANGE;
- return (NULL);
- }
- return (resbuf);
-}
-
-/*% Thread-safe reverse lookup. */
-struct hostent *
-lwres_gethostbyaddr_r(const char *addr, int len, int type,
- struct hostent *resbuf, char *buf, int buflen,
- int *error)
-{
- struct hostent *myhe;
- int res;
-
- myhe = lwres_getipnodebyaddr(addr, len, type, error);
- if (myhe == NULL)
- return (NULL);
- res = copytobuf(myhe, resbuf, buf, buflen);
- lwres_freehostent(myhe);
- if (res != 0) {
- errno = ERANGE;
- return (NULL);
- }
- return (resbuf);
-}
-
-/*% Stub function. Always returns failure. */
-struct hostent *
-lwres_gethostent_r(struct hostent *resbuf, char *buf, int buflen, int *error) {
- UNUSED(resbuf);
- UNUSED(buf);
- UNUSED(buflen);
- *error = 0;
- return (NULL);
-}
-
-/*% Stub function. Always returns failure. */
-void
-lwres_sethostent_r(int stayopen) {
- /*
- * Empty.
- */
- UNUSED(stayopen);
-}
-
-/*% Stub function. Always returns failure. */
-void
-lwres_endhostent_r(void) {
- /*
- * Empty.
- */
-}
-
-static int
-copytobuf(struct hostent *src, struct hostent *hptr, char *buf, int buflen) {
- char *cp;
- char **ptr;
- int i, n;
- int nptr, len;
-
- /*
- * Find out the amount of space required to store the answer.
- */
- nptr = 2; /* NULL ptrs */
- len = (int)((char *)LWRES_ALIGN(buf) - buf);
- for (i = 0; src->h_addr_list[i]; i++, nptr++) {
- len += src->h_length;
- }
- for (i = 0; src->h_aliases[i]; i++, nptr++) {
- len += strlen(src->h_aliases[i]) + 1;
- }
- len += strlen(src->h_name) + 1;
- len += nptr * sizeof(char*);
-
- if (len > buflen) {
- return (-1);
- }
-
- /*
- * Copy address size and type.
- */
- hptr->h_addrtype = src->h_addrtype;
- n = hptr->h_length = src->h_length;
-
- ptr = (char **)LWRES_ALIGN(buf);
- cp = (char *)LWRES_ALIGN(buf) + nptr * sizeof(char *);
-
- /*
- * Copy address list.
- */
- hptr->h_addr_list = ptr;
- for (i = 0; src->h_addr_list[i]; i++, ptr++) {
- memmove(cp, src->h_addr_list[i], n);
- hptr->h_addr_list[i] = cp;
- cp += n;
- }
- hptr->h_addr_list[i] = NULL;
- ptr++;
-
- /*
- * Copy official name.
- */
- n = strlen(src->h_name) + 1;
- strcpy(cp, src->h_name);
- hptr->h_name = cp;
- cp += n;
-
- /*
- * Copy aliases.
- */
- hptr->h_aliases = ptr;
- for (i = 0; src->h_aliases[i]; i++) {
- n = strlen(src->h_aliases[i]) + 1;
- strcpy(cp, src->h_aliases[i]);
- hptr->h_aliases[i] = cp;
- cp += n;
- }
- hptr->h_aliases[i] = NULL;
-
- return (0);
-}
diff --git a/usr.sbin/bind/lib/lwres/getipnode.c b/usr.sbin/bind/lib/lwres/getipnode.c
deleted file mode 100644
index 630887f6236..00000000000
--- a/usr.sbin/bind/lib/lwres/getipnode.c
+++ /dev/null
@@ -1,1165 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: getipnode.c,v 1.9 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * These functions perform thread safe, protocol independent
- * nodename-to-address and address-to-nodename translation as defined in
- * RFC2553. This use a struct hostent which is defined in namedb.h:
- *
- * \code
- * struct hostent {
- * char *h_name; // official name of host
- * char **h_aliases; // alias list
- * int h_addrtype; // host address type
- * int h_length; // length of address
- * char **h_addr_list; // list of addresses from name server
- * };
- * #define h_addr h_addr_list[0] // address, for backward compatibility
- * \endcode
- *
- * The members of this structure are:
- *
- * \li h_name:
- * The official (canonical) name of the host.
- *
- * \li h_aliases:
- * A NULL-terminated array of alternate names (nicknames) for the
- * host.
- *
- * \li h_addrtype:
- * The type of address being returned - usually PF_INET or
- * PF_INET6.
- *
- * \li h_length:
- * The length of the address in bytes.
- *
- * \li h_addr_list:
- * A NULL terminated array of network addresses for the host. Host
- * addresses are returned in network byte order.
- *
- * lwres_getipnodebyname() looks up addresses of protocol family af for
- * the hostname name. The flags parameter contains ORed flag bits to
- * specify the types of addresses that are searched for, and the types of
- * addresses that are returned. The flag bits are:
- *
- * \li #AI_V4MAPPED:
- * This is used with an af of #AF_INET6, and causes IPv4 addresses
- * to be returned as IPv4-mapped IPv6 addresses.
- *
- * \li #AI_ALL:
- * This is used with an af of #AF_INET6, and causes all known
- * addresses (IPv6 and IPv4) to be returned. If #AI_V4MAPPED is
- * also set, the IPv4 addresses are return as mapped IPv6
- * addresses.
- *
- * \li #AI_ADDRCONFIG:
- * Only return an IPv6 or IPv4 address if here is an active
- * network interface of that type. This is not currently
- * implemented in the BIND 9 lightweight resolver, and the flag is
- * ignored.
- *
- * \li #AI_DEFAULT:
- * This default sets the #AI_V4MAPPED and #AI_ADDRCONFIG flag bits.
- *
- * lwres_getipnodebyaddr() performs a reverse lookup of address src which
- * is len bytes long. af denotes the protocol family, typically PF_INET
- * or PF_INET6.
- *
- * lwres_freehostent() releases all the memory associated with the struct
- * hostent pointer. Any memory allocated for the h_name, h_addr_list
- * and h_aliases is freed, as is the memory for the hostent structure
- * itself.
- *
- * \section getipnode_return Return Values
- *
- * If an error occurs, lwres_getipnodebyname() and
- * lwres_getipnodebyaddr() set *error_num to an appropriate error code
- * and the function returns a NULL pointer. The error codes and their
- * meanings are defined in \link netdb.h <lwres/netdb.h>\endlink:
- *
- * \li #HOST_NOT_FOUND:
- * No such host is known.
- *
- * \li #NO_ADDRESS:
- * The server recognised the request and the name but no address
- * is available. Another type of request to the name server for
- * the domain might return an answer.
- *
- * \li #TRY_AGAIN:
- * A temporary and possibly transient error occurred, such as a
- * failure of a server to respond. The request may succeed if
- * retried.
- *
- * \li #NO_RECOVERY:
- * An unexpected failure occurred, and retrying the request is
- * pointless.
- *
- * lwres_hstrerror() translates these error codes to suitable error
- * messages.
- *
- * \section getipnode_see See Also
- *
- * getaddrinfo.c, gethost.c, getnameinfo.c, herror.c, RFC2553
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <lwres/lwres.h>
-#include <lwres/net.h>
-#include <lwres/netdb.h> /* XXX #include <netdb.h> */
-
-#include "assert_p.h"
-
-#ifndef INADDRSZ
-#define INADDRSZ 4
-#endif
-#ifndef IN6ADDRSZ
-#define IN6ADDRSZ 16
-#endif
-
-#ifdef LWRES_PLATFORM_NEEDIN6ADDRANY
-LIBLWRES_EXTERNAL_DATA const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
-#endif
-
-#ifndef IN6_IS_ADDR_V4COMPAT
-static const unsigned char in6addr_compat[12] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-#define IN6_IS_ADDR_V4COMPAT(x) (!memcmp((x)->s6_addr, in6addr_compat, 12) && \
- ((x)->s6_addr[12] != 0 || \
- (x)->s6_addr[13] != 0 || \
- (x)->s6_addr[14] != 0 || \
- ((x)->s6_addr[15] != 0 && \
- (x)->s6_addr[15] != 1)))
-#endif
-#ifndef IN6_IS_ADDR_V4MAPPED
-#define IN6_IS_ADDR_V4MAPPED(x) (!memcmp((x)->s6_addr, in6addr_mapped, 12))
-#endif
-
-static const unsigned char in6addr_mapped[12] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff
-};
-
-/***
- *** Forward declarations.
- ***/
-
-static int
-scan_interfaces(int *, int *);
-
-static struct hostent *
-copyandmerge(struct hostent *, struct hostent *, int, int *);
-
-static struct hostent *
-hostfromaddr(lwres_gnbaresponse_t *addr, int af, const void *src);
-
-static struct hostent *
-hostfromname(lwres_gabnresponse_t *name, int af);
-
-/***
- *** Public functions.
- ***/
-
-/*!
- * AI_V4MAPPED + AF_INET6
- * If no IPv6 address then a query for IPv4 and map returned values.
- *
- * AI_ALL + AI_V4MAPPED + AF_INET6
- * Return IPv6 and IPv4 mapped.
- *
- * AI_ADDRCONFIG
- * Only return IPv6 / IPv4 address if there is an interface of that
- * type active.
- */
-
-struct hostent *
-lwres_getipnodebyname(const char *name, int af, int flags, int *error_num) {
- int have_v4 = 1, have_v6 = 1;
- struct in_addr in4;
- struct in6_addr in6;
- struct hostent he, *he1 = NULL, *he2 = NULL, *he3 = NULL;
- int v4 = 0, v6 = 0;
- int tmp_err = 0;
- lwres_context_t *lwrctx = NULL;
- lwres_gabnresponse_t *by = NULL;
- int n;
-
- /*
- * If we care about active interfaces then check.
- */
- if ((flags & AI_ADDRCONFIG) != 0)
- if (scan_interfaces(&have_v4, &have_v6) == -1) {
- *error_num = NO_RECOVERY;
- return (NULL);
- }
-
- /* Check for literal address. */
- if ((v4 = lwres_net_pton(AF_INET, name, &in4)) != 1)
- v6 = lwres_net_pton(AF_INET6, name, &in6);
-
- /*
- * Impossible combination?
- */
- if ((af == AF_INET6 && (flags & AI_V4MAPPED) == 0 && v4 == 1) ||
- (af == AF_INET && v6 == 1) ||
- (have_v4 == 0 && v4 == 1) ||
- (have_v6 == 0 && v6 == 1) ||
- (have_v4 == 0 && af == AF_INET) ||
- (have_v6 == 0 && af == AF_INET6 &&
- (((flags & AI_V4MAPPED) != 0 && have_v4) ||
- (flags & AI_V4MAPPED) == 0))) {
- *error_num = HOST_NOT_FOUND;
- return (NULL);
- }
-
- /*
- * Literal address?
- */
- if (v4 == 1 || v6 == 1) {
- char *addr_list[2];
- char *aliases[1];
- char mappedname[sizeof("::ffff:123.123.123.123")];
- union {
- const char *const_name;
- char *deconst_name;
- } u;
-
- u.const_name = name;
- if (v4 == 1 && af == AF_INET6) {
- strcpy(mappedname, "::ffff:");
- lwres_net_ntop(AF_INET, (char *)&in4,
- mappedname + sizeof("::ffff:") - 1,
- sizeof(mappedname) - sizeof("::ffff:")
- + 1);
- he.h_name = mappedname;
- } else
- he.h_name = u.deconst_name;
- he.h_addr_list = addr_list;
- he.h_addr_list[0] = (v4 == 1) ? (char *)&in4 : (char *)&in6;
- he.h_addr_list[1] = NULL;
- he.h_aliases = aliases;
- he.h_aliases[0] = NULL;
- he.h_length = (v4 == 1) ? INADDRSZ : IN6ADDRSZ;
- he.h_addrtype = (v4 == 1) ? AF_INET : AF_INET6;
- return (copyandmerge(&he, NULL, af, error_num));
- }
-
- n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (n != 0) {
- *error_num = NO_RECOVERY;
- goto cleanup;
- }
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
- tmp_err = NO_RECOVERY;
- if (have_v6 && af == AF_INET6) {
- n = lwres_getaddrsbyname(lwrctx, name, LWRES_ADDRTYPE_V6, &by);
- if (n == 0) {
- he1 = hostfromname(by, AF_INET6);
- lwres_gabnresponse_free(lwrctx, &by);
- if (he1 == NULL) {
- *error_num = NO_RECOVERY;
- goto cleanup;
- }
- } else {
- if (n == LWRES_R_NOTFOUND)
- tmp_err = HOST_NOT_FOUND;
- else {
- *error_num = NO_RECOVERY;
- goto cleanup;
- }
- }
- }
-
- if (have_v4 &&
- ((af == AF_INET) ||
- (af == AF_INET6 && (flags & AI_V4MAPPED) != 0 &&
- (he1 == NULL || (flags & AI_ALL) != 0)))) {
- n = lwres_getaddrsbyname(lwrctx, name, LWRES_ADDRTYPE_V4, &by);
- if (n == 0) {
- he2 = hostfromname(by, AF_INET);
- lwres_gabnresponse_free(lwrctx, &by);
- if (he2 == NULL) {
- *error_num = NO_RECOVERY;
- goto cleanup;
- }
- } else if (he1 == NULL) {
- if (n == LWRES_R_NOTFOUND)
- *error_num = HOST_NOT_FOUND;
- else
- *error_num = NO_RECOVERY;
- goto cleanup;
- }
- } else
- *error_num = tmp_err;
-
- he3 = copyandmerge(he1, he2, af, error_num);
-
- cleanup:
- if (he1 != NULL)
- lwres_freehostent(he1);
- if (he2 != NULL)
- lwres_freehostent(he2);
- if (lwrctx != NULL) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- }
- return (he3);
-}
-
-/*% performs a reverse lookup of address src which is len bytes long. af denotes the protocol family, typically #PF_INET or PF_INET6. */
-struct hostent *
-lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
- struct hostent *he1, *he2;
- lwres_context_t *lwrctx = NULL;
- lwres_gnbaresponse_t *by = NULL;
- lwres_result_t n;
- union {
- const void *konst;
- struct in6_addr *in6;
- } u;
-
- /*
- * Sanity checks.
- */
- if (src == NULL) {
- *error_num = NO_RECOVERY;
- return (NULL);
- }
-
- switch (af) {
- case AF_INET:
- if (len != (unsigned int)INADDRSZ) {
- *error_num = NO_RECOVERY;
- return (NULL);
- }
- break;
- case AF_INET6:
- if (len != (unsigned int)IN6ADDRSZ) {
- *error_num = NO_RECOVERY;
- return (NULL);
- }
- break;
- default:
- *error_num = NO_RECOVERY;
- return (NULL);
- }
-
- /*
- * The de-"const"-ing game is done because at least one
- * vendor's system (RedHat 6.0) defines the IN6_IS_ADDR_*
- * macros in such a way that they discard the const with
- * internal casting, and gcc ends up complaining. Rather
- * than replacing their own (possibly optimized) definitions
- * with our own, cleanly discarding the const is the easiest
- * thing to do.
- */
- u.konst = src;
-
- /*
- * Look up IPv4 and IPv4 mapped/compatible addresses.
- */
- if ((af == AF_INET6 && IN6_IS_ADDR_V4COMPAT(u.in6)) ||
- (af == AF_INET6 && IN6_IS_ADDR_V4MAPPED(u.in6)) ||
- (af == AF_INET)) {
- const unsigned char *cp = src;
-
- if (af == AF_INET6)
- cp += 12;
- n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (n == LWRES_R_SUCCESS)
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
- if (n == LWRES_R_SUCCESS)
- n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V4,
- INADDRSZ, cp, &by);
- if (n != LWRES_R_SUCCESS) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- if (n == LWRES_R_NOTFOUND)
- *error_num = HOST_NOT_FOUND;
- else
- *error_num = NO_RECOVERY;
- return (NULL);
- }
- he1 = hostfromaddr(by, AF_INET, cp);
- lwres_gnbaresponse_free(lwrctx, &by);
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- if (af != AF_INET6)
- return (he1);
-
- /*
- * Convert from AF_INET to AF_INET6.
- */
- he2 = copyandmerge(he1, NULL, af, error_num);
- lwres_freehostent(he1);
- if (he2 == NULL)
- return (NULL);
- /*
- * Restore original address.
- */
- memmove(he2->h_addr, src, len);
- return (he2);
- }
-
- /*
- * Lookup IPv6 address.
- */
- if (memcmp(src, &in6addr_any, IN6ADDRSZ) == 0) {
- *error_num = HOST_NOT_FOUND;
- return (NULL);
- }
-
- n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (n == LWRES_R_SUCCESS)
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
- if (n == LWRES_R_SUCCESS)
- n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V6, IN6ADDRSZ,
- src, &by);
- if (n != 0) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
-
- if (n == LWRES_R_NOTFOUND)
- *error_num = HOST_NOT_FOUND;
- else
- *error_num = NO_RECOVERY;
-
- return (NULL);
- }
-
- he1 = hostfromaddr(by, AF_INET6, src);
- lwres_gnbaresponse_free(lwrctx, &by);
- if (he1 == NULL)
- *error_num = NO_RECOVERY;
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- return (he1);
-}
-
-/*% releases all the memory associated with the struct hostent pointer */
-void
-lwres_freehostent(struct hostent *he) {
- char **cpp;
- int names = 1;
- int addresses = 1;
-
- if (he == NULL)
- return;
-
- free(he->h_name);
-
- cpp = he->h_addr_list;
- while (*cpp != NULL) {
- free(*cpp);
- *cpp = NULL;
- cpp++;
- addresses++;
- }
-
- cpp = he->h_aliases;
- while (*cpp != NULL) {
- free(*cpp);
- cpp++;
- names++;
- }
-
- free(he->h_aliases);
- free(he->h_addr_list);
- free(he);
-}
-
-/*
- * Private
- */
-
-/*
- * Scan the interface table and set have_v4 and have_v6 depending
- * upon whether there are IPv4 and IPv6 interface addresses.
- *
- * Returns:
- * 0 on success
- * -1 on failure.
- */
-
-#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
- !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
-
-#ifdef __hpux
-#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 __hpux
-#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
-
-static int
-scan_interfaces6(int *have_v4, int *have_v6) {
- struct LIFCONF lifc;
- struct LIFREQ lifreq;
- struct in_addr in4;
- struct in6_addr in6;
- char *buf = NULL, *cp, *cplim;
- static unsigned int bufsiz = 4095;
- int s, cpsize, n;
-
- /*
- * Set to zero. Used as loop terminators below.
- */
- *have_v4 = *have_v6 = 0;
-
- /*
- * Get interface list from system.
- */
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
- goto err_ret;
-
- /*
- * Grow buffer until large enough to contain all interface
- * descriptions.
- */
- for (;;) {
- buf = malloc(bufsiz);
- if (buf == NULL)
- goto err_ret;
-#ifdef ISC_HAVE_LIFC_FAMILY
- lifc.lifc_family = AF_UNSPEC; /* request all families */
-#endif
-#ifdef ISC_HAVE_LIFC_FLAGS
- lifc.lifc_flags = 0;
-#endif
- lifc.lifc_len = bufsiz;
- lifc.lifc_buf = buf;
- if ((n = ioctl(s, SIOCGLIFCONF, (char *)&lifc)) != -1) {
- /*
- * 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
- * lifc.lifc_len is too near to the end of the
- * buffer we will grow it just in case and
- * retry.
- */
- if (lifc.lifc_len + 2 * sizeof(lifreq) < bufsiz)
- break;
- }
- if ((n == -1) && errno != EINVAL)
- goto err_ret;
-
- if (bufsiz > 1000000)
- goto err_ret;
-
- free(buf);
- bufsiz += 4096;
- }
-
- /*
- * Parse system's interface list.
- */
- cplim = buf + lifc.lifc_len; /* skip over if's with big ifr_addr's */
- for (cp = buf;
- (*have_v4 == 0 || *have_v6 == 0) && cp < cplim;
- cp += cpsize) {
- memmove(&lifreq, cp, sizeof(lifreq));
-#ifdef LWRES_PLATFORM_HAVESALEN
-#ifdef FIX_ZERO_SA_LEN
- if (lifreq.lifr_addr.sa_len == 0)
- lifreq.lifr_addr.sa_len = 16;
-#endif
-#ifdef HAVE_MINIMUM_IFREQ
- cpsize = sizeof(lifreq);
- if (lifreq.lifr_addr.sa_len > sizeof(struct sockaddr))
- cpsize += (int)lifreq.lifr_addr.sa_len -
- (int)(sizeof(struct sockaddr));
-#else
- cpsize = sizeof(lifreq.lifr_name) + lifreq.lifr_addr.sa_len;
-#endif /* HAVE_MINIMUM_IFREQ */
-#elif defined SIOCGIFCONF_ADDR
- cpsize = sizeof(lifreq);
-#else
- cpsize = sizeof(lifreq.lifr_name);
- /* XXX maybe this should be a hard error? */
- if (ioctl(s, SIOCGLIFADDR, (char *)&lifreq) < 0)
- continue;
-#endif
- switch (lifreq.lifr_addr.ss_family) {
- case AF_INET:
- if (*have_v4 == 0) {
- memmove(&in4,
- &((struct sockaddr_in *)
- &lifreq.lifr_addr)->sin_addr,
- sizeof(in4));
- if (in4.s_addr == INADDR_ANY)
- break;
- n = ioctl(s, SIOCGLIFFLAGS, (char *)&lifreq);
- if (n < 0)
- break;
- if ((lifreq.lifr_flags & IFF_UP) == 0)
- break;
- *have_v4 = 1;
- }
- break;
- case AF_INET6:
- if (*have_v6 == 0) {
- memmove(&in6,
- &((struct sockaddr_in6 *)
- &lifreq.lifr_addr)->sin6_addr,
- sizeof(in6));
- if (memcmp(&in6, &in6addr_any,
- sizeof(in6)) == 0)
- break;
- n = ioctl(s, SIOCGLIFFLAGS, (char *)&lifreq);
- if (n < 0)
- break;
- if ((lifreq.lifr_flags & IFF_UP) == 0)
- break;
- *have_v6 = 1;
- }
- break;
- }
- }
- if (buf != NULL)
- free(buf);
- close(s);
- return (0);
- err_ret:
- if (buf != NULL)
- free(buf);
- if (s != -1)
- close(s);
- return (-1);
-}
-#endif
-
-static int
-scan_interfaces(int *have_v4, int *have_v6) {
-#if !defined(SIOCGIFCONF) || !defined(SIOCGIFADDR)
- *have_v4 = *have_v6 = 1;
- return (0);
-#else
- struct ifconf ifc;
- union {
- char _pad[256]; /* leave space for IPv6 addresses */
- struct ifreq ifreq;
- } u;
- struct in_addr in4;
- struct in6_addr in6;
- char *buf = NULL, *cp, *cplim;
- static unsigned int bufsiz = 4095;
- int s, n;
- size_t cpsize;
-
-#ifdef WIN32
- InitSockets();
-#endif
-#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
- !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
- /*
- * Try to scan the interfaces using IPv6 ioctls().
- */
- if (!scan_interfaces6(have_v4, have_v6)) {
-#ifdef WIN32
- DestroySockets();
-#endif
- return (0);
- }
-#endif
-
- /*
- * Set to zero. Used as loop terminators below.
- */
- *have_v4 = *have_v6 = 0;
-
- /*
- * Get interface list from system.
- */
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
- goto err_ret;
-
- /*
- * Grow buffer until large enough to contain all interface
- * descriptions.
- */
- for (;;) {
- buf = malloc(bufsiz);
- if (buf == NULL)
- goto err_ret;
- ifc.ifc_len = bufsiz;
- ifc.ifc_buf = buf;
-#ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
- /*
- * This is a fix for IRIX OS in which the call to ioctl with
- * the flag SIOCGIFCONF may not return an entry for all the
- * interfaces like most flavors of Unix.
- */
- if (emul_ioctl(&ifc) >= 0)
- break;
-#else
- if ((n = ioctl(s, SIOCGIFCONF, (char *)&ifc)) != -1) {
- /*
- * 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 (ifc.ifc_len + 2 * sizeof(u.ifreq) < bufsiz)
- break;
- }
-#endif
- if ((n == -1) && errno != EINVAL)
- goto err_ret;
-
- if (bufsiz > 1000000)
- goto err_ret;
-
- free(buf);
- bufsiz += 4096;
- }
-
- /*
- * Parse system's interface list.
- */
- cplim = buf + ifc.ifc_len; /* skip over if's with big ifr_addr's */
- for (cp = buf;
- (*have_v4 == 0 || *have_v6 == 0) && cp < cplim;
- cp += cpsize) {
- memmove(&u.ifreq, cp, sizeof(u.ifreq));
-#ifdef LWRES_PLATFORM_HAVESALEN
-#ifdef FIX_ZERO_SA_LEN
- if (u.ifreq.ifr_addr.sa_len == 0)
- u.ifreq.ifr_addr.sa_len = 16;
-#endif
-#ifdef HAVE_MINIMUM_IFREQ
- cpsize = sizeof(u.ifreq);
- if (u.ifreq.ifr_addr.sa_len > sizeof(struct sockaddr))
- cpsize += (int)u.ifreq.ifr_addr.sa_len -
- (int)(sizeof(struct sockaddr));
-#else
- cpsize = sizeof(u.ifreq.ifr_name) + u.ifreq.ifr_addr.sa_len;
-#endif /* HAVE_MINIMUM_IFREQ */
- if (cpsize > sizeof(u.ifreq) && cpsize <= sizeof(u))
- memmove(&u.ifreq, cp, cpsize);
-#elif defined SIOCGIFCONF_ADDR
- cpsize = sizeof(u.ifreq);
-#else
- cpsize = sizeof(u.ifreq.ifr_name);
- /* XXX maybe this should be a hard error? */
- if (ioctl(s, SIOCGIFADDR, (char *)&u.ifreq) < 0)
- continue;
-#endif
- switch (u.ifreq.ifr_addr.sa_family) {
- case AF_INET:
- if (*have_v4 == 0) {
- memmove(&in4,
- &((struct sockaddr_in *)
- &u.ifreq.ifr_addr)->sin_addr,
- sizeof(in4));
- if (in4.s_addr == INADDR_ANY)
- break;
- n = ioctl(s, SIOCGIFFLAGS, (char *)&u.ifreq);
- if (n < 0)
- break;
- if ((u.ifreq.ifr_flags & IFF_UP) == 0)
- break;
- *have_v4 = 1;
- }
- break;
- case AF_INET6:
- if (*have_v6 == 0) {
- memmove(&in6,
- &((struct sockaddr_in6 *)
- &u.ifreq.ifr_addr)->sin6_addr,
- sizeof(in6));
- if (memcmp(&in6, &in6addr_any,
- sizeof(in6)) == 0)
- break;
- n = ioctl(s, SIOCGIFFLAGS, (char *)&u.ifreq);
- if (n < 0)
- break;
- if ((u.ifreq.ifr_flags & IFF_UP) == 0)
- break;
- *have_v6 = 1;
- }
- break;
- }
- }
- if (buf != NULL)
- free(buf);
-#ifdef WIN32
- DestroySockets();
-#endif
- close(s);
- return (0);
-
- err_ret:
- if (buf != NULL)
- free(buf);
- if (s != -1)
- close(s);
-#ifdef WIN32
- DestroySockets();
-#endif
- return (-1);
-#endif
-}
-
-static struct hostent *
-copyandmerge(struct hostent *he1, struct hostent *he2, int af, int *error_num)
-{
- struct hostent *he = NULL;
- int addresses = 1; /* NULL terminator */
- int names = 1; /* NULL terminator */
- int len = 0;
- char **cpp, **npp;
-
- /*
- * Work out array sizes.
- */
- if (he1 != NULL) {
- cpp = he1->h_addr_list;
- while (*cpp != NULL) {
- addresses++;
- cpp++;
- }
- cpp = he1->h_aliases;
- while (*cpp != NULL) {
- names++;
- cpp++;
- }
- }
-
- if (he2 != NULL) {
- cpp = he2->h_addr_list;
- while (*cpp != NULL) {
- addresses++;
- cpp++;
- }
- if (he1 == NULL) {
- cpp = he2->h_aliases;
- while (*cpp != NULL) {
- names++;
- cpp++;
- }
- }
- }
-
- if (addresses == 1) {
- *error_num = NO_ADDRESS;
- return (NULL);
- }
-
- he = malloc(sizeof(*he));
- if (he == NULL)
- goto no_recovery;
-
- he->h_addr_list = malloc(sizeof(char *) * (addresses));
- if (he->h_addr_list == NULL)
- goto cleanup0;
- memset(he->h_addr_list, 0, sizeof(char *) * (addresses));
-
- /*
- * Copy addresses.
- */
- npp = he->h_addr_list;
- if (he1 != NULL) {
- cpp = he1->h_addr_list;
- while (*cpp != NULL) {
- *npp = malloc((af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
- if (*npp == NULL)
- goto cleanup1;
- /*
- * Convert to mapped if required.
- */
- if (af == AF_INET6 && he1->h_addrtype == AF_INET) {
- memmove(*npp, in6addr_mapped,
- sizeof(in6addr_mapped));
- memmove(*npp + sizeof(in6addr_mapped), *cpp,
- INADDRSZ);
- } else {
- memmove(*npp, *cpp,
- (af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
- }
- cpp++;
- npp++;
- }
- }
-
- if (he2 != NULL) {
- cpp = he2->h_addr_list;
- while (*cpp != NULL) {
- *npp = malloc((af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
- if (*npp == NULL)
- goto cleanup1;
- /*
- * Convert to mapped if required.
- */
- if (af == AF_INET6 && he2->h_addrtype == AF_INET) {
- memmove(*npp, in6addr_mapped,
- sizeof(in6addr_mapped));
- memmove(*npp + sizeof(in6addr_mapped), *cpp,
- INADDRSZ);
- } else {
- memmove(*npp, *cpp,
- (af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
- }
- cpp++;
- npp++;
- }
- }
-
- he->h_aliases = malloc(sizeof(char *) * (names));
- if (he->h_aliases == NULL)
- goto cleanup1;
- memset(he->h_aliases, 0, sizeof(char *) * (names));
-
- /*
- * Copy aliases.
- */
- npp = he->h_aliases;
- cpp = (he1 != NULL) ? he1->h_aliases
- : ((he2 != NULL) ? he2->h_aliases : NULL);
- while (cpp != NULL && *cpp != NULL) {
- len = strlen (*cpp) + 1;
- *npp = malloc(len);
- if (*npp == NULL)
- goto cleanup2;
- strcpy(*npp, *cpp);
- npp++;
- cpp++;
- }
-
- /*
- * Copy hostname.
- */
- he->h_name = malloc(strlen((he1 != NULL) ?
- he1->h_name : he2->h_name) + 1);
- if (he->h_name == NULL)
- goto cleanup2;
- strcpy(he->h_name, (he1 != NULL) ? he1->h_name : he2->h_name);
-
- /*
- * Set address type and length.
- */
- he->h_addrtype = af;
- he->h_length = (af == AF_INET) ? INADDRSZ : IN6ADDRSZ;
- return (he);
-
- cleanup2:
- cpp = he->h_aliases;
- while (*cpp != NULL) {
- free(*cpp);
- cpp++;
- }
- free(he->h_aliases);
-
- cleanup1:
- cpp = he->h_addr_list;
- while (*cpp != NULL) {
- free(*cpp);
- *cpp = NULL;
- cpp++;
- }
- free(he->h_addr_list);
-
- cleanup0:
- free(he);
-
- no_recovery:
- *error_num = NO_RECOVERY;
- return (NULL);
-}
-
-static struct hostent *
-hostfromaddr(lwres_gnbaresponse_t *addr, int af, const void *src) {
- struct hostent *he;
- int i;
-
- he = malloc(sizeof(*he));
- if (he == NULL)
- goto cleanup;
- memset(he, 0, sizeof(*he));
-
- /*
- * Set family and length.
- */
- he->h_addrtype = af;
- switch (af) {
- case AF_INET:
- he->h_length = INADDRSZ;
- break;
- case AF_INET6:
- he->h_length = IN6ADDRSZ;
- break;
- default:
- INSIST(0);
- }
-
- /*
- * Copy name.
- */
- he->h_name = strdup(addr->realname);
- if (he->h_name == NULL)
- goto cleanup;
-
- /*
- * Copy aliases.
- */
- he->h_aliases = malloc(sizeof(char *) * (addr->naliases + 1));
- if (he->h_aliases == NULL)
- goto cleanup;
- for (i = 0; i < addr->naliases; i++) {
- he->h_aliases[i] = strdup(addr->aliases[i]);
- if (he->h_aliases[i] == NULL)
- goto cleanup;
- }
- he->h_aliases[i] = NULL;
-
- /*
- * Copy address.
- */
- he->h_addr_list = malloc(sizeof(char *) * 2);
- if (he->h_addr_list == NULL)
- goto cleanup;
- he->h_addr_list[0] = malloc(he->h_length);
- if (he->h_addr_list[0] == NULL)
- goto cleanup;
- memmove(he->h_addr_list[0], src, he->h_length);
- he->h_addr_list[1] = NULL;
- return (he);
-
- cleanup:
- if (he != NULL && he->h_addr_list != NULL) {
- for (i = 0; he->h_addr_list[i] != NULL; i++)
- free(he->h_addr_list[i]);
- free(he->h_addr_list);
- }
- if (he != NULL && he->h_aliases != NULL) {
- for (i = 0; he->h_aliases[i] != NULL; i++)
- free(he->h_aliases[i]);
- free(he->h_aliases);
- }
- if (he != NULL && he->h_name != NULL)
- free(he->h_name);
- if (he != NULL)
- free(he);
- return (NULL);
-}
-
-static struct hostent *
-hostfromname(lwres_gabnresponse_t *name, int af) {
- struct hostent *he;
- int i;
- lwres_addr_t *addr;
-
- he = malloc(sizeof(*he));
- if (he == NULL)
- goto cleanup;
- memset(he, 0, sizeof(*he));
-
- /*
- * Set family and length.
- */
- he->h_addrtype = af;
- switch (af) {
- case AF_INET:
- he->h_length = INADDRSZ;
- break;
- case AF_INET6:
- he->h_length = IN6ADDRSZ;
- break;
- default:
- INSIST(0);
- }
-
- /*
- * Copy name.
- */
- he->h_name = strdup(name->realname);
- if (he->h_name == NULL)
- goto cleanup;
-
- /*
- * Copy aliases.
- */
- he->h_aliases = malloc(sizeof(char *) * (name->naliases + 1));
- if (he->h_aliases == NULL)
- goto cleanup;
- for (i = 0; i < name->naliases; i++) {
- he->h_aliases[i] = strdup(name->aliases[i]);
- if (he->h_aliases[i] == NULL)
- goto cleanup;
- }
- he->h_aliases[i] = NULL;
-
- /*
- * Copy addresses.
- */
- he->h_addr_list = malloc(sizeof(char *) * (name->naddrs + 1));
- if (he->h_addr_list == NULL)
- goto cleanup;
- addr = LWRES_LIST_HEAD(name->addrs);
- i = 0;
- while (addr != NULL) {
- he->h_addr_list[i] = malloc(he->h_length);
- if (he->h_addr_list[i] == NULL)
- goto cleanup;
- memmove(he->h_addr_list[i], addr->address, he->h_length);
- addr = LWRES_LIST_NEXT(addr, link);
- i++;
- }
- he->h_addr_list[i] = NULL;
- return (he);
-
- cleanup:
- if (he != NULL && he->h_addr_list != NULL) {
- for (i = 0; he->h_addr_list[i] != NULL; i++)
- free(he->h_addr_list[i]);
- free(he->h_addr_list);
- }
- if (he != NULL && he->h_aliases != NULL) {
- for (i = 0; he->h_aliases[i] != NULL; i++)
- free(he->h_aliases[i]);
- free(he->h_aliases);
- }
- if (he != NULL && he->h_name != NULL)
- free(he->h_name);
- if (he != NULL)
- free(he);
- return (NULL);
-}
diff --git a/usr.sbin/bind/lib/lwres/getnameinfo.c b/usr.sbin/bind/lib/lwres/getnameinfo.c
deleted file mode 100644
index af78f3c2c37..00000000000
--- a/usr.sbin/bind/lib/lwres/getnameinfo.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: getnameinfo.c,v 1.9 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/*
- * 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.
- */
-
-/*
- * XXX
- * Issues to be discussed:
- * - Return values. There seems to be no standard for return value (RFC2553)
- * but INRIA implementation returns EAI_xxx defined for getaddrinfo().
- */
-
-
-/**
- * This function is equivalent to the getnameinfo(3) function defined in
- * RFC2133. lwres_getnameinfo() returns the hostname for the struct
- * sockaddr sa which is salen bytes long. The hostname is of length
- * hostlen and is returned via *host. The maximum length of the hostname
- * is 1025 bytes: #NI_MAXHOST.
- *
- * The name of the service associated with the port number in sa is
- * returned in *serv. It is servlen bytes long. The maximum length of the
- * service name is #NI_MAXSERV - 32 bytes.
- *
- * The flags argument sets the following bits:
- *
- * \li #NI_NOFQDN:
- * A fully qualified domain name is not required for local hosts.
- * The local part of the fully qualified domain name is returned
- * instead.
- *
- * \li #NI_NUMERICHOST
- * Return the address in numeric form, as if calling inet_ntop(),
- * instead of a host name.
- *
- * \li #NI_NAMEREQD
- * A name is required. If the hostname cannot be found in the DNS
- * and this flag is set, a non-zero error code is returned. If the
- * hostname is not found and the flag is not set, the address is
- * returned in numeric form.
- *
- * \li #NI_NUMERICSERV
- * The service name is returned as a digit string representing the
- * port number.
- *
- * \li #NI_DGRAM
- * Specifies that the service being looked up is a datagram
- * service, and causes getservbyport() to be called with a second
- * argument of "udp" instead of its default of "tcp". This is
- * required for the few ports (512-514) that have different
- * services for UDP and TCP.
- *
- * \section getnameinfo_return Return Values
- *
- * lwres_getnameinfo() returns 0 on success or a non-zero error code if
- * an error occurs.
- *
- * \section getname_see See Also
- *
- * RFC2133, getservbyport(),
- * lwres_getnamebyaddr(). lwres_net_ntop().
- *
- * \section getnameinfo_bugs Bugs
- *
- * RFC2133 fails to define what the nonzero return values of
- * getnameinfo() are.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#include <lwres/lwres.h>
-#include <lwres/net.h>
-#include <lwres/netdb.h>
-#include "print_p.h"
-
-#include "assert_p.h"
-
-#define SUCCESS 0
-
-/*% afd structure definition */
-static struct afd {
- int a_af;
- size_t a_addrlen;
- size_t a_socklen;
-} afdl [] = {
- /*!
- * First entry is linked last...
- */
- { AF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in) },
- { AF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6) },
- {0, 0, 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
-#define ENI_NOSOCKET 7
-
-/*!
- * The test against 0 is there to keep the Solaris compiler
- * from complaining about "end-of-loop code not reached".
- */
-#define ERR(code) \
- do { result = (code); \
- if (result != 0) goto cleanup; \
- } while (0)
-
-/*% lightweight resolver socket address structure to hostname and service name */
-int
-lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
- size_t hostlen, char *serv, size_t servlen, int flags)
-{
- struct afd *afd = NULL;
- struct servent *sp;
- unsigned short port;
-#ifdef LWRES_PLATFORM_HAVESALEN
- size_t len;
-#endif
- int family, i;
- const void *addr;
- char *p;
-#if 0
- unsigned long v4a;
- unsigned char pfx;
-#endif
- char numserv[sizeof("65000")];
- char numaddr[sizeof("abcd:abcd:abcd:abcd:abcd:abcd:255.255.255.255")
- + 1 + sizeof("4294967295")];
- const char *proto;
- lwres_uint32_t lwf = 0;
- lwres_context_t *lwrctx = NULL;
- lwres_gnbaresponse_t *by = NULL;
- int result = SUCCESS;
- int n;
-
- if (sa == NULL)
- ERR(ENI_NOSOCKET);
-
-#ifdef LWRES_PLATFORM_HAVESALEN
- len = sa->sa_len;
- if (len != salen)
- ERR(ENI_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;
- }
- ERR(ENI_FAMILY);
-
- found:
- if (salen != afd->a_socklen)
- ERR(ENI_SALEN);
-
- switch (family) {
- case AF_INET:
- port = ((const struct sockaddr_in *)sa)->sin_port;
- addr = &((const struct sockaddr_in *)sa)->sin_addr.s_addr;
- break;
-
- case AF_INET6:
- port = ((const struct sockaddr_in6 *)sa)->sin6_port;
- addr = ((const struct sockaddr_in6 *)sa)->sin6_addr.s6_addr;
- break;
-
- default:
- port = 0;
- addr = NULL;
- POST(port); POST(addr);
- INSIST(0);
- }
- proto = (flags & NI_DGRAM) ? "udp" : "tcp";
-
- if (serv == NULL || servlen == 0U) {
- /*
- * Caller does not want service.
- */
- } else if ((flags & NI_NUMERICSERV) != 0 ||
- (sp = getservbyport(port, proto)) == NULL) {
- snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
- if ((strlen(numserv) + 1) > servlen)
- ERR(ENI_MEMORY);
- strcpy(serv, numserv);
- } else {
- if ((strlen(sp->s_name) + 1) > servlen)
- ERR(ENI_MEMORY);
- strcpy(serv, sp->s_name);
- }
-
-#if 0
- switch (sa->sa_family) {
- case AF_INET:
- v4a = ((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;
-
- case AF_INET6:
- pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[0];
- if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
- flags |= NI_NUMERICHOST;
- break;
- }
-#endif
-
- if (host == NULL || hostlen == 0U) {
- /*
- * What should we do?
- */
- } else if (flags & NI_NUMERICHOST) {
- if (lwres_net_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
- == NULL)
- ERR(ENI_SYSTEM);
-#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
- if (afd->a_af == AF_INET6 &&
- ((const struct sockaddr_in6 *)sa)->sin6_scope_id) {
- char *p = numaddr + strlen(numaddr);
- const char *stringscope = NULL;
-#if 0
- if ((flags & NI_NUMERICSCOPE) == 0) {
- /*
- * Vendors may want to add support for
- * non-numeric scope identifier.
- */
- stringscope = foo;
- }
-#endif
- if (stringscope == NULL) {
- snprintf(p, sizeof(numaddr) - (p - numaddr),
- "%%%u",
- ((const struct sockaddr_in6 *)sa)->sin6_scope_id);
- } else {
- snprintf(p, sizeof(numaddr) - (p - numaddr),
- "%%%s", stringscope);
- }
- }
-#endif
- if (strlen(numaddr) + 1 > hostlen)
- ERR(ENI_MEMORY);
- strcpy(host, numaddr);
- } else {
- switch (family) {
- case AF_INET:
- lwf = LWRES_ADDRTYPE_V4;
- break;
- case AF_INET6:
- lwf = LWRES_ADDRTYPE_V6;
- break;
- default:
- INSIST(0);
- }
-
- n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (n == 0)
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
-
- if (n == 0)
- n = lwres_getnamebyaddr(lwrctx, lwf,
- (lwres_uint16_t)afd->a_addrlen,
- addr, &by);
- if (n == 0) {
- if (flags & NI_NOFQDN) {
- p = strchr(by->realname, '.');
- if (p)
- *p = '\0';
- }
- if ((strlen(by->realname) + 1) > hostlen)
- ERR(ENI_MEMORY);
- strcpy(host, by->realname);
- } else {
- if (flags & NI_NAMEREQD)
- ERR(ENI_NOHOSTNAME);
- if (lwres_net_ntop(afd->a_af, addr, numaddr,
- sizeof(numaddr))
- == NULL)
- ERR(ENI_NOHOSTNAME);
- if ((strlen(numaddr) + 1) > hostlen)
- ERR(ENI_MEMORY);
- strcpy(host, numaddr);
- }
- }
- result = SUCCESS;
- cleanup:
- if (by != NULL)
- lwres_gnbaresponse_free(lwrctx, &by);
- if (lwrctx != NULL) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- }
- return (result);
-}
diff --git a/usr.sbin/bind/lib/lwres/getrrset.c b/usr.sbin/bind/lib/lwres/getrrset.c
deleted file mode 100644
index 3b3803aa476..00000000000
--- a/usr.sbin/bind/lib/lwres/getrrset.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: getrrset.c,v 1.7 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * DESCRIPTION
- *
- * lwres_getrrsetbyname() gets a set of resource records associated with
- * a hostname, class, and type. hostname is a pointer a to
- * null-terminated string. The flags field is currently unused and must
- * be zero.
- *
- * After a successful call to lwres_getrrsetbyname(), *res is a pointer
- * to an #rrsetinfo structure, containing a list of one or more #rdatainfo
- * structures containing resource records and potentially another list of
- * rdatainfo structures containing SIG resource records associated with
- * those records. The members #rri_rdclass and #rri_rdtype are copied from
- * the parameters. #rri_ttl and #rri_name are properties of the obtained
- * rrset. The resource records contained in #rri_rdatas and #rri_sigs are
- * in uncompressed DNS wire format. Properties of the rdataset are
- * represented in the #rri_flags bitfield. If the #RRSET_VALIDATED bit is
- * set, the data has been DNSSEC validated and the signatures verified.
- *
- * All of the information returned by lwres_getrrsetbyname() is
- * dynamically allocated: the rrsetinfo and rdatainfo structures, and the
- * canonical host name strings pointed to by the rrsetinfostructure.
- * Memory allocated for the dynamically allocated structures created by a
- * successful call to lwres_getrrsetbyname() is released by
- * lwres_freerrset(). rrset is a pointer to a struct rrset created by a
- * call to lwres_getrrsetbyname().
- *
- * The following structures are used:
- *
- * \code
- * struct rdatainfo {
- * unsigned int rdi_length; // length of data
- * unsigned char *rdi_data; // record data
- * };
- *
- * struct rrsetinfo {
- * unsigned int rri_flags; // RRSET_VALIDATED...
- * unsigned int rri_rdclass; // class number
- * unsigned int rri_rdtype; // RR type number
- * unsigned int rri_ttl; // time to live
- * unsigned int rri_nrdatas; // size of rdatas array
- * unsigned int rri_nsigs; // size of sigs array
- * char *rri_name; // canonical name
- * struct rdatainfo *rri_rdatas; // individual records
- * struct rdatainfo *rri_sigs; // individual signatures
- * };
- * \endcode
- *
- * \section getrrset_return Return Values
- *
- * lwres_getrrsetbyname() returns zero on success, and one of the
- * following error codes if an error occurred:
- *
- * \li #ERRSET_NONAME: the name does not exist
- *
- * \li #ERRSET_NODATA:
- * the name exists, but does not have data of the desired type
- *
- * \li #ERRSET_NOMEMORY:
- * memory could not be allocated
- *
- * \li #ERRSET_INVAL:
- * a parameter is invalid
- *
- * \li #ERRSET_FAIL:
- * other failure
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include <lwres/lwres.h>
-#include <lwres/net.h>
-#include <lwres/netdb.h> /* XXX #include <netdb.h> */
-
-#include "assert_p.h"
-
-/*!
- * Structure to map results
- */
-static unsigned int
-lwresult_to_result(lwres_result_t lwresult) {
- switch (lwresult) {
- case LWRES_R_SUCCESS: return (ERRSET_SUCCESS);
- case LWRES_R_NOMEMORY: return (ERRSET_NOMEMORY);
- case LWRES_R_NOTFOUND: return (ERRSET_NONAME);
- case LWRES_R_TYPENOTFOUND: return (ERRSET_NODATA);
- default: return (ERRSET_FAIL);
- }
-}
-
-/*@{*/
-/*!
- * malloc / calloc functions that guarantee to only
- * return NULL if there is an error, like they used
- * to before the ANSI C committee broke them.
- */
-
-static void *
-sane_malloc(size_t size) {
- if (size == 0U)
- size = 1;
- return (malloc(size));
-}
-
-static void *
-sane_calloc(size_t number, size_t size) {
- size_t len = number * size;
- void *mem = sane_malloc(len);
- if (mem != NULL)
- memset(mem, 0, len);
- return (mem);
-}
-/*@}*/
-
-/*% Returns a set of resource records associated with a hostname, class, and type. hostname is a pointer a to null-terminated string. */
-int
-lwres_getrrsetbyname(const char *hostname, unsigned int rdclass,
- unsigned int rdtype, unsigned int flags,
- struct rrsetinfo **res)
-{
- lwres_context_t *lwrctx = NULL;
- lwres_result_t lwresult;
- lwres_grbnresponse_t *response = NULL;
- struct rrsetinfo *rrset = NULL;
- unsigned int i;
- unsigned int lwflags;
- unsigned int result;
-
- if (rdclass > 0xffff || rdtype > 0xffff) {
- result = ERRSET_INVAL;
- goto fail;
- }
-
- /*
- * Don't allow queries of class or type ANY
- */
- if (rdclass == 0xff || rdtype == 0xff) {
- result = ERRSET_INVAL;
- goto fail;
- }
-
- lwresult = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
- if (lwresult != LWRES_R_SUCCESS) {
- result = lwresult_to_result(lwresult);
- goto fail;
- }
- (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
-
- /*
- * If any input flags were defined, lwflags would be set here
- * based on them
- */
- UNUSED(flags);
- lwflags = 0;
-
- lwresult = lwres_getrdatabyname(lwrctx, hostname,
- (lwres_uint16_t)rdclass,
- (lwres_uint16_t)rdtype,
- lwflags, &response);
- if (lwresult != LWRES_R_SUCCESS) {
- result = lwresult_to_result(lwresult);
- goto fail;
- }
-
- rrset = sane_malloc(sizeof(struct rrsetinfo));
- if (rrset == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
- }
- rrset->rri_name = NULL;
- rrset->rri_rdclass = response->rdclass;
- rrset->rri_rdtype = response->rdtype;
- rrset->rri_ttl = response->ttl;
- rrset->rri_flags = 0;
- rrset->rri_nrdatas = 0;
- rrset->rri_rdatas = NULL;
- rrset->rri_nsigs = 0;
- rrset->rri_sigs = NULL;
-
- rrset->rri_name = sane_malloc(response->realnamelen + 1);
- if (rrset->rri_name == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
- }
- strncpy(rrset->rri_name, response->realname, response->realnamelen);
- rrset->rri_name[response->realnamelen] = 0;
-
- if ((response->flags & LWRDATA_VALIDATED) != 0)
- rrset->rri_flags |= RRSET_VALIDATED;
-
- rrset->rri_nrdatas = response->nrdatas;
- rrset->rri_rdatas = sane_calloc(rrset->rri_nrdatas,
- sizeof(struct rdatainfo));
- if (rrset->rri_rdatas == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
- }
- for (i = 0; i < rrset->rri_nrdatas; i++) {
- rrset->rri_rdatas[i].rdi_length = response->rdatalen[i];
- rrset->rri_rdatas[i].rdi_data =
- sane_malloc(rrset->rri_rdatas[i].rdi_length);
- if (rrset->rri_rdatas[i].rdi_data == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
- }
- memmove(rrset->rri_rdatas[i].rdi_data, response->rdatas[i],
- rrset->rri_rdatas[i].rdi_length);
- }
- rrset->rri_nsigs = response->nsigs;
- rrset->rri_sigs = sane_calloc(rrset->rri_nsigs,
- sizeof(struct rdatainfo));
- if (rrset->rri_sigs == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
- }
- for (i = 0; i < rrset->rri_nsigs; i++) {
- rrset->rri_sigs[i].rdi_length = response->siglen[i];
- rrset->rri_sigs[i].rdi_data =
- sane_malloc(rrset->rri_sigs[i].rdi_length);
- if (rrset->rri_sigs[i].rdi_data == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
- }
- memmove(rrset->rri_sigs[i].rdi_data, response->sigs[i],
- rrset->rri_sigs[i].rdi_length);
- }
-
- lwres_grbnresponse_free(lwrctx, &response);
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- *res = rrset;
- return (ERRSET_SUCCESS);
- fail:
- if (rrset != NULL)
- lwres_freerrset(rrset);
- if (response != NULL)
- lwres_grbnresponse_free(lwrctx, &response);
- if (lwrctx != NULL) {
- lwres_conf_clear(lwrctx);
- lwres_context_destroy(&lwrctx);
- }
- return (result);
-}
-
-/*% Releases memory allocated for the dynamically allocated structures created by a successful call to lwres_getrrsetbyname(). */
-void
-lwres_freerrset(struct rrsetinfo *rrset) {
- unsigned int i;
- if (rrset->rri_rdatas != NULL) {
- for (i = 0; i < rrset->rri_nrdatas; i++) {
- if (rrset->rri_rdatas[i].rdi_data == NULL)
- break;
- free(rrset->rri_rdatas[i].rdi_data);
- }
- free(rrset->rri_rdatas);
- }
- if (rrset->rri_sigs != NULL) {
- for (i = 0; i < rrset->rri_nsigs; i++) {
- if (rrset->rri_sigs[i].rdi_data == NULL)
- break;
- free(rrset->rri_sigs[i].rdi_data);
- }
- free(rrset->rri_sigs);
- }
- free(rrset->rri_name);
- free(rrset);
-}
diff --git a/usr.sbin/bind/lib/lwres/herror.c b/usr.sbin/bind/lib/lwres/herror.c
deleted file mode 100644
index 1039fdf4338..00000000000
--- a/usr.sbin/bind/lib/lwres/herror.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1987, 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 herror.c
- lwres_herror() prints the string s on stderr followed by the string
- generated by lwres_hstrerror() for the error code stored in the global
- variable lwres_h_errno.
-
- lwres_hstrerror() returns an appropriate string for the error code
- gievn by err. The values of the error codes and messages are as
- follows:
-
-\li #NETDB_SUCCESS: Resolver Error 0 (no error)
-
-\li #HOST_NOT_FOUND: Unknown host
-
-\li #TRY_AGAIN: Host name lookup failure
-
-\li #NO_RECOVERY: Unknown server error
-
-\li #NO_DATA: No address associated with name
-
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] =
- "$Id: herror.c,v 1.7 2019/12/17 01:46:38 sthen Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <isc/print.h>
-
-#include <lwres/netdb.h>
-#include <lwres/platform.h>
-
-LIBLWRES_EXTERNAL_DATA int lwres_h_errno;
-
-/*!
- * these have never been declared in any header file so make them static
- */
-
-static const char *h_errlist[] = {
- "Resolver Error 0 (no error)", /*%< 0 no error */
- "Unknown host", /*%< 1 HOST_NOT_FOUND */
- "Host name lookup failure", /*%< 2 TRY_AGAIN */
- "Unknown server error", /*%< 3 NO_RECOVERY */
- "No address associated with name", /*%< 4 NO_ADDRESS */
-};
-
-static int h_nerr = sizeof(h_errlist) / sizeof(h_errlist[0]);
-
-
-/*!
- * herror --
- * print the error indicated by the h_errno value.
- */
-void
-lwres_herror(const char *s) {
- fprintf(stderr, "%s: %s\n", s, lwres_hstrerror(lwres_h_errno));
-}
-
-/*!
- * hstrerror --
- * return the string associated with a given "host" errno value.
- */
-const char *
-lwres_hstrerror(int err) {
- if (err < 0)
- return ("Resolver internal error");
- else if (err < h_nerr)
- return (h_errlist[err]);
- return ("Unknown resolver error");
-}
diff --git a/usr.sbin/bind/lib/lwres/include/Makefile.in b/usr.sbin/bind/lib/lwres/include/Makefile.in
deleted file mode 100644
index 6015951061e..00000000000
--- a/usr.sbin/bind/lib/lwres/include/Makefile.in
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:38 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-SUBDIRS = lwres
-TARGETS =
-
-@BIND9_MAKE_RULES@
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/Makefile.in b/usr.sbin/bind/lib/lwres/include/lwres/Makefile.in
deleted file mode 100644
index f5c3b8eb071..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/Makefile.in
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-#
-# Only list headers that are to be installed and are not
-# machine generated. The latter are handled specially in the
-# install target below.
-#
-HEADERS = context.h int.h ipv6.h lang.h list.h \
- lwbuffer.h lwpacket.h lwres.h result.h \
- stdlib.h string.h version.h
-
-SUBDIRS =
-TARGETS =
-
-@BIND9_MAKE_RULES@
-
-installdirs:
- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/lwres
-
-install:: installdirs
- for i in ${HEADERS}; do \
- ${INSTALL_DATA} ${srcdir}/$$i ${DESTDIR}${includedir}/lwres ; \
- done
- ${INSTALL_DATA} netdb.h ${DESTDIR}${includedir}/lwres
- ${INSTALL_DATA} platform.h ${DESTDIR}${includedir}/lwres
-
-uninstall::
- rm -f ${DESTDIR}${includedir}/lwres/platform.h
- rm -f ${DESTDIR}${includedir}/lwres/netdb.h
- for i in ${HEADERS}; do \
- rm -f ${DESTDIR}${includedir}/lwres/$$i ; \
- done
-
-distclean::
- rm -f netdb.h platform.h
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/context.h b/usr.sbin/bind/lib/lwres/include/lwres/context.h
deleted file mode 100644
index 9febdff7bf0..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/context.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: context.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_CONTEXT_H
-#define LWRES_CONTEXT_H 1
-
-/*! \file lwres/context.h */
-
-#include <stddef.h>
-
-#include <lwres/lang.h>
-#include <lwres/int.h>
-#include <lwres/result.h>
-
-/*!
- * Used to set various options such as timeout, authentication, etc
- */
-typedef struct lwres_context lwres_context_t;
-
-LWRES_LANG_BEGINDECLS
-
-typedef void *(*lwres_malloc_t)(void *arg, size_t length);
-typedef void (*lwres_free_t)(void *arg, void *mem, size_t length);
-
-/*
- * XXXMLG
- *
- * Make the server reload /etc/resolv.conf periodically.
- *
- * Make the server do sortlist/searchlist.
- *
- * Client side can disable the search/sortlist processing.
- *
- * Use an array of addresses/masks and searchlist for client-side, and
- * if added to the client disable the processing on the server.
- *
- * Share /etc/resolv.conf data between contexts.
- */
-
-/*!
- * _SERVERMODE
- * Don't allocate and connect a socket to the server, since the
- * caller _is_ a server.
- *
- * _USEIPV4, _USEIPV6
- * Use IPv4 and IPv6 transactions with remote servers, respectively.
- * For backward compatibility, regard both flags as being set when both
- * are cleared.
- */
-#define LWRES_CONTEXT_SERVERMODE 0x00000001U
-#define LWRES_CONTEXT_USEIPV4 0x00000002U
-#define LWRES_CONTEXT_USEIPV6 0x00000004U
-
-lwres_result_t
-lwres_context_create(lwres_context_t **contextp, void *arg,
- lwres_malloc_t malloc_function,
- lwres_free_t free_function,
- unsigned int flags);
-/**<
- * Allocate a lwres context. This is used in all lwres calls.
- *
- * Memory management can be replaced here by passing in two functions.
- * If one is non-NULL, they must both be non-NULL. "arg" is passed to
- * these functions.
- *
- * Contexts are not thread safe. Document at the top of the file.
- * XXXMLG
- *
- * If they are NULL, the standard malloc() and free() will be used.
- *
- *\pre contextp != NULL && contextp == NULL.
- *
- *\return Returns 0 on success, non-zero on failure.
- */
-
-void
-lwres_context_destroy(lwres_context_t **contextp);
-/**<
- * Frees all memory associated with a lwres context.
- *
- *\pre contextp != NULL && contextp == NULL.
- */
-
-lwres_uint32_t
-lwres_context_nextserial(lwres_context_t *ctx);
-/**<
- * XXXMLG Document
- */
-
-void
-lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial);
-
-void
-lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len);
-
-void *
-lwres_context_allocmem(lwres_context_t *ctx, size_t len);
-
-int
-lwres_context_getsocket(lwres_context_t *ctx);
-
-lwres_result_t
-lwres_context_send(lwres_context_t *ctx,
- void *sendbase, int sendlen);
-
-lwres_result_t
-lwres_context_recv(lwres_context_t *ctx,
- void *recvbase, int recvlen,
- int *recvd_len);
-
-lwres_result_t
-lwres_context_sendrecv(lwres_context_t *ctx,
- void *sendbase, int sendlen,
- void *recvbase, int recvlen,
- int *recvd_len);
-
-LWRES_LANG_ENDDECLS
-
-#endif /* LWRES_CONTEXT_H */
-
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/int.h b/usr.sbin/bind/lib/lwres/include/lwres/int.h
deleted file mode 100644
index 21194e4966e..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/int.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: int.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_INT_H
-#define LWRES_INT_H 1
-
-/*! \file lwres/int.h */
-
-typedef char lwres_int8_t;
-typedef unsigned char lwres_uint8_t;
-typedef short lwres_int16_t;
-typedef unsigned short lwres_uint16_t;
-typedef int lwres_int32_t;
-typedef unsigned int lwres_uint32_t;
-typedef long long lwres_int64_t;
-typedef unsigned long long lwres_uint64_t;
-
-#endif /* LWRES_INT_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/ipv6.h b/usr.sbin/bind/lib/lwres/include/lwres/ipv6.h
deleted file mode 100644
index 9d38295e4fe..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/ipv6.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: ipv6.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_IPV6_H
-#define LWRES_IPV6_H 1
-
-/*****
- ***** Module Info
- *****/
-
-/*! \file lwres/ipv6.h
- * IPv6 definitions for systems which do not support IPv6.
- */
-
-/***
- *** Imports.
- ***/
-
-#include <lwres/int.h>
-#include <lwres/platform.h>
-
-/***
- *** Types.
- ***/
-
-/*% in6_addr structure */
-struct in6_addr {
- union {
- lwres_uint8_t _S6_u8[16];
- lwres_uint16_t _S6_u16[8];
- lwres_uint32_t _S6_u32[4];
- } _S6_un;
-};
-/*@{*/
-/*% IP v6 types */
-#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 }}}
-
-LIBLWRES_EXTERNAL_DATA extern const struct in6_addr in6addr_any;
-LIBLWRES_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback;
-
-/*% used in getaddrinfo.c and getnameinfo.c */
-struct sockaddr_in6 {
-#ifdef LWRES_PLATFORM_HAVESALEN
- lwres_uint8_t sin6_len;
- lwres_uint8_t sin6_family;
-#else
- lwres_uint16_t sin6_family;
-#endif
- lwres_uint16_t sin6_port;
- lwres_uint32_t sin6_flowinfo;
- struct in6_addr sin6_addr;
- lwres_uint32_t sin6_scope_id;
-};
-
-#ifdef LWRES_PLATFORM_HAVESALEN
-#define SIN6_LEN 1
-#endif
-
-/*% in6_pktinfo structure */
-struct in6_pktinfo {
- struct in6_addr ipi6_addr; /*%< src/dst IPv6 address */
- unsigned int ipi6_ifindex; /*%< send/recv interface index */
-};
-
-/*!
- * Unspecified IPv6 address
- */
-#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)))
-
-#endif /* LWRES_IPV6_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/lang.h b/usr.sbin/bind/lib/lwres/include/lwres/lang.h
deleted file mode 100644
index d0789eee6b5..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/lang.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lang.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_LANG_H
-#define LWRES_LANG_H 1
-
-/*! \file lwres/lang.h */
-
-#ifdef __cplusplus
-#define LWRES_LANG_BEGINDECLS extern "C" {
-#define LWRES_LANG_ENDDECLS }
-#else
-#define LWRES_LANG_BEGINDECLS
-#define LWRES_LANG_ENDDECLS
-#endif
-
-#endif /* LWRES_LANG_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/lwbuffer.h b/usr.sbin/bind/lib/lwres/include/lwres/lwbuffer.h
deleted file mode 100644
index 0fb841d9ac7..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/lwbuffer.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwbuffer.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-
-/*! \file lwres/lwbuffer.h
- *
- * A buffer is a region of memory, together with a set of related subregions.
- * Buffers are used for parsing and I/O operations.
- *
- * The 'used region' and the 'available' region are disjoint, and their
- * union is the buffer's region. The used region extends from the beginning
- * of the buffer region to the last used byte. The available region
- * extends from one byte greater than the last used byte to the end of the
- * buffer's region. The size of the used region can be changed using various
- * buffer commands. Initially, the used region is empty.
- *
- * The used region is further subdivided into two disjoint regions: the
- * 'consumed region' and the 'remaining region'. The union of these two
- * regions is the used region. The consumed region extends from the beginning
- * of the used region to the byte before the 'current' offset (if any). The
- * 'remaining' region the current pointer to the end of the used
- * region. The size of the consumed region can be changed using various
- * buffer commands. Initially, the consumed region is empty.
- *
- * The 'active region' is an (optional) subregion of the remaining region.
- * It extends from the current offset to an offset in the remaining region
- * that is selected with lwres_buffer_setactive(). Initially, the active
- * region is empty. If the current offset advances beyond the chosen offset,
- * the active region will also be empty.
- *
- * \verbatim
- * /----- used region -----\/-- available --\
- * +----------------------------------------+
- * | consumed | remaining | |
- * +----------------------------------------+
- * a b c d e
- *
- * a == base of buffer.
- * b == current pointer. Can be anywhere between a and d.
- * c == active pointer. Meaningful between b and d.
- * d == used pointer.
- * e == length of buffer.
- *
- * a-e == entire (length) of buffer.
- * a-d == used region.
- * a-b == consumed region.
- * b-d == remaining region.
- * b-c == optional active region.
- * \endverbatim
- *
- * The following invariants are maintained by all routines:
- *
- *\verbatim
- * length > 0
- *
- * base is a valid pointer to length bytes of memory
- *
- * 0 <= used <= length
- *
- * 0 <= current <= used
- *
- * 0 <= active <= used
- * (although active < current implies empty active region)
- *\endverbatim
- *
- * \li MP:
- * Buffers have no synchronization. Clients must ensure exclusive
- * access.
- *
- * \li Reliability:
- * No anticipated impact.
- *
- * \li Resources:
- * Memory: 1 pointer + 6 unsigned integers per buffer.
- *
- * \li Security:
- * No anticipated impact.
- *
- * \li Standards:
- * None.
- */
-
-#ifndef LWRES_LWBUFFER_H
-#define LWRES_LWBUFFER_H 1
-
-/***
- *** Imports
- ***/
-
-#include <lwres/lang.h>
-#include <lwres/int.h>
-
-LWRES_LANG_BEGINDECLS
-
-/***
- *** Magic numbers
- ***/
-#define LWRES_BUFFER_MAGIC 0x4275663fU /* Buf?. */
-
-#define LWRES_BUFFER_VALID(b) ((b) != NULL && \
- (b)->magic == LWRES_BUFFER_MAGIC)
-
-/*!
- * The following macros MUST be used only on valid buffers. It is the
- * caller's responsibility to ensure this by using the LWRES_BUFFER_VALID
- * check above, or by calling another lwres_buffer_*() function (rather than
- * another macro.)
- */
-
-/*!
- * Get the length of the used region of buffer "b"
- */
-#define LWRES_BUFFER_USEDCOUNT(b) ((b)->used)
-
-/*!
- * Get the length of the available region of buffer "b"
- */
-#define LWRES_BUFFER_AVAILABLECOUNT(b) ((b)->length - (b)->used)
-
-#define LWRES_BUFFER_REMAINING(b) ((b)->used - (b)->current)
-
-/*!
- * Note that the buffer structure is public. This is principally so buffer
- * operations can be implemented using macros. Applications are strongly
- * discouraged from directly manipulating the structure.
- */
-
-typedef struct lwres_buffer lwres_buffer_t;
-/*!
- * Buffer data structure
- */
-struct lwres_buffer {
- unsigned int magic;
- unsigned char *base;
- /* The following integers are byte offsets from 'base'. */
- unsigned int length;
- unsigned int used;
- unsigned int current;
- unsigned int active;
-};
-
-/***
- *** Functions
- ***/
-
-void
-lwres_buffer_init(lwres_buffer_t *b, void *base, unsigned int length);
-/**<
- * Make 'b' refer to the 'length'-byte region starting at base.
- *
- * Requires:
- *
- * 'length' > 0
- *
- * 'base' is a pointer to a sequence of 'length' bytes.
- *
- */
-
-void
-lwres_buffer_invalidate(lwres_buffer_t *b);
-/**<
- * Make 'b' an invalid buffer.
- *
- * Requires:
- * 'b' is a valid buffer.
- *
- * Ensures:
- * If assertion checking is enabled, future attempts to use 'b' without
- * calling lwres_buffer_init() on it will cause an assertion failure.
- */
-
-void
-lwres_buffer_add(lwres_buffer_t *b, unsigned int n);
-/**<
- * Increase the 'used' region of 'b' by 'n' bytes.
- *
- * Requires:
- *
- * 'b' is a valid buffer
- *
- * used + n <= length
- *
- */
-
-void
-lwres_buffer_subtract(lwres_buffer_t *b, unsigned int n);
-/**<
- * Decrease the 'used' region of 'b' by 'n' bytes.
- *
- * Requires:
- *
- * 'b' is a valid buffer
- *
- * used >= n
- *
- */
-
-void
-lwres_buffer_clear(lwres_buffer_t *b);
-/**<
- * Make the used region empty.
- *
- * Requires:
- *
- * 'b' is a valid buffer
- *
- * Ensures:
- *
- * used = 0
- *
- */
-
-
-void
-lwres_buffer_first(lwres_buffer_t *b);
-/**<
- * Make the consumed region empty.
- *
- * Requires:
- *
- * 'b' is a valid buffer
- *
- * Ensures:
- *
- * current == 0
- *
- */
-
-void
-lwres_buffer_forward(lwres_buffer_t *b, unsigned int n);
-/**<
- * Increase the 'consumed' region of 'b' by 'n' bytes.
- *
- * Requires:
- *
- * 'b' is a valid buffer
- *
- * current + n <= used
- *
- */
-
-void
-lwres_buffer_back(lwres_buffer_t *b, unsigned int n);
-/**<
- * Decrease the 'consumed' region of 'b' by 'n' bytes.
- *
- * Requires:
- *
- * 'b' is a valid buffer
- *
- * n <= current
- *
- */
-
-lwres_uint8_t
-lwres_buffer_getuint8(lwres_buffer_t *b);
-/**<
- * Read an unsigned 8-bit integer from 'b' and return it.
- *
- * Requires:
- *
- * 'b' is a valid buffer.
- *
- * The length of the available region of 'b' is at least 1.
- *
- * Ensures:
- *
- * The current pointer in 'b' is advanced by 1.
- *
- * Returns:
- *
- * A 8-bit unsigned integer.
- */
-
-void
-lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val);
-/**<
- * Store an unsigned 8-bit integer from 'val' into 'b'.
- *
- * Requires:
- * 'b' is a valid buffer.
- *
- * The length of the unused region of 'b' is at least 1.
- *
- * Ensures:
- * The used pointer in 'b' is advanced by 1.
- */
-
-lwres_uint16_t
-lwres_buffer_getuint16(lwres_buffer_t *b);
-/**<
- * Read an unsigned 16-bit integer in network byte order from 'b', convert
- * it to host byte order, and return it.
- *
- * Requires:
- *
- * 'b' is a valid buffer.
- *
- * The length of the available region of 'b' is at least 2.
- *
- * Ensures:
- *
- * The current pointer in 'b' is advanced by 2.
- *
- * Returns:
- *
- * A 16-bit unsigned integer.
- */
-
-void
-lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val);
-/**<
- * Store an unsigned 16-bit integer in host byte order from 'val'
- * into 'b' in network byte order.
- *
- * Requires:
- * 'b' is a valid buffer.
- *
- * The length of the unused region of 'b' is at least 2.
- *
- * Ensures:
- * The used pointer in 'b' is advanced by 2.
- */
-
-lwres_uint32_t
-lwres_buffer_getuint32(lwres_buffer_t *b);
-/**<
- * Read an unsigned 32-bit integer in network byte order from 'b', convert
- * it to host byte order, and return it.
- *
- * Requires:
- *
- * 'b' is a valid buffer.
- *
- * The length of the available region of 'b' is at least 2.
- *
- * Ensures:
- *
- * The current pointer in 'b' is advanced by 2.
- *
- * Returns:
- *
- * A 32-bit unsigned integer.
- */
-
-void
-lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val);
-/**<
- * Store an unsigned 32-bit integer in host byte order from 'val'
- * into 'b' in network byte order.
- *
- * Requires:
- * 'b' is a valid buffer.
- *
- * The length of the unused region of 'b' is at least 4.
- *
- * Ensures:
- * The used pointer in 'b' is advanced by 4.
- */
-
-void
-lwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base,
- unsigned int length);
-/**<
- * Copy 'length' bytes of memory at 'base' into 'b'.
- *
- * Requires:
- * 'b' is a valid buffer.
- *
- * 'base' points to 'length' bytes of valid memory.
- *
- */
-
-void
-lwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base,
- unsigned int length);
-/**<
- * Copy 'length' bytes of memory from 'b' into 'base'.
- *
- * Requires:
- * 'b' is a valid buffer.
- *
- * 'base' points to at least 'length' bytes of valid memory.
- *
- * 'b' have at least 'length' bytes remaining.
- */
-
-LWRES_LANG_ENDDECLS
-
-#endif /* LWRES_LWBUFFER_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/lwpacket.h b/usr.sbin/bind/lib/lwres/include/lwres/lwpacket.h
deleted file mode 100644
index eea0a0a60da..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/lwpacket.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwpacket.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_LWPACKET_H
-#define LWRES_LWPACKET_H 1
-
-#include <lwres/lang.h>
-#include <lwres/lwbuffer.h>
-#include <lwres/result.h>
-
-/*% lwres_lwpacket_t */
-typedef struct lwres_lwpacket lwres_lwpacket_t;
-
-/*% lwres_lwpacket structure */
-struct lwres_lwpacket {
- /*! The overall packet length, including the
- * entire packet header.
- * This field is filled in by the
- * \link lwres_gabn.c lwres_gabn_*()\endlink
- * and \link lwres_gnba.c lwres_gnba_*()\endlink calls.
- */
- lwres_uint32_t length;
- /*! Specifies the header format. Currently,
- * there is only one format, #LWRES_LWPACKETVERSION_0.
- * This field is filled in by the
- * \link lwres_gabn.c lwres_gabn_*()\endlink
- * and \link lwres_gnba.c lwres_gnba_*()\endlink calls.
- */
- lwres_uint16_t version;
- /*! Specifies library-defined flags for this packet, such as
- * whether the packet is a request or a reply. None of
- * these are definable by the caller, but library-defined values
- * can be set by the caller. For example, one bit in this field
- * indicates if the packet is a request or a response.
- * This field is filled in by
- * the application wits the exception of the
- * #LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library
- * in the
- * \link lwres_gabn.c lwres_gabn_*()\endlink
- * and \link lwres_gnba.c lwres_gnba_*()\endlink calls.
- */
- lwres_uint16_t pktflags;
- /*! Set by the requestor and is returned in all replies.
- * If two packets from the same source have the same serial
- * number and are from the same source, they are assumed to
- * be duplicates and the latter ones may be dropped.
- * (The library does not do this by default on replies, but
- * does so on requests.)
- */
- lwres_uint32_t serial;
- /*! Opcodes between 0x04000000 and 0xffffffff
- * are application defined. Opcodes between
- * 0x00000000 and 0x03ffffff are
- * reserved for library use.
- * This field is filled in by the
- * \link lwres_gabn.c lwres_gabn_*()\endlink
- * and \link lwres_gnba.c lwres_gnba_*()\endlink calls.
- */
- lwres_uint32_t opcode;
- /*! Only valid for results.
- * Results between 0x04000000 and 0xffffffff are application
- * defined.
- * Results between 0x00000000 and 0x03ffffff are reserved for
- * library use.
- * (This is the same reserved range defined in <isc/resultclass.h>,
- * so it
- * would be trivial to map ISC_R_* result codes into packet result
- * codes when appropriate.)
- * This field is filled in by the
- * \link lwres_gabn.c lwres_gabn_*()\endlink
- * and \link lwres_gnba.c lwres_gnba_*()\endlink calls.
- */
- lwres_uint32_t result;
- /*! Set to the maximum buffer size that the receiver can
- * handle on requests, and the size of the buffer needed to
- * satisfy a request
- * when the buffer is too large for replies.
- * This field is supplied by the application.
- */
- lwres_uint32_t recvlength;
- /*! The packet level auth type used.
- * Authtypes between 0x1000 and 0xffff are application defined.
- * Authtypes
- * between 0x0000 and 0x0fff are reserved for library use.
- * This is currently
- * unused and MUST be set to zero.
- */
- lwres_uint16_t authtype;
- /*! The length of the authentication data.
- * See the specific
- * authtypes for more information on what is contained
- * in this field. This is currently unused, and
- * MUST be set to zero.
- */
- lwres_uint16_t authlength;
-};
-
-#define LWRES_LWPACKET_LENGTH (4 * 5 + 2 * 4) /*%< Overall length. */
-
-#define LWRES_LWPACKETFLAG_RESPONSE 0x0001U /*%< If set, pkt is a response. */
-
-
-#define LWRES_LWPACKETVERSION_0 0 /*%< Header format. */
-
-/*! \file lwres/lwpacket.h
- *
- *
- * The remainder of the packet consists of two regions, one described by
- * "authlen" and one of "length - authlen - sizeof(lwres_lwpacket_t)".
- *
- * That is:
- *
- * \code
- * pkt header
- * authlen bytes of auth information
- * data bytes
- * \endcode
- *
- * Currently defined opcodes:
- *
- *\li #LWRES_OPCODE_NOOP. Success is always returned, with the packet contents echoed.
- *
- *\li #LWRES_OPCODE_GETADDRSBYNAME. Return all known addresses for a given name.
- * This may return NIS or /etc/hosts info as well as DNS
- * information. Flags will be provided to indicate ip4/ip6
- * addresses are desired.
- *
- *\li #LWRES_OPCODE_GETNAMEBYADDR. Return the hostname for the given address. Once
- * again, it will return data from multiple sources.
- */
-
-LWRES_LANG_BEGINDECLS
-
-/* XXXMLG document */
-lwres_result_t
-lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);
-
-lwres_result_t
-lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);
-
-LWRES_LANG_ENDDECLS
-
-#endif /* LWRES_LWPACKET_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/lwres.h b/usr.sbin/bind/lib/lwres/include/lwres/lwres.h
index f79da529fd5..2f64da0807d 100644
--- a/usr.sbin/bind/lib/lwres/include/lwres/lwres.h
+++ b/usr.sbin/bind/lib/lwres/include/lwres/lwres.h
@@ -14,18 +14,22 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwres.h,v 1.4 2019/12/17 01:46:38 sthen Exp $ */
+/* $Id: lwres.h,v 1.5 2020/01/06 17:41:29 florian Exp $ */
#ifndef LWRES_LWRES_H
#define LWRES_LWRES_H 1
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+
#include <stdio.h>
-#include <lwres/context.h>
-#include <lwres/lang.h>
#include <lwres/list.h>
-#include <lwres/lwpacket.h>
-#include <lwres/platform.h>
+#include <lwres/result.h>
/*! \file lwres/lwres.h */
@@ -79,35 +83,7 @@
* response_free().
*/
-#define LWRES_UDP_PORT 921 /*%< UDP Port Number */
-#define LWRES_RECVLENGTH 16384 /*%< Maximum Packet Length */
#define LWRES_ADDR_MAXLEN 16 /*%< changing this breaks ABI */
-#define LWRES_RESOLV_CONF "/etc/resolv.conf" /*%< Location of resolv.conf */
-
-/*% DNSSEC is not required (input). Only relevant to rrset queries. */
-#define LWRES_FLAG_TRUSTNOTREQUIRED 0x00000001U
-/*% The data was crypto-verified with DNSSEC (output). */
-#define LWRES_FLAG_SECUREDATA 0x00000002U
-
-/*% no-op */
-#define LWRES_OPCODE_NOOP 0x00000000U
-
-/*% lwres_nooprequest_t */
-typedef struct {
- /* public */
- lwres_uint16_t datalength;
- unsigned char *data;
-} lwres_nooprequest_t;
-
-/*% lwres_noopresponse_t */
-typedef struct {
- /* public */
- lwres_uint16_t datalength;
- unsigned char *data;
-} lwres_noopresponse_t;
-
-/*% get addresses by name */
-#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
/*% lwres_addr_t */
typedef struct lwres_addr lwres_addr_t;
@@ -117,98 +93,13 @@ typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
/*% lwres_addr */
struct lwres_addr {
- lwres_uint32_t family;
- lwres_uint16_t length;
+ uint32_t family;
+ uint16_t length;
unsigned char address[LWRES_ADDR_MAXLEN];
- lwres_uint32_t zone;
+ uint32_t zone;
LWRES_LINK(lwres_addr_t) link;
};
-/*% lwres_gabnrequest_t */
-typedef struct {
- /* public */
- lwres_uint32_t flags;
- lwres_uint32_t addrtypes;
- lwres_uint16_t namelen;
- char *name;
-} lwres_gabnrequest_t;
-
-/*% lwres_gabnresponse_t */
-typedef struct {
- /* public */
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- lwres_addrlist_t addrs;
- /*! if base != NULL, it will be freed when this structure is freed. */
- void *base;
- size_t baselen;
-} lwres_gabnresponse_t;
-
-/*% get name by address */
-#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
-
-/*% lwres_gnbarequest_t */
-typedef struct {
- /* public */
- lwres_uint32_t flags;
- lwres_addr_t addr;
-} lwres_gnbarequest_t;
-
-/*% lwres_gnbaresponse_t */
-typedef struct {
- /* public */
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- /*! if base != NULL, it will be freed when this structure is freed. */
- void *base;
- size_t baselen;
-} lwres_gnbaresponse_t;
-
-/*% get rdata by name */
-#define LWRES_OPCODE_GETRDATABYNAME 0x00010003U
-
-/*% lwres_grbnrequest_t */
-typedef struct {
- /* public */
- lwres_uint32_t flags;
- lwres_uint16_t rdclass;
- lwres_uint16_t rdtype;
- lwres_uint16_t namelen;
- char *name;
-} lwres_grbnrequest_t;
-
-/*% lwres_grbnresponse_t */
-typedef struct {
- /* public */
- lwres_uint32_t flags;
- lwres_uint16_t rdclass;
- lwres_uint16_t rdtype;
- lwres_uint32_t ttl;
- lwres_uint16_t nrdatas;
- lwres_uint16_t nsigs;
- char *realname;
- lwres_uint16_t realnamelen;
- unsigned char **rdatas;
- lwres_uint16_t *rdatalen;
- unsigned char **sigs;
- lwres_uint16_t *siglen;
- /*% if base != NULL, it will be freed when this structure is freed. */
- void *base;
- size_t baselen;
-} lwres_grbnresponse_t;
-
-/*% Used by lwres_getrrsetbyname() */
-#define LWRDATA_VALIDATED 0x00000001
-
/*!
* resolv.conf data
*/
@@ -221,28 +112,27 @@ typedef struct {
/*% lwres_conf_t */
typedef struct {
- lwres_context_t *lwctx;
lwres_addr_t nameservers[LWRES_CONFMAXNAMESERVERS];
- lwres_uint8_t nsnext; /*%< index for next free slot */
+ uint8_t nsnext; /*%< index for next free slot */
lwres_addr_t lwservers[LWRES_CONFMAXLWSERVERS];
- lwres_uint8_t lwnext; /*%< index for next free slot */
+ uint8_t lwnext; /*%< index for next free slot */
char *domainname;
char *search[LWRES_CONFMAXSEARCH];
- lwres_uint8_t searchnxt; /*%< index for next free slot */
+ uint8_t searchnxt; /*%< index for next free slot */
struct {
lwres_addr_t addr;
/*% mask has a non-zero 'family' and 'length' if set */
lwres_addr_t mask;
} sortlist[LWRES_CONFMAXSORTLIST];
- lwres_uint8_t sortlistnxt;
+ uint8_t sortlistnxt;
- lwres_uint8_t resdebug; /*%< non-zero if 'options debug' set */
- lwres_uint8_t ndots; /*%< set to n in 'options ndots:n' */
- lwres_uint8_t no_tld_query; /*%< non-zero if 'options no_tld_query' */
+ uint8_t resdebug; /*%< non-zero if 'options debug' set */
+ uint8_t ndots; /*%< set to n in 'options ndots:n' */
+ uint8_t no_tld_query; /*%< non-zero if 'options no_tld_query' */
} lwres_conf_t;
#define LWRES_ADDRTYPE_V4 0x00000001U /*%< ipv4 */
@@ -251,255 +141,16 @@ typedef struct {
#define LWRES_MAX_ALIASES 16 /*%< max # of aliases */
#define LWRES_MAX_ADDRS 64 /*%< max # of addrs */
-LWRES_LANG_BEGINDECLS
-
-/*% This is in host byte order. */
-LIBLWRES_EXTERNAL_DATA extern lwres_uint16_t lwres_udp_port;
-
-LIBLWRES_EXTERNAL_DATA extern const char *lwres_resolv_conf;
-
-lwres_result_t
-lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);
-
-lwres_result_t
-lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt,
- lwres_gabnresponse_t **structp);
-
-void
-lwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp);
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-void
-lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp);
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-
-lwres_result_t
-lwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);
-
-lwres_result_t
-lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt,
- lwres_gnbaresponse_t **structp);
-
-void
-lwres_gnbarequest_free(lwres_context_t *ctx, lwres_gnbarequest_t **structp);
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-void
-lwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-lwres_result_t
-lwres_grbnrequest_render(lwres_context_t *ctx, lwres_grbnrequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_grbnresponse_render(lwres_context_t *ctx, lwres_grbnresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_grbnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_grbnrequest_t **structp);
+extern const char *lwres_resolv_conf;
lwres_result_t
-lwres_grbnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt,
- lwres_grbnresponse_t **structp);
-
-void
-lwres_grbnrequest_free(lwres_context_t *ctx, lwres_grbnrequest_t **structp);
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-void
-lwres_grbnresponse_free(lwres_context_t *ctx, lwres_grbnresponse_t **structp);
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-lwres_result_t
-lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-/**<
- * Allocate space and render into wire format a noop request packet.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * b != NULL, and points to a lwres_buffer_t. The contents of the
- * buffer structure will be initialized to contain the wire-format
- * noop request packet.
- *
- * Caller needs to fill in parts of "pkt" before calling:
- * serial, maxrecv, result.
- *
- * Returns:
- *
- * Returns 0 on success, non-zero on failure.
- *
- * On successful return, *b will contain data about the wire-format
- * packet. It can be transmitted in any way, including lwres_sendblock().
- */
-
-lwres_result_t
-lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b);
-
-lwres_result_t
-lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);
-/**<
- * Parse a noop request. Note that to get here, the lwpacket must have
- * already been parsed and removed by the caller, otherwise it would be
- * pretty hard for it to know this is the right function to call.
- *
- * The function verifies bits of the header, but does not modify it.
- */
-
-lwres_result_t
-lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt,
- lwres_noopresponse_t **structp);
-
-void
-lwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp);
-
-void
-lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp);
-
-/**<
- * Frees any dynamically allocated memory for this structure.
- *
- * Requires:
- *
- * ctx != NULL, and be a context returned via lwres_context_create().
- *
- * structp != NULL && *structp != NULL.
- *
- * Ensures:
- *
- * *structp == NULL.
- *
- * All memory allocated by this structure will be returned to the
- * system via the context's free function.
- */
-
-lwres_result_t
-lwres_conf_parse(lwres_context_t *ctx, const char *filename);
+lwres_conf_parse(lwres_conf_t *confdata, const char *filename);
/**<
* parses a resolv.conf-format file and stores the results in the structure
* pointed to by *ctx.
*
* Requires:
- * ctx != NULL
+ * confdata != NULL
* filename != NULL && strlen(filename) > 0
*
* Returns:
@@ -509,16 +160,16 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename);
*/
lwres_result_t
-lwres_conf_print(lwres_context_t *ctx, FILE *fp);
+lwres_conf_print(lwres_conf_t *confdata, FILE *fp);
/**<
* Prints a resolv.conf-format of confdata output to fp.
*
* Requires:
- * ctx != NULL
+ * confdata != NULL
*/
void
-lwres_conf_init(lwres_context_t *ctx);
+lwres_conf_init(lwres_conf_t *confdata);
/**<
* sets all internal fields to a default state. Used to initialize a new
* lwres_conf_t structure (not reset a used on).
@@ -528,52 +179,13 @@ lwres_conf_init(lwres_context_t *ctx);
*/
void
-lwres_conf_clear(lwres_context_t *ctx);
+lwres_conf_clear(lwres_conf_t *confdata);
/**<
* frees all internally allocated memory in confdata. Uses the memory
* routines supplied by ctx.
*
* Requires:
- * ctx != NULL
- */
-
-lwres_conf_t *
-lwres_conf_get(lwres_context_t *ctx);
-/**<
- * Be extremely cautions in modifying the contents of this structure; it
- * needs an API to return the various bits of data, walk lists, etc.
- *
- * Requires:
- * ctx != NULL
+ * confdata != NULL
*/
-/*
- * Helper functions
- */
-
-lwres_result_t
-lwres_data_parse(lwres_buffer_t *b, unsigned char **p, lwres_uint16_t *len);
-
-lwres_result_t
-lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len);
-
-lwres_result_t
-lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr);
-
-lwres_result_t
-lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
- lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);
-
-lwres_result_t
-lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype,
- lwres_uint16_t addrlen, const unsigned char *addr,
- lwres_gnbaresponse_t **structp);
-
-lwres_result_t
-lwres_getrdatabyname(lwres_context_t *ctx, const char *name,
- lwres_uint16_t rdclass, lwres_uint16_t rdtype,
- lwres_uint32_t flags, lwres_grbnresponse_t **structp);
-
-LWRES_LANG_ENDDECLS
-
#endif /* LWRES_LWRES_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/netdb.h.in b/usr.sbin/bind/lib/lwres/include/lwres/netdb.h.in
deleted file mode 100644
index 83474f82ace..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/netdb.h.in
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: netdb.h.in,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-#ifndef LWRES_NETDB_H
-#define LWRES_NETDB_H 1
-
-#include <stddef.h> /* Required on FreeBSD (and others?) for size_t. */
-#include <netdb.h> /* Contractual provision. */
-
-#include <lwres/lang.h>
-
-/*
- * Define if <netdb.h> does not declare struct addrinfo.
- */
-@ISC_LWRES_NEEDADDRINFO@
-
-#ifdef ISC_LWRES_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 <netdb.h> may or may not have
- * defined them.
- */
-
-/*
- * Error return codes from gethostbyname() and gethostbyaddr()
- * (left in extern int h_errno).
- */
-
-#undef NETDB_INTERNAL
-#undef NETDB_SUCCESS
-#undef HOST_NOT_FOUND
-#undef TRY_AGAIN
-#undef NO_RECOVERY
-#undef NO_DATA
-#undef NO_ADDRESS
-
-#define NETDB_INTERNAL -1 /* see errno */
-#define NETDB_SUCCESS 0 /* no problem */
-#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
-#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
-#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
-#define NO_DATA 4 /* Valid name, no data record of requested type */
-#define NO_ADDRESS NO_DATA /* no address, look for MX record */
-
-/*
- * Error return codes from getaddrinfo()
- */
-
-#undef EAI_ADDRFAMILY
-#undef EAI_AGAIN
-#undef EAI_BADFLAGS
-#undef EAI_FAIL
-#undef EAI_FAMILY
-#undef EAI_MEMORY
-#undef EAI_NODATA
-#undef EAI_NONAME
-#undef EAI_SERVICE
-#undef EAI_SOCKTYPE
-#undef EAI_SYSTEM
-#undef EAI_BADHINTS
-#undef EAI_PROTOCOL
-#undef EAI_OVERFLOW
-#undef EAI_MAX
-
-#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_OVERFLOW 14
-#define EAI_MAX 15
-
-/*
- * Flag values for getaddrinfo()
- */
-#undef AI_PASSIVE
-#undef AI_CANONNAME
-#undef AI_NUMERICHOST
-
-#define AI_PASSIVE 0x00000001
-#define AI_CANONNAME 0x00000002
-#define AI_NUMERICHOST 0x00000004
-
-/*
- * Flag values for getipnodebyname()
- */
-#undef AI_V4MAPPED
-#undef AI_ALL
-#undef AI_ADDRCONFIG
-#undef AI_DEFAULT
-
-#define AI_V4MAPPED 0x00000008
-#define AI_ALL 0x00000010
-#define AI_ADDRCONFIG 0x00000020
-#define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
-
-/*
- * Constants for lwres_getnameinfo()
- */
-#undef NI_MAXHOST
-#undef NI_MAXSERV
-
-#define NI_MAXHOST 1025
-#define NI_MAXSERV 32
-
-/*
- * Flag values for lwres_getnameinfo()
- */
-#undef NI_NOFQDN
-#undef NI_NUMERICHOST
-#undef NI_NAMEREQD
-#undef NI_NUMERICSERV
-#undef NI_DGRAM
-#undef NI_NUMERICSCOPE
-
-#define NI_NOFQDN 0x00000001
-#define NI_NUMERICHOST 0x00000002
-#define NI_NAMEREQD 0x00000004
-#define NI_NUMERICSERV 0x00000008
-#define NI_DGRAM 0x00000010
-#define NI_NUMERICSCOPE 0x00000020 /*2553bis-00*/
-
-/*
- * Define if <netdb.h> does not declare struct rrsetinfo.
- */
-@ISC_LWRES_NEEDRRSETINFO@
-
-#ifdef ISC_LWRES_NEEDRRSETINFO
-/*
- * Structures for getrrsetbyname()
- */
-struct rdatainfo {
- unsigned int rdi_length;
- unsigned char *rdi_data;
-};
-
-struct rrsetinfo {
- unsigned int rri_flags;
- int rri_rdclass;
- int rri_rdtype;
- unsigned int rri_ttl;
- unsigned int rri_nrdatas;
- unsigned int rri_nsigs;
- char *rri_name;
- struct rdatainfo *rri_rdatas;
- struct rdatainfo *rri_sigs;
-};
-
-/*
- * Flags for getrrsetbyname()
- */
-#define RRSET_VALIDATED 0x00000001
- /* Set was dnssec validated */
-
-/*
- * Return codes for getrrsetbyname()
- */
-#define ERRSET_SUCCESS 0
-#define ERRSET_NOMEMORY 1
-#define ERRSET_FAIL 2
-#define ERRSET_INVAL 3
-#define ERRSET_NONAME 4
-#define ERRSET_NODATA 5
-#endif
-
-/*
- * Define to map into lwres_ namespace.
- */
-
-#define LWRES_NAMESPACE
-
-#ifdef LWRES_NAMESPACE
-
-/*
- * Use our versions not the ones from the C library.
- */
-
-#ifdef getnameinfo
-#undef getnameinfo
-#endif
-#define getnameinfo lwres_getnameinfo
-
-#ifdef getaddrinfo
-#undef getaddrinfo
-#endif
-#define getaddrinfo lwres_getaddrinfo
-
-#ifdef freeaddrinfo
-#undef freeaddrinfo
-#endif
-#define freeaddrinfo lwres_freeaddrinfo
-
-#ifdef gai_strerror
-#undef gai_strerror
-#endif
-#define gai_strerror lwres_gai_strerror
-
-#ifdef herror
-#undef herror
-#endif
-#define herror lwres_herror
-
-#ifdef hstrerror
-#undef hstrerror
-#endif
-#define hstrerror lwres_hstrerror
-
-#ifdef getipnodebyname
-#undef getipnodebyname
-#endif
-#define getipnodebyname lwres_getipnodebyname
-
-#ifdef getipnodebyaddr
-#undef getipnodebyaddr
-#endif
-#define getipnodebyaddr lwres_getipnodebyaddr
-
-#ifdef freehostent
-#undef freehostent
-#endif
-#define freehostent lwres_freehostent
-
-#ifdef gethostbyname
-#undef gethostbyname
-#endif
-#define gethostbyname lwres_gethostbyname
-
-#ifdef gethostbyname2
-#undef gethostbyname2
-#endif
-#define gethostbyname2 lwres_gethostbyname2
-
-#ifdef gethostbyaddr
-#undef gethostbyaddr
-#endif
-#define gethostbyaddr lwres_gethostbyaddr
-
-#ifdef gethostent
-#undef gethostent
-#endif
-#define gethostent lwres_gethostent
-
-#ifdef sethostent
-#undef sethostent
-#endif
-#define sethostent lwres_sethostent
-
-#ifdef endhostent
-#undef endhostent
-#endif
-#define endhostent lwres_endhostent
-
-/* #define sethostfile lwres_sethostfile */
-
-#ifdef gethostbyname_r
-#undef gethostbyname_r
-#endif
-#define gethostbyname_r lwres_gethostbyname_r
-
-#ifdef gethostbyaddr_r
-#undef gethostbyaddr_r
-#endif
-#define gethostbyaddr_r lwres_gethostbyaddr_r
-
-#ifdef gethostent_r
-#undef gethostent_r
-#endif
-#define gethostent_r lwres_gethostent_r
-
-#ifdef sethostent_r
-#undef sethostent_r
-#endif
-#define sethostent_r lwres_sethostent_r
-
-#ifdef endhostent_r
-#undef endhostent_r
-#endif
-#define endhostent_r lwres_endhostent_r
-
-#ifdef getrrsetbyname
-#undef getrrsetbyname
-#endif
-#define getrrsetbyname lwres_getrrsetbyname
-
-#ifdef freerrset
-#undef freerrset
-#endif
-#define freerrset lwres_freerrset
-
-#ifdef notyet
-#define getservbyname lwres_getservbyname
-#define getservbyport lwres_getservbyport
-#define getservent lwres_getservent
-#define setservent lwres_setservent
-#define endservent lwres_endservent
-
-#define getservbyname_r lwres_getservbyname_r
-#define getservbyport_r lwres_getservbyport_r
-#define getservent_r lwres_getservent_r
-#define setservent_r lwres_setservent_r
-#define endservent_r lwres_endservent_r
-
-#define getprotobyname lwres_getprotobyname
-#define getprotobynumber lwres_getprotobynumber
-#define getprotoent lwres_getprotoent
-#define setprotoent lwres_setprotoent
-#define endprotoent lwres_endprotoent
-
-#define getprotobyname_r lwres_getprotobyname_r
-#define getprotobynumber_r lwres_getprotobynumber_r
-#define getprotoent_r lwres_getprotoent_r
-#define setprotoent_r lwres_setprotoent_r
-#define endprotoent_r lwres_endprotoent_r
-
-#ifdef getnetbyname
-#undef getnetbyname
-#endif
-#define getnetbyname lwres_getnetbyname
-
-#ifdef getnetbyaddr
-#undef getnetbyaddr
-#endif
-#define getnetbyaddr lwres_getnetbyaddr
-
-#ifdef getnetent
-#undef getnetent
-#endif
-#define getnetent lwres_getnetent
-
-#ifdef setnetent
-#undef setnetent
-#endif
-#define setnetent lwres_setnetent
-
-#ifdef endnetent
-#undef endnetent
-#endif
-#define endnetent lwres_endnetent
-
-
-#ifdef getnetbyname_r
-#undef getnetbyname_r
-#endif
-#define getnetbyname_r lwres_getnetbyname_r
-
-#ifdef getnetbyaddr_r
-#undef getnetbyaddr_r
-#endif
-#define getnetbyaddr_r lwres_getnetbyaddr_r
-
-#ifdef getnetent_r
-#undef getnetent_r
-#endif
-#define getnetent_r lwres_getnetent_r
-
-#ifdef setnetent_r
-#undef setnetent_r
-#endif
-#define setnetent_r lwres_setnetent_r
-
-#ifdef endnetent_r
-#undef endnetent_r
-#endif
-#define endnetent_r lwres_endnetent_r
-#endif /* notyet */
-
-#ifdef h_errno
-#undef h_errno
-#endif
-#define h_errno lwres_h_errno
-
-#endif /* LWRES_NAMESPACE */
-
-LWRES_LANG_BEGINDECLS
-
-extern int lwres_h_errno;
-
-int lwres_getaddrinfo(const char *, const char *,
- const struct addrinfo *, struct addrinfo **);
-int lwres_getnameinfo(const struct sockaddr *, size_t, char *,
- size_t, char *, size_t, int);
-void lwres_freeaddrinfo(struct addrinfo *);
-char *lwres_gai_strerror(int);
-
-struct hostent *lwres_gethostbyaddr(const char *, int, int);
-struct hostent *lwres_gethostbyname(const char *);
-struct hostent *lwres_gethostbyname2(const char *, int);
-struct hostent *lwres_gethostent(void);
-struct hostent *lwres_getipnodebyname(const char *, int, int, int *);
-struct hostent *lwres_getipnodebyaddr(const void *, size_t, int, int *);
-void lwres_endhostent(void);
-void lwres_sethostent(int);
-/* void lwres_sethostfile(const char *); */
-void lwres_freehostent(struct hostent *);
-
-int lwres_getrrsetbyname(const char *, unsigned int, unsigned int,
- unsigned int, struct rrsetinfo **);
-void lwres_freerrset(struct rrsetinfo *);
-
-#ifdef notyet
-struct netent *lwres_getnetbyaddr(unsigned long, int);
-struct netent *lwres_getnetbyname(const char *);
-struct netent *lwres_getnetent(void);
-void lwres_endnetent(void);
-void lwres_setnetent(int);
-
-struct protoent *lwres_getprotobyname(const char *);
-struct protoent *lwres_getprotobynumber(int);
-struct protoent *lwres_getprotoent(void);
-void lwres_endprotoent(void);
-void lwres_setprotoent(int);
-
-struct servent *lwres_getservbyname(const char *, const char *);
-struct servent *lwres_getservbyport(int, const char *);
-struct servent *lwres_getservent(void);
-void lwres_endservent(void);
-void lwres_setservent(int);
-#endif /* notyet */
-
-void lwres_herror(const char *);
-const char *lwres_hstrerror(int);
-
-
-struct hostent *lwres_gethostbyaddr_r(const char *, int, int, struct hostent *,
- char *, int, int *);
-struct hostent *lwres_gethostbyname_r(const char *, struct hostent *,
- char *, int, int *);
-struct hostent *lwres_gethostent_r(struct hostent *, char *, int, int *);
-void lwres_sethostent_r(int);
-void lwres_endhostent_r(void);
-
-#ifdef notyet
-struct netent *lwres_getnetbyname_r(const char *, struct netent *,
- char *, int);
-struct netent *lwres_getnetbyaddr_r(long, int, struct netent *,
- char *, int);
-struct netent *lwres_getnetent_r(struct netent *, char *, int);
-void lwres_setnetent_r(int);
-void lwres_endnetent_r(void);
-
-struct protoent *lwres_getprotobyname_r(const char *,
- struct protoent *, char *, int);
-struct protoent *lwres_getprotobynumber_r(int,
- struct protoent *, char *, int);
-struct protoent *lwres_getprotoent_r(struct protoent *, char *, int);
-void lwres_setprotoent_r(int);
-void lwres_endprotoent_r(void);
-
-struct servent *lwres_getservbyname_r(const char *name, const char *,
- struct servent *, char *, int);
-struct servent *lwres_getservbyport_r(int port, const char *,
- struct servent *, char *, int);
-struct servent *lwres_getservent_r(struct servent *, char *, int);
-void lwres_setservent_r(int);
-void lwres_endservent_r(void);
-#endif /* notyet */
-
-LWRES_LANG_ENDDECLS
-
-#ifdef notyet
-/* This is nec'y to make this include file properly replace the sun version. */
-#ifdef sun
-#ifdef __GNU_LIBRARY__
-#include <rpc/netdb.h> /* Required. */
-#else /* !__GNU_LIBRARY__ */
-struct rpcent {
- char *r_name; /* name of server for this rpc program */
- char **r_aliases; /* alias list */
- int r_number; /* rpc program number */
-};
-struct rpcent *lwres_getrpcbyname();
-struct rpcent *lwres_getrpcbynumber(),
-struct rpcent *lwres_getrpcent();
-#endif /* __GNU_LIBRARY__ */
-#endif /* sun */
-#endif /* notyet */
-
-/*
- * Tell Emacs to use C mode on this file.
- * Local variables:
- * mode: c
- * End:
- */
-
-#endif /* LWRES_NETDB_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/platform.h.in b/usr.sbin/bind/lib/lwres/include/lwres/platform.h.in
deleted file mode 100644
index eff2810ed33..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/platform.h.in
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: platform.h.in,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-#ifndef LWRES_PLATFORM_H
-#define LWRES_PLATFORM_H 1
-
-/*****
- ***** Platform-dependent defines.
- *****/
-
-/***
- *** Network.
- ***/
-
-/*
- * Define if this system needs the <netinet/in6.h> header file for IPv6.
- */
-@LWRES_PLATFORM_NEEDNETINETIN6H@
-
-/*
- * Define if this system needs the <netinet6/in6.h> header file for IPv6.
- */
-@LWRES_PLATFORM_NEEDNETINET6IN6H@
-
-/*
- * If sockaddrs on this system have an sa_len field, LWRES_PLATFORM_HAVESALEN
- * will be defined.
- */
-@LWRES_PLATFORM_HAVESALEN@
-
-/*
- * If this system has the IPv6 structure definitions, LWRES_PLATFORM_HAVEIPV6
- * will be defined.
- */
-@LWRES_PLATFORM_HAVEIPV6@
-
-/*
- * If this system is missing in6addr_any, LWRES_PLATFORM_NEEDIN6ADDRANY will
- * be defined.
- */
-@LWRES_PLATFORM_NEEDIN6ADDRANY@
-
-/*
- * If this system is missing in6addr_loopback,
- * LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK will be defined.
- */
-@LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK@
-
-/*
- * If this system has in_addr6, rather than in6_addr,
- * LWRES_PLATFORM_HAVEINADDR6 will be defined.
- */
-@LWRES_PLATFORM_HAVEINADDR6@
-
-/*
- * Defined if unistd.h does not cause fd_set to be delared.
- */
-@LWRES_PLATFORM_NEEDSYSSELECTH@
-
-/*
- * Used to control how extern data is linked; needed for Win32 platforms.
- */
-@LWRES_PLATFORM_USEDECLSPEC@
-
-/*
- * Defined this system needs vsnprintf() and snprintf().
- */
-@LWRES_PLATFORM_NEEDVSNPRINTF@
-
-/*
- * If this system need a modern sprintf() that returns (int) not (char*).
- */
-@LWRES_PLATFORM_NEEDSPRINTF@
-
-/*
- * The printf format string modifier to use with lwres_uint64_t values.
- */
-@LWRES_PLATFORM_QUADFORMAT@
-
-/*! \brief
- * Define if this system needs strtoul.
- */
-@LWRES_PLATFORM_NEEDSTRTOUL@
-
-/*! \brief
- * Define if this system needs strlcpy.
- */
-@LWRES_PLATFORM_NEEDSTRLCPY@
-
-#ifndef LWRES_PLATFORM_USEDECLSPEC
-#define LIBLWRES_EXTERNAL_DATA
-#else
-#ifdef LIBLWRES_EXPORTS
-#define LIBLWRES_EXTERNAL_DATA __declspec(dllexport)
-#else
-#define LIBLWRES_EXTERNAL_DATA __declspec(dllimport)
-#endif
-#endif
-
-/*
- * Tell Emacs to use C mode on this file.
- * Local Variables:
- * mode: c
- * End:
- */
-
-#endif /* LWRES_PLATFORM_H */
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/stdlib.h b/usr.sbin/bind/lib/lwres/include/lwres/stdlib.h
deleted file mode 100644
index 6bb3f8312df..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/stdlib.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef LWRES_STDLIB_H
-#define LWRES_STDLIB_H 1
-
-/*! \file lwres/stdlib.h */
-
-#include <stdlib.h>
-
-#include <lwres/lang.h>
-#include <lwres/platform.h>
-
-#ifdef LWRES_PLATFORM_NEEDSTRTOUL
-#define strtoul lwres_strtoul
-#endif
-
-LWRES_LANG_BEGINDECLS
-
-unsigned long lwres_strtoul(const char *, char **, int);
-
-LWRES_LANG_ENDDECLS
-
-#endif
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/string.h b/usr.sbin/bind/lib/lwres/include/lwres/string.h
deleted file mode 100644
index f5c9a8912e2..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/string.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef LWRES_STRING_H
-#define LWRES_STRING_H 1
-
-/*! \file lwres/string.h */
-
-#include <stdlib.h>
-
-#include <lwres/lang.h>
-#include <lwres/platform.h>
-
-#ifdef LWRES_PLATFORM_NEEDSTRLCPY
-#define strlcpy lwres_strlcpy
-#endif
-
-LWRES_LANG_BEGINDECLS
-
-size_t lwres_strlcpy(char *dst, const char *src, size_t size);
-
-LWRES_LANG_ENDDECLS
-
-#endif
diff --git a/usr.sbin/bind/lib/lwres/include/lwres/version.h b/usr.sbin/bind/lib/lwres/include/lwres/version.h
deleted file mode 100644
index 8ea8a9d0913..00000000000
--- a/usr.sbin/bind/lib/lwres/include/lwres/version.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: version.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file lwres/version.h */
-
-#include <lwres/platform.h>
-
-LIBLWRES_EXTERNAL_DATA extern const char lwres_version[];
-
-LIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_libinterface;
-LIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_librevision;
-LIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_libage;
diff --git a/usr.sbin/bind/lib/lwres/lwbuffer.c b/usr.sbin/bind/lib/lwres/lwbuffer.c
deleted file mode 100644
index 8aee809e4a6..00000000000
--- a/usr.sbin/bind/lib/lwres/lwbuffer.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwbuffer.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * These functions provide bounds checked access to a region of memory
- * where data is being read or written. They are based on, and similar
- * to, the isc_buffer_ functions in the ISC library.
- *
- * A buffer is a region of memory, together with a set of related
- * subregions. The used region and the available region are disjoint, and
- * their union is the buffer's region. The used region extends from the
- * beginning of the buffer region to the last used byte. The available
- * region extends from one byte greater than the last used byte to the
- * end of the buffer's region. The size of the used region can be changed
- * using various buffer commands. Initially, the used region is empty.
- *
- * The used region is further subdivided into two disjoint regions: the
- * consumed region and the remaining region. The union of these two
- * regions is the used region. The consumed region extends from the
- * beginning of the used region to the byte before the current offset (if
- * any). The remaining region the current pointer to the end of the used
- * region. The size of the consumed region can be changed using various
- * buffer commands. Initially, the consumed region is empty.
- *
- * The active region is an (optional) subregion of the remaining region.
- * It extends from the current offset to an offset in the remaining
- * region. Initially, the active region is empty. If the current offset
- * advances beyond the chosen offset, the active region will also be
- * empty.
- *
- *
- * \verbatim
- * /------------entire length---------------\\
- * /----- used region -----\\/-- available --\\
- * +----------------------------------------+
- * | consumed | remaining | |
- * +----------------------------------------+
- * a b c d e
- *
- * a == base of buffer.
- * b == current pointer. Can be anywhere between a and d.
- * c == active pointer. Meaningful between b and d.
- * d == used pointer.
- * e == length of buffer.
- *
- * a-e == entire length of buffer.
- * a-d == used region.
- * a-b == consumed region.
- * b-d == remaining region.
- * b-c == optional active region.
- * \endverbatim
- *
- * lwres_buffer_init() initializes the lwres_buffer_t *b and assocates it
- * with the memory region of size length bytes starting at location base.
- *
- * lwres_buffer_invalidate() marks the buffer *b as invalid. Invalidating
- * a buffer after use is not required, but makes it possible to catch its
- * possible accidental use.
- *
- * The functions lwres_buffer_add() and lwres_buffer_subtract()
- * respectively increase and decrease the used space in buffer *b by n
- * bytes. lwres_buffer_add() checks for buffer overflow and
- * lwres_buffer_subtract() checks for underflow. These functions do not
- * allocate or deallocate memory. They just change the value of used.
- *
- * A buffer is re-initialised by lwres_buffer_clear(). The function sets
- * used , current and active to zero.
- *
- * lwres_buffer_first() makes the consumed region of buffer *p empty by
- * setting current to zero (the start of the buffer).
- *
- * lwres_buffer_forward() increases the consumed region of buffer *b by n
- * bytes, checking for overflow. Similarly, lwres_buffer_back() decreases
- * buffer b's consumed region by n bytes and checks for underflow.
- *
- * lwres_buffer_getuint8() reads an unsigned 8-bit integer from *b and
- * returns it. lwres_buffer_putuint8() writes the unsigned 8-bit integer
- * val to buffer *b.
- *
- * lwres_buffer_getuint16() and lwres_buffer_getuint32() are identical to
- * lwres_buffer_putuint8() except that they respectively read an unsigned
- * 16-bit or 32-bit integer in network byte order from b. Similarly,
- * lwres_buffer_putuint16() and lwres_buffer_putuint32() writes the
- * unsigned 16-bit or 32-bit integer val to buffer b, in network byte
- * order.
- *
- * Arbitrary amounts of data are read or written from a lightweight
- * resolver buffer with lwres_buffer_getmem() and lwres_buffer_putmem()
- * respectively. lwres_buffer_putmem() copies length bytes of memory at
- * base to b. Conversely, lwres_buffer_getmem() copies length bytes of
- * memory from b to base.
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <lwres/lwbuffer.h>
-
-#include "assert_p.h"
-
-void
-lwres_buffer_init(lwres_buffer_t *b, void *base, unsigned int length)
-{
- /*
- * Make 'b' refer to the 'length'-byte region starting at base.
- */
-
- REQUIRE(b != NULL);
-
- b->magic = LWRES_BUFFER_MAGIC;
- b->base = base;
- b->length = length;
- b->used = 0;
- b->current = 0;
- b->active = 0;
-}
-
-/* Make 'b' an invalid buffer. */
-void
-lwres_buffer_invalidate(lwres_buffer_t *b)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
-
- b->magic = 0;
- b->base = NULL;
- b->length = 0;
- b->used = 0;
- b->current = 0;
- b->active = 0;
-}
-
-/* Increase the 'used' region of 'b' by 'n' bytes. */
-void
-lwres_buffer_add(lwres_buffer_t *b, unsigned int n)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used + n <= b->length);
-
- b->used += n;
-}
-
-/* Decrease the 'used' region of 'b' by 'n' bytes. */
-void
-lwres_buffer_subtract(lwres_buffer_t *b, unsigned int n)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used >= n);
-
- b->used -= n;
- if (b->current > b->used)
- b->current = b->used;
- if (b->active > b->used)
- b->active = b->used;
-}
-
-/* Make the used region empty. */
-void
-lwres_buffer_clear(lwres_buffer_t *b)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
-
- b->used = 0;
- b->current = 0;
- b->active = 0;
-}
-
-/* Make the consumed region empty. */
-void
-lwres_buffer_first(lwres_buffer_t *b)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
-
- b->current = 0;
-}
-
-/* Increase the 'consumed' region of 'b' by 'n' bytes. */
-void
-lwres_buffer_forward(lwres_buffer_t *b, unsigned int n)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->current + n <= b->used);
-
- b->current += n;
-}
-
-/* Decrease the 'consumed' region of 'b' by 'n' bytes. */
-void
-lwres_buffer_back(lwres_buffer_t *b, unsigned int n)
-{
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(n <= b->current);
-
- b->current -= n;
-}
-
-/* Read an unsigned 8-bit integer from 'b' and return it. */
-lwres_uint8_t
-lwres_buffer_getuint8(lwres_buffer_t *b)
-{
- unsigned char *cp;
- lwres_uint8_t result;
-
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used - b->current >= 1);
-
- cp = b->base;
- cp += b->current;
- b->current += 1;
- result = ((unsigned int)(cp[0]));
-
- return (result);
-}
-
-/* Put an unsigned 8-bit integer */
-void
-lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val)
-{
- unsigned char *cp;
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used + 1 <= b->length);
-
- cp = b->base;
- cp += b->used;
- b->used += 1;
- cp[0] = (val & 0x00ff);
-}
-
-/* Read an unsigned 16-bit integer in network byte order from 'b', convert it to host byte order, and return it. */
-lwres_uint16_t
-lwres_buffer_getuint16(lwres_buffer_t *b)
-{
- unsigned char *cp;
- lwres_uint16_t result;
-
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used - b->current >= 2);
-
- cp = b->base;
- cp += b->current;
- b->current += 2;
- result = ((unsigned int)(cp[0])) << 8;
- result |= ((unsigned int)(cp[1]));
-
- return (result);
-}
-
-/* Put an unsigned 16-bit integer. */
-void
-lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val)
-{
- unsigned char *cp;
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used + 2 <= b->length);
-
- cp = b->base;
- cp += b->used;
- b->used += 2;
- cp[0] = (val & 0xff00) >> 8;
- cp[1] = (val & 0x00ff);
-}
-
-/* Read an unsigned 32-bit integer in network byte order from 'b', convert it to host byte order, and return it. */
-lwres_uint32_t
-lwres_buffer_getuint32(lwres_buffer_t *b)
-{
- unsigned char *cp;
- lwres_uint32_t result;
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used - b->current >= 4);
-
- cp = b->base;
- cp += b->current;
- b->current += 4;
- result = ((unsigned int)(cp[0])) << 24;
- result |= ((unsigned int)(cp[1])) << 16;
- result |= ((unsigned int)(cp[2])) << 8;
- result |= ((unsigned int)(cp[3]));
-
- return (result);
-}
-
-/* Put an unsigned 32-bit integer. */
-void
-lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val)
-{
- unsigned char *cp;
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used + 4 <= b->length);
-
- cp = b->base;
- cp += b->used;
- b->used += 4;
- cp[0] = (unsigned char)((val & 0xff000000) >> 24);
- cp[1] = (unsigned char)((val & 0x00ff0000) >> 16);
- cp[2] = (unsigned char)((val & 0x0000ff00) >> 8);
- cp[3] = (unsigned char)(val & 0x000000ff);
-}
-
-/* copies length bytes of memory at base to b */
-void
-lwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base,
- unsigned int length)
-{
- unsigned char *cp;
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used + length <= b->length);
-
- cp = (unsigned char *)b->base + b->used;
- memmove(cp, base, length);
- b->used += length;
-}
-
-/* copies length bytes of memory at b to base */
-void
-lwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base,
- unsigned int length)
-{
- unsigned char *cp;
-
- REQUIRE(LWRES_BUFFER_VALID(b));
- REQUIRE(b->used - b->current >= length);
-
- cp = b->base;
- cp += b->current;
- b->current += length;
-
- memmove(base, cp, length);
-}
diff --git a/usr.sbin/bind/lib/lwres/lwconfig.c b/usr.sbin/bind/lib/lwres/lwconfig.c
index 7f9c85e6a77..da6827b1e50 100644
--- a/usr.sbin/bind/lib/lwres/lwconfig.c
+++ b/usr.sbin/bind/lib/lwres/lwconfig.c
@@ -60,17 +60,8 @@
#include <string.h>
#include <unistd.h>
-#include <lwres/lwbuffer.h>
#include <lwres/lwres.h>
-#include <lwres/net.h>
#include <lwres/result.h>
-#include <lwres/stdlib.h>
-#include <lwres/string.h>
-
-#include "assert_p.h"
-#include "context_p.h"
-#include "print_p.h"
-
#if ! defined(NS_INADDRSZ)
#define NS_INADDRSZ 4
@@ -81,22 +72,22 @@
#endif
static lwres_result_t
-lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp);
+lwres_conf_parsenameserver(lwres_conf_t *confdata, FILE *fp);
static lwres_result_t
-lwres_conf_parselwserver(lwres_context_t *ctx, FILE *fp);
+lwres_conf_parselwserver(lwres_conf_t *confdata, FILE *fp);
static lwres_result_t
-lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp);
+lwres_conf_parsedomain(lwres_conf_t *confdata, FILE *fp);
static lwres_result_t
-lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp);
+lwres_conf_parsesearch(lwres_conf_t *confdata, FILE *fp);
static lwres_result_t
-lwres_conf_parsesortlist(lwres_context_t *ctx, FILE *fp);
+lwres_conf_parsesortlist(lwres_conf_t *confdata, FILE *fp);
static lwres_result_t
-lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp);
+lwres_conf_parseoption(lwres_conf_t *confdata, FILE *fp);
static void
lwres_resetaddr(lwres_addr_t *addr);
@@ -172,8 +163,8 @@ getword(FILE *fp, char *buffer, size_t size) {
int ch;
char *p = buffer;
- REQUIRE(buffer != NULL);
- REQUIRE(size > 0U);
+ assert(buffer != NULL);
+ assert(size > 0U);
*p = '\0';
@@ -199,7 +190,7 @@ getword(FILE *fp, char *buffer, size_t size) {
static void
lwres_resetaddr(lwres_addr_t *addr) {
- REQUIRE(addr != NULL);
+ assert(addr != NULL);
memset(addr->address, 0, LWRES_ADDR_MAXLEN);
addr->family = 0;
@@ -207,28 +198,10 @@ lwres_resetaddr(lwres_addr_t *addr) {
addr->zone = 0;
}
-static char *
-lwres_strdup(lwres_context_t *ctx, const char *str) {
- char *p;
-
- REQUIRE(str != NULL);
- REQUIRE(strlen(str) > 0U);
-
- p = CTXMALLOC(strlen(str) + 1);
- if (p != NULL)
- strcpy(p, str);
-
- return (p);
-}
-
/*% intializes data structure for subsequent config parsing. */
void
-lwres_conf_init(lwres_context_t *ctx) {
+lwres_conf_init(lwres_conf_t *confdata) {
int i;
- lwres_conf_t *confdata;
-
- REQUIRE(ctx != NULL);
- confdata = &ctx->confdata;
confdata->nsnext = 0;
confdata->lwnext = 0;
@@ -253,28 +226,18 @@ lwres_conf_init(lwres_context_t *ctx) {
/*% Frees up all the internal memory used by the config data structure, returning it to the lwres_context_t. */
void
-lwres_conf_clear(lwres_context_t *ctx) {
+lwres_conf_clear(lwres_conf_t *confdata) {
int i;
- lwres_conf_t *confdata;
-
- REQUIRE(ctx != NULL);
- confdata = &ctx->confdata;
for (i = 0; i < confdata->nsnext; i++)
lwres_resetaddr(&confdata->nameservers[i]);
- if (confdata->domainname != NULL) {
- CTXFREE(confdata->domainname,
- strlen(confdata->domainname) + 1);
- confdata->domainname = NULL;
- }
+ free(confdata->domainname);
+ confdata->domainname = NULL;
for (i = 0; i < confdata->searchnxt; i++) {
- if (confdata->search[i] != NULL) {
- CTXFREE(confdata->search[i],
- strlen(confdata->search[i]) + 1);
- confdata->search[i] = NULL;
- }
+ free(confdata->search[i]);
+ confdata->search[i] = NULL;
}
for (i = 0; i < LWRES_CONFMAXSORTLIST; i++) {
@@ -293,14 +256,11 @@ lwres_conf_clear(lwres_context_t *ctx) {
}
static lwres_result_t
-lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_parsenameserver(lwres_conf_t *confdata, FILE *fp) {
char word[LWRES_CONFMAXLINELEN];
int res;
- lwres_conf_t *confdata;
lwres_addr_t address;
- confdata = &ctx->confdata;
-
if (confdata->nsnext == LWRES_CONFMAXNAMESERVERS)
return (LWRES_R_SUCCESS);
@@ -314,9 +274,7 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
return (LWRES_R_FAILURE); /* Extra junk on line. */
res = lwres_create_addr(word, &address, 1);
- if (res == LWRES_R_SUCCESS &&
- ((address.family == LWRES_ADDRTYPE_V4 && ctx->use_ipv4 == 1) ||
- (address.family == LWRES_ADDRTYPE_V6 && ctx->use_ipv6 == 1))) {
+ if (res == LWRES_R_SUCCESS) {
confdata->nameservers[confdata->nsnext++] = address;
}
@@ -324,12 +282,9 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
}
static lwres_result_t
-lwres_conf_parselwserver(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_parselwserver(lwres_conf_t *confdata, FILE *fp) {
char word[LWRES_CONFMAXLINELEN];
int res;
- lwres_conf_t *confdata;
-
- confdata = &ctx->confdata;
if (confdata->lwnext == LWRES_CONFMAXLWSERVERS)
return (LWRES_R_SUCCESS);
@@ -352,12 +307,9 @@ lwres_conf_parselwserver(lwres_context_t *ctx, FILE *fp) {
}
static lwres_result_t
-lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_parsedomain(lwres_conf_t *confdata, FILE *fp) {
char word[LWRES_CONFMAXLINELEN];
int res, i;
- lwres_conf_t *confdata;
-
- confdata = &ctx->confdata;
res = getword(fp, word, sizeof(word));
if (strlen(word) == 0U)
@@ -368,23 +320,18 @@ lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp) {
if (res != EOF && res != '\n')
return (LWRES_R_FAILURE); /* Extra junk on line. */
- if (confdata->domainname != NULL)
- CTXFREE(confdata->domainname,
- strlen(confdata->domainname) + 1); /* */
+ free(confdata->domainname);
/*
* Search and domain are mutually exclusive.
*/
for (i = 0; i < LWRES_CONFMAXSEARCH; i++) {
- if (confdata->search[i] != NULL) {
- CTXFREE(confdata->search[i],
- strlen(confdata->search[i])+1);
- confdata->search[i] = NULL;
- }
+ free(confdata->search[i]);
+ confdata->search[i] = NULL;
}
confdata->searchnxt = 0;
- confdata->domainname = lwres_strdup(ctx, word);
+ confdata->domainname = strdup(word);
if (confdata->domainname == NULL)
return (LWRES_R_FAILURE);
@@ -393,31 +340,19 @@ lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp) {
}
static lwres_result_t
-lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_parsesearch(lwres_conf_t *confdata, FILE *fp) {
int idx, delim;
char word[LWRES_CONFMAXLINELEN];
- lwres_conf_t *confdata;
- confdata = &ctx->confdata;
-
- if (confdata->domainname != NULL) {
- /*
- * Search and domain are mutually exclusive.
- */
- CTXFREE(confdata->domainname,
- strlen(confdata->domainname) + 1);
- confdata->domainname = NULL;
- }
+ free(confdata->domainname);
+ confdata->domainname = NULL;
/*
* Remove any previous search definitions.
*/
for (idx = 0; idx < LWRES_CONFMAXSEARCH; idx++) {
- if (confdata->search[idx] != NULL) {
- CTXFREE(confdata->search[idx],
- strlen(confdata->search[idx])+1);
- confdata->search[idx] = NULL;
- }
+ free(confdata->search[idx]);
+ confdata->search[idx] = NULL;
}
confdata->searchnxt = 0;
@@ -430,7 +365,7 @@ lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp) {
if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
goto ignore; /* Too many domains. */
- confdata->search[idx] = lwres_strdup(ctx, word);
+ confdata->search[idx] = strdup(word);
if (confdata->search[idx] == NULL)
return (LWRES_R_FAILURE);
idx++;
@@ -463,7 +398,7 @@ lwres_create_addr(const char *buffer, lwres_addr_t *addr, int convert_zero) {
if (percent != NULL)
*percent = 0;
- if (lwres_net_aton(buffer, &v4) == 1) {
+ if (inet_aton(buffer, &v4) == 1) {
if (convert_zero) {
unsigned char zeroaddress[] = {0, 0, 0, 0};
unsigned char loopaddress[] = {127, 0, 0, 1};
@@ -475,7 +410,7 @@ lwres_create_addr(const char *buffer, lwres_addr_t *addr, int convert_zero) {
addr->zone = 0;
memmove((void *)addr->address, &v4, NS_INADDRSZ);
- } else if (lwres_net_pton(AF_INET6, buf, &v6) == 1) {
+ } else if (inet_pton(AF_INET6, buf, &v6) == 1) {
addr->family = LWRES_ADDRTYPE_V6;
addr->length = NS_IN6ADDRSZ;
memmove((void *)addr->address, &v6, NS_IN6ADDRSZ);
@@ -506,13 +441,10 @@ lwres_create_addr(const char *buffer, lwres_addr_t *addr, int convert_zero) {
}
static lwres_result_t
-lwres_conf_parsesortlist(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_parsesortlist(lwres_conf_t *confdata, FILE *fp) {
int delim, res, idx;
char word[LWRES_CONFMAXLINELEN];
char *p;
- lwres_conf_t *confdata;
-
- confdata = &ctx->confdata;
delim = getword(fp, word, sizeof(word));
if (strlen(word) == 0U)
@@ -560,15 +492,11 @@ lwres_conf_parsesortlist(lwres_context_t *ctx, FILE *fp) {
}
static lwres_result_t
-lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_parseoption(lwres_conf_t *confdata, FILE *fp) {
int delim;
long ndots;
char *p;
char word[LWRES_CONFMAXLINELEN];
- lwres_conf_t *confdata;
-
- REQUIRE(ctx != NULL);
- confdata = &ctx->confdata;
delim = getword(fp, word, sizeof(word));
if (strlen(word) == 0U)
@@ -585,7 +513,7 @@ lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) {
return (LWRES_R_FAILURE);
if (ndots < 0 || ndots > 0xff) /* Out of range. */
return (LWRES_R_FAILURE);
- confdata->ndots = (lwres_uint8_t)ndots;
+ confdata->ndots = (uint8_t)ndots;
}
if (delim == EOF || delim == '\n')
@@ -599,19 +527,15 @@ lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) {
/*% parses a file and fills in the data structure. */
lwres_result_t
-lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
+lwres_conf_parse(lwres_conf_t *confdata, const char *filename) {
FILE *fp = NULL;
char word[256];
lwres_result_t rval, ret;
- lwres_conf_t *confdata;
int stopchar;
- REQUIRE(ctx != NULL);
- confdata = &ctx->confdata;
-
- REQUIRE(filename != NULL);
- REQUIRE(strlen(filename) > 0U);
- REQUIRE(confdata != NULL);
+ assert(filename != NULL);
+ assert(strlen(filename) > 0U);
+ assert(confdata != NULL);
errno = 0;
if ((fp = fopen(filename, "r")) == NULL)
@@ -622,24 +546,23 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
stopchar = getword(fp, word, sizeof(word));
if (stopchar == EOF) {
rval = LWRES_R_SUCCESS;
- POST(rval);
break;
}
if (strlen(word) == 0U)
rval = LWRES_R_SUCCESS;
else if (strcmp(word, "nameserver") == 0)
- rval = lwres_conf_parsenameserver(ctx, fp);
+ rval = lwres_conf_parsenameserver(confdata, fp);
else if (strcmp(word, "lwserver") == 0)
- rval = lwres_conf_parselwserver(ctx, fp);
+ rval = lwres_conf_parselwserver(confdata, fp);
else if (strcmp(word, "domain") == 0)
- rval = lwres_conf_parsedomain(ctx, fp);
+ rval = lwres_conf_parsedomain(confdata, fp);
else if (strcmp(word, "search") == 0)
- rval = lwres_conf_parsesearch(ctx, fp);
+ rval = lwres_conf_parsesearch(confdata, fp);
else if (strcmp(word, "sortlist") == 0)
- rval = lwres_conf_parsesortlist(ctx, fp);
+ rval = lwres_conf_parsesortlist(confdata, fp);
else if (strcmp(word, "options") == 0)
- rval = lwres_conf_parseoption(ctx, fp);
+ rval = lwres_conf_parseoption(confdata, fp);
else {
/* unrecognised word. Ignore entire line */
rval = LWRES_R_SUCCESS;
@@ -659,24 +582,20 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
/*% Prints the config data structure to the FILE. */
lwres_result_t
-lwres_conf_print(lwres_context_t *ctx, FILE *fp) {
+lwres_conf_print(lwres_conf_t *confdata, FILE *fp) {
int i;
int af;
char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
char buf[sizeof("%4000000000")];
const char *p;
- lwres_conf_t *confdata;
lwres_addr_t tmpaddr;
- REQUIRE(ctx != NULL);
- confdata = &ctx->confdata;
-
- REQUIRE(confdata->nsnext <= LWRES_CONFMAXNAMESERVERS);
+ assert(confdata->nsnext <= LWRES_CONFMAXNAMESERVERS);
for (i = 0; i < confdata->nsnext; i++) {
af = lwresaddr2af(confdata->nameservers[i].family);
- p = lwres_net_ntop(af, confdata->nameservers[i].address,
+ p = inet_ntop(af, confdata->nameservers[i].address,
tmp, sizeof(tmp));
if (p != tmp)
return (LWRES_R_FAILURE);
@@ -693,7 +612,7 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) {
for (i = 0; i < confdata->lwnext; i++) {
af = lwresaddr2af(confdata->lwservers[i].family);
- p = lwres_net_ntop(af, confdata->lwservers[i].address,
+ p = inet_ntop(af, confdata->lwservers[i].address,
tmp, sizeof(tmp));
if (p != tmp)
return (LWRES_R_FAILURE);
@@ -710,7 +629,7 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) {
if (confdata->domainname != NULL) {
fprintf(fp, "domain %s\n", confdata->domainname);
} else if (confdata->searchnxt > 0) {
- REQUIRE(confdata->searchnxt <= LWRES_CONFMAXSEARCH);
+ assert(confdata->searchnxt <= LWRES_CONFMAXSEARCH);
fprintf(fp, "search");
for (i = 0; i < confdata->searchnxt; i++)
@@ -718,14 +637,14 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) {
fputc('\n', fp);
}
- REQUIRE(confdata->sortlistnxt <= LWRES_CONFMAXSORTLIST);
+ assert(confdata->sortlistnxt <= LWRES_CONFMAXSORTLIST);
if (confdata->sortlistnxt > 0) {
fputs("sortlist", fp);
for (i = 0; i < confdata->sortlistnxt; i++) {
af = lwresaddr2af(confdata->sortlist[i].addr.family);
- p = lwres_net_ntop(af,
+ p = inet_ntop(af,
confdata->sortlist[i].addr.address,
tmp, sizeof(tmp));
if (p != tmp)
@@ -741,7 +660,7 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) {
confdata->sortlist[i].mask.length) != 0) {
af = lwresaddr2af(
confdata->sortlist[i].mask.family);
- p = lwres_net_ntop
+ p = inet_ntop
(af,
confdata->sortlist[i].mask.address,
tmp, sizeof(tmp));
@@ -765,11 +684,3 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) {
return (LWRES_R_SUCCESS);
}
-
-/*% Returns a pointer to the current config structure. */
-lwres_conf_t *
-lwres_conf_get(lwres_context_t *ctx) {
- REQUIRE(ctx != NULL);
-
- return (&ctx->confdata);
-}
diff --git a/usr.sbin/bind/lib/lwres/lwinetaton.c b/usr.sbin/bind/lib/lwres/lwinetaton.c
deleted file mode 100644
index 22ddfad6fc8..00000000000
--- a/usr.sbin/bind/lib/lwres/lwinetaton.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1983, 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.
- */
-
-/*
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-/*! \file lwinetaton.c
- */
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
-static char rcsid[] = "$Id: lwinetaton.c,v 1.8 2019/12/17 01:46:38 sthen Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <config.h>
-
-#include <ctype.h>
-
-#include <stddef.h>
-
-#include <lwres/int.h>
-#include <lwres/net.h>
-
-#include "assert_p.h"
-
-/*!
- * Check whether "cp" is a valid ascii representation
- * of an Internet address and convert to a binary address.
- * Returns 1 if the address is valid, 0 if not.
- * This replaces inet_addr, the return value from which
- * cannot distinguish between failure and a local broadcast address.
- */
-int
-lwres_net_aton(const char *cp, struct in_addr *addr) {
- lwres_uint32_t val;
- int base;
- ptrdiff_t n;
- unsigned char c;
- lwres_uint8_t parts[4];
- lwres_uint8_t *pp = parts;
- int digit;
-
- REQUIRE(cp != NULL);
-
- c = *cp;
- for (;;) {
- /*
- * Collect number up to ``.''.
- * Values are specified as for C:
- * 0x=hex, 0=octal, isdigit=decimal.
- */
- if (!isdigit(c & 0xff))
- return (0);
- val = 0;
- base = 10;
- digit = 0;
- if (c == '0') {
- c = *++cp;
- if (c == 'x' || c == 'X') {
- base = 16;
- c = *++cp;
- } else {
- base = 8;
- digit = 1;
- }
- }
- for (;;) {
- /*
- * isascii() is valid for all integer values, and
- * when it is true, c is known to be in scope
- * for isdigit(). No cast necessary. Similar
- * comment applies for later ctype uses.
- */
- if (isascii(c) && isdigit(c)) {
- if (base == 8 && (c == '8' || c == '9'))
- return (0);
- val = (val * base) + (c - '0');
- c = *++cp;
- digit = 1;
- } else if (base == 16 && isascii(c) && isxdigit(c)) {
- val = (val << 4) |
- (c + 10 - (islower(c) ? 'a' : 'A'));
- c = *++cp;
- digit = 1;
- } else
- break;
- }
- if (c == '.') {
- /*
- * Internet format:
- * a.b.c.d
- * a.b.c (with c treated as 16 bits)
- * a.b (with b treated as 24 bits)
- */
- if (pp >= parts + 3 || val > 0xffU)
- return (0);
- *pp++ = (lwres_uint8_t)val;
- c = *++cp;
- } else
- break;
- }
- /*
- * Check for trailing characters.
- */
- if (c != '\0' && (!isascii(c) || !isspace(c)))
- return (0);
- /*
- * Did we get a valid digit?
- */
- if (!digit)
- return (0);
- /*
- * Concoct the address according to
- * the number of parts specified.
- */
- n = pp - parts + 1;
- switch (n) {
- case 1: /* a -- 32 bits */
- break;
-
- case 2: /* a.b -- 8.24 bits */
- if (val > 0xffffffU)
- return (0);
- val |= parts[0] << 24;
- break;
-
- case 3: /* a.b.c -- 8.8.16 bits */
- if (val > 0xffffU)
- return (0);
- val |= (parts[0] << 24) | (parts[1] << 16);
- break;
-
- case 4: /* a.b.c.d -- 8.8.8.8 bits */
- if (val > 0xffU)
- return (0);
- val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
- break;
- }
- if (addr != NULL)
- addr->s_addr = htonl(val);
-
- return (1);
-}
diff --git a/usr.sbin/bind/lib/lwres/lwinetntop.c b/usr.sbin/bind/lib/lwres/lwinetntop.c
deleted file mode 100644
index 45ea1484ece..00000000000
--- a/usr.sbin/bind/lib/lwres/lwinetntop.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*! \file lwinetntop.c
- */
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] =
- "$Id: lwinetntop.c,v 1.11 2019/12/17 01:46:38 sthen Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <lwres/net.h>
-#include "print_p.h"
-
-#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 *
- * lwres_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 *
-lwres_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)
- * notes:
- * (1) uses no statics
- * (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")];
- size_t len;
-
- len = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
- if (len >= size) {
- errno = ENOSPC;
- return (NULL);
- }
- strcpy(dst, tmp);
-
- return (dst);
-}
-
-/*! const char *
- * 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;
- cur.base = -1;
- cur.len = 0;
- 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 == 5 && words[5] == 0xffff))) {
- if (!inet_ntop4(src+12, tp,
- sizeof(tmp) - (tp - tmp)))
- return (NULL);
- tp += strlen(tp);
- break;
- }
- tp += sprintf(tp, "%x", words[i]); /* XXX */
- }
- /* 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);
- }
- strcpy(dst, tmp);
- return (dst);
-}
-#endif /* AF_INET6 */
diff --git a/usr.sbin/bind/lib/lwres/lwinetpton.c b/usr.sbin/bind/lib/lwres/lwinetpton.c
deleted file mode 100644
index 37bb3a82f9a..00000000000
--- a/usr.sbin/bind/lib/lwres/lwinetpton.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*! \file lwinetpton.c
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: lwinetpton.c,v 1.3 2019/12/17 01:46:38 sthen Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <config.h>
-
-#include <errno.h>
-#include <string.h>
-
-#include <lwres/net.h>
-
-#define NS_INT16SZ 2
-#define NS_INADDRSZ 4
-#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);
-
-/*!
- * int
- * lwres_net_pton(af, src, 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
-lwres_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 */
-}
-
-/*! int
- * inet_pton4(src, dst)
- * like inet_aton() but without all the hexadecimal and shorthand.
- * return:
- * 1 if `src' is a valid dotted quad, else 0.
- * notice:
- * 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 += (unsigned int)(pch - digits);
- 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);
- /*
- * "clang --analyse" generates warnings using:
- * *++tp = 0;
- */
- tp++;
- *tp = 0;
- saw_digit = 0;
- } else
- return (0);
- }
- if (octets < 4)
- return (0);
- memmove(dst, tmp, NS_INADDRSZ);
- return (1);
-}
-
-/*! int
- * inet_pton6(src, dst)
- * convert presentation level address to network order binary form.
- * return:
- * 1 if `src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- * (1) does not touch `dst' unless it's returning 1.
- * (2) :: in a full address is silently ignored.
- * credit:
- * 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;
-
- 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/usr.sbin/bind/lib/lwres/lwpacket.c b/usr.sbin/bind/lib/lwres/lwpacket.c
deleted file mode 100644
index 9f565fb3b5e..00000000000
--- a/usr.sbin/bind/lib/lwres/lwpacket.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwpacket.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * These functions rely on a struct lwres_lwpacket which is defined in
- * \link lwpacket.h lwres/lwpacket.h.\endlink
- *
- * The following opcodes are currently defined:
- *
- * \li #LWRES_OPCODE_NOOP
- * Success is always returned and the packet contents are
- * echoed. The \link lwres_noop.c lwres_noop_*()\endlink functions should be used for this
- * type.
- *
- * \li #LWRES_OPCODE_GETADDRSBYNAME
- * returns all known addresses for a given name. The
- * \link lwres_gabn.c lwres_gabn_*()\endlink functions should be used for this type.
- *
- * \li #LWRES_OPCODE_GETNAMEBYADDR
- * return the hostname for the given address. The
- * \link lwres_gnba.c lwres_gnba_*() \endlink functions should be used for this type.
- *
- * lwres_lwpacket_renderheader() transfers the contents of lightweight
- * resolver packet structure #lwres_lwpacket_t *pkt in network byte
- * order to the lightweight resolver buffer, *b.
- *
- * lwres_lwpacket_parseheader() performs the converse operation. It
- * transfers data in network byte order from buffer *b to resolver
- * packet *pkt. The contents of the buffer b should correspond to a
- * #lwres_lwpacket_t.
- *
- * \section lwpacket_return Return Values
- *
- * Successful calls to lwres_lwpacket_renderheader() and
- * lwres_lwpacket_parseheader() return #LWRES_R_SUCCESS. If there is
- * insufficient space to copy data between the buffer *b and
- * lightweight resolver packet *pkt both functions return
- * #LWRES_R_UNEXPECTEDEND.
- */
-
-#include <config.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <lwres/lwbuffer.h>
-#include <lwres/lwpacket.h>
-#include <lwres/result.h>
-
-#include "assert_p.h"
-
-/*% Length of Packet */
-#define LWPACKET_LENGTH \
- (sizeof(lwres_uint16_t) * 4 + sizeof(lwres_uint32_t) * 5)
-
-/*% transfers the contents of lightweight resolver packet structure lwres_lwpacket_t *pkt in network byte order to the lightweight resolver buffer, *b. */
-
-lwres_result_t
-lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) {
- REQUIRE(b != NULL);
- REQUIRE(pkt != NULL);
-
- if (!SPACE_OK(b, LWPACKET_LENGTH))
- return (LWRES_R_UNEXPECTEDEND);
-
- lwres_buffer_putuint32(b, pkt->length);
- lwres_buffer_putuint16(b, pkt->version);
- lwres_buffer_putuint16(b, pkt->pktflags);
- lwres_buffer_putuint32(b, pkt->serial);
- lwres_buffer_putuint32(b, pkt->opcode);
- lwres_buffer_putuint32(b, pkt->result);
- lwres_buffer_putuint32(b, pkt->recvlength);
- lwres_buffer_putuint16(b, pkt->authtype);
- lwres_buffer_putuint16(b, pkt->authlength);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% transfers data in network byte order from buffer *b to resolver packet *pkt. The contents of the buffer b should correspond to a lwres_lwpacket_t. */
-
-lwres_result_t
-lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) {
- lwres_uint32_t space;
-
- REQUIRE(b != NULL);
- REQUIRE(pkt != NULL);
-
- space = LWRES_BUFFER_REMAINING(b);
- if (space < LWPACKET_LENGTH)
- return (LWRES_R_UNEXPECTEDEND);
-
- pkt->length = lwres_buffer_getuint32(b);
- /*
- * XXXBEW/MLG Checking that the buffer is long enough probably
- * shouldn't be done here, since this function is supposed to just
- * parse the header.
- */
- if (pkt->length > space)
- return (LWRES_R_UNEXPECTEDEND);
- pkt->version = lwres_buffer_getuint16(b);
- pkt->pktflags = lwres_buffer_getuint16(b);
- pkt->serial = lwres_buffer_getuint32(b);
- pkt->opcode = lwres_buffer_getuint32(b);
- pkt->result = lwres_buffer_getuint32(b);
- pkt->recvlength = lwres_buffer_getuint32(b);
- pkt->authtype = lwres_buffer_getuint16(b);
- pkt->authlength = lwres_buffer_getuint16(b);
-
- return (LWRES_R_SUCCESS);
-}
diff --git a/usr.sbin/bind/lib/lwres/lwres_gabn.c b/usr.sbin/bind/lib/lwres/lwres_gabn.c
deleted file mode 100644
index d846b0df179..00000000000
--- a/usr.sbin/bind/lib/lwres/lwres_gabn.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwres_gabn.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file lwres_gabn.c
- These are low-level routines for creating and parsing lightweight
- resolver name-to-address lookup request and response messages.
-
- There are four main functions for the getaddrbyname opcode. One render
- function converts a getaddrbyname request structure --
- lwres_gabnrequest_t -- to the lighweight resolver's canonical format.
- It is complemented by a parse function that converts a packet in this
- canonical format to a getaddrbyname request structure. Another render
- function converts the getaddrbyname response structure --
- lwres_gabnresponse_t -- to the canonical format. This is complemented
- by a parse function which converts a packet in canonical format to a
- getaddrbyname response structure.
-
- These structures are defined in \link lwres.h <lwres/lwres.h>.\endlink They are shown below.
-
-\code
-#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
-
-typedef struct lwres_addr lwres_addr_t;
-typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
-
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint32_t addrtypes;
- lwres_uint16_t namelen;
- char *name;
-} lwres_gabnrequest_t;
-
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- lwres_addrlist_t addrs;
- void *base;
- size_t baselen;
-} lwres_gabnresponse_t;
-\endcode
-
- lwres_gabnrequest_render() uses resolver context ctx to convert
- getaddrbyname request structure req to canonical format. The packet
- header structure pkt is initialised and transferred to buffer b. The
- contents of *req are then appended to the buffer in canonical format.
- lwres_gabnresponse_render() performs the same task, except it converts
- a getaddrbyname response structure lwres_gabnresponse_t to the
- lightweight resolver's canonical format.
-
- lwres_gabnrequest_parse() uses context ctx to convert the contents of
- packet pkt to a lwres_gabnrequest_t structure. Buffer b provides space
- to be used for storing this structure. When the function succeeds, the
- resulting lwres_gabnrequest_t is made available through *structp.
- lwres_gabnresponse_parse() offers the same semantics as
- lwres_gabnrequest_parse() except it yields a lwres_gabnresponse_t
- structure.
-
- lwres_gabnresponse_free() and lwres_gabnrequest_free() release the
- memory in resolver context ctx that was allocated to the
- lwres_gabnresponse_t or lwres_gabnrequest_t structures referenced via
- structp. Any memory associated with ancillary buffers and strings for
- those structures is also discarded.
-
-\section lwres_gabn_return Return Values
-
- The getaddrbyname opcode functions lwres_gabnrequest_render(),
- lwres_gabnresponse_render() lwres_gabnrequest_parse() and
- lwres_gabnresponse_parse() all return #LWRES_R_SUCCESS on success. They
- return #LWRES_R_NOMEMORY if memory allocation fails.
- #LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer
- b is too small to accommodate the packet header or the
- lwres_gabnrequest_t and lwres_gabnresponse_t structures.
- lwres_gabnrequest_parse() and lwres_gabnresponse_parse() will return
- #LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the
- received packet. These functions will return #LWRES_R_FAILURE if
- pktflags in the packet header structure #lwres_lwpacket_t indicate that
- the packet is not a response to an earlier query.
-
-\section lwres_gabn_see See Also
-
- \link lwpacket.c lwres_lwpacket \endlink
- */
-
-#include <config.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <lwres/lwbuffer.h>
-#include <lwres/lwpacket.h>
-#include <lwres/lwres.h>
-#include <lwres/result.h>
-
-#include "context_p.h"
-#include "assert_p.h"
-
-/*% uses resolver context ctx to convert getaddrbyname request structure req to canonical format. */
-lwres_result_t
-lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
- lwres_uint16_t datalen;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(req->name != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- datalen = strlen(req->name);
-
- payload_length = 4 + 4 + 2 + req->namelen + 1;
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
-
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags &= ~LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_GETADDRSBYNAME;
- pkt->result = 0;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- INSIST(SPACE_OK(b, payload_length));
-
- /*
- * Flags.
- */
- lwres_buffer_putuint32(b, req->flags);
-
- /*
- * Address types we'll accept.
- */
- lwres_buffer_putuint32(b, req->addrtypes);
-
- /*
- * Put the length and the data. We know this will fit because we
- * just checked for it.
- */
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->name, datalen);
- lwres_buffer_putuint8(b, 0); /* trailing NUL */
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
-
- return (LWRES_R_SUCCESS);
-}
-/*% converts a getaddrbyname response structure lwres_gabnresponse_t to the lightweight resolver's canonical format. */
-lwres_result_t
-lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
- lwres_uint16_t datalen;
- lwres_addr_t *addr;
- int x;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- /* naliases, naddrs */
- payload_length = 4 + 2 + 2;
- /* real name encoding */
- payload_length += 2 + req->realnamelen + 1;
- /* each alias */
- for (x = 0; x < req->naliases; x++)
- payload_length += 2 + req->aliaslen[x] + 1;
- /* each address */
- x = 0;
- addr = LWRES_LIST_HEAD(req->addrs);
- while (addr != NULL) {
- payload_length += 4 + 2;
- payload_length += addr->length;
- addr = LWRES_LIST_NEXT(addr, link);
- x++;
- }
- INSIST(x == req->naddrs);
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags |= LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_GETADDRSBYNAME;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- /*
- * Check space needed here.
- */
- INSIST(SPACE_OK(b, payload_length));
-
- /* Flags. */
- lwres_buffer_putuint32(b, req->flags);
-
- /* encode naliases and naddrs */
- lwres_buffer_putuint16(b, req->naliases);
- lwres_buffer_putuint16(b, req->naddrs);
-
- /* encode the real name */
- datalen = req->realnamelen;
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->realname, datalen);
- lwres_buffer_putuint8(b, 0);
-
- /* encode the aliases */
- for (x = 0; x < req->naliases; x++) {
- datalen = req->aliaslen[x];
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->aliases[x],
- datalen);
- lwres_buffer_putuint8(b, 0);
- }
-
- /* encode the addresses */
- addr = LWRES_LIST_HEAD(req->addrs);
- while (addr != NULL) {
- lwres_buffer_putuint32(b, addr->family);
- lwres_buffer_putuint16(b, addr->length);
- lwres_buffer_putmem(b, addr->address, addr->length);
- addr = LWRES_LIST_NEXT(addr, link);
- }
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
- INSIST(LWRES_BUFFER_USEDCOUNT(b) == pkt->length);
-
- return (LWRES_R_SUCCESS);
-}
-/*% Uses context ctx to convert the contents of packet pkt to a lwres_gabnrequest_t structure. */
-lwres_result_t
-lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp)
-{
- int ret;
- char *name;
- lwres_gabnrequest_t *gabn;
- lwres_uint32_t addrtypes;
- lwres_uint32_t flags;
- lwres_uint16_t namelen;
-
- REQUIRE(ctx != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) != 0)
- return (LWRES_R_FAILURE);
-
- if (!SPACE_REMAINING(b, 4 + 4))
- return (LWRES_R_UNEXPECTEDEND);
-
- flags = lwres_buffer_getuint32(b);
- addrtypes = lwres_buffer_getuint32(b);
-
- /*
- * Pull off the name itself
- */
- ret = lwres_string_parse(b, &name, &namelen);
- if (ret != LWRES_R_SUCCESS)
- return (ret);
-
- if (LWRES_BUFFER_REMAINING(b) != 0)
- return (LWRES_R_TRAILINGDATA);
-
- gabn = CTXMALLOC(sizeof(lwres_gabnrequest_t));
- if (gabn == NULL)
- return (LWRES_R_NOMEMORY);
-
- gabn->flags = flags;
- gabn->addrtypes = addrtypes;
- gabn->name = name;
- gabn->namelen = namelen;
-
- *structp = gabn;
- return (LWRES_R_SUCCESS);
-}
-
-/*% Offers the same semantics as lwres_gabnrequest_parse() except it yields a lwres_gabnresponse_t structure. */
-
-lwres_result_t
-lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp)
-{
- lwres_result_t ret;
- unsigned int x;
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- lwres_gabnresponse_t *gabn;
- lwres_addrlist_t addrlist;
- lwres_addr_t *addr;
-
- REQUIRE(ctx != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- gabn = NULL;
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) == 0)
- return (LWRES_R_FAILURE);
-
- /*
- * Pull off the name itself
- */
- if (!SPACE_REMAINING(b, 4 + 2 + 2))
- return (LWRES_R_UNEXPECTEDEND);
- flags = lwres_buffer_getuint32(b);
- naliases = lwres_buffer_getuint16(b);
- naddrs = lwres_buffer_getuint16(b);
-
- gabn = CTXMALLOC(sizeof(lwres_gabnresponse_t));
- if (gabn == NULL)
- return (LWRES_R_NOMEMORY);
- gabn->aliases = NULL;
- gabn->aliaslen = NULL;
- LWRES_LIST_INIT(gabn->addrs);
- gabn->base = NULL;
-
- gabn->flags = flags;
- gabn->naliases = naliases;
- gabn->naddrs = naddrs;
-
- LWRES_LIST_INIT(addrlist);
-
- if (naliases > 0) {
- gabn->aliases = CTXMALLOC(sizeof(char *) * naliases);
- if (gabn->aliases == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- gabn->aliaslen = CTXMALLOC(sizeof(lwres_uint16_t) * naliases);
- if (gabn->aliaslen == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
- }
-
- for (x = 0; x < naddrs; x++) {
- addr = CTXMALLOC(sizeof(lwres_addr_t));
- if (addr == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
- LWRES_LINK_INIT(addr, link);
- LWRES_LIST_APPEND(addrlist, addr, link);
- }
-
- /*
- * Now, pull off the real name.
- */
- ret = lwres_string_parse(b, &gabn->realname, &gabn->realnamelen);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- /*
- * Parse off the aliases.
- */
- for (x = 0; x < gabn->naliases; x++) {
- ret = lwres_string_parse(b, &gabn->aliases[x],
- &gabn->aliaslen[x]);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- }
-
- /*
- * Pull off the addresses. We already strung the linked list
- * up above.
- */
- addr = LWRES_LIST_HEAD(addrlist);
- for (x = 0; x < gabn->naddrs; x++) {
- INSIST(addr != NULL);
- ret = lwres_addr_parse(b, addr);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- addr = LWRES_LIST_NEXT(addr, link);
- }
-
- if (LWRES_BUFFER_REMAINING(b) != 0) {
- ret = LWRES_R_TRAILINGDATA;
- goto out;
- }
-
- gabn->addrs = addrlist;
-
- *structp = gabn;
- return (LWRES_R_SUCCESS);
-
- out:
- if (gabn != NULL) {
- if (gabn->aliases != NULL)
- CTXFREE(gabn->aliases, sizeof(char *) * naliases);
- if (gabn->aliaslen != NULL)
- CTXFREE(gabn->aliaslen,
- sizeof(lwres_uint16_t) * naliases);
- addr = LWRES_LIST_HEAD(addrlist);
- while (addr != NULL) {
- LWRES_LIST_UNLINK(addrlist, addr, link);
- CTXFREE(addr, sizeof(lwres_addr_t));
- addr = LWRES_LIST_HEAD(addrlist);
- }
- CTXFREE(gabn, sizeof(lwres_gabnresponse_t));
- }
-
- return (ret);
-}
-
-/*% Release the memory in resolver context ctx that was allocated to the lwres_gabnrequest_t. */
-void
-lwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp)
-{
- lwres_gabnrequest_t *gabn;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- gabn = *structp;
- *structp = NULL;
-
- CTXFREE(gabn, sizeof(lwres_gabnrequest_t));
-}
-
-/*% Release the memory in resolver context ctx that was allocated to the lwres_gabnresponse_t. */
-void
-lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp)
-{
- lwres_gabnresponse_t *gabn;
- lwres_addr_t *addr;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- gabn = *structp;
- *structp = NULL;
-
- if (gabn->naliases > 0) {
- CTXFREE(gabn->aliases, sizeof(char *) * gabn->naliases);
- CTXFREE(gabn->aliaslen,
- sizeof(lwres_uint16_t) * gabn->naliases);
- }
- addr = LWRES_LIST_HEAD(gabn->addrs);
- while (addr != NULL) {
- LWRES_LIST_UNLINK(gabn->addrs, addr, link);
- CTXFREE(addr, sizeof(lwres_addr_t));
- addr = LWRES_LIST_HEAD(gabn->addrs);
- }
- if (gabn->base != NULL)
- CTXFREE(gabn->base, gabn->baselen);
- CTXFREE(gabn, sizeof(lwres_gabnresponse_t));
-}
diff --git a/usr.sbin/bind/lib/lwres/lwres_gnba.c b/usr.sbin/bind/lib/lwres/lwres_gnba.c
deleted file mode 100644
index a0a346dad55..00000000000
--- a/usr.sbin/bind/lib/lwres/lwres_gnba.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwres_gnba.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file lwres_gnba.c
- These are low-level routines for creating and parsing lightweight
- resolver address-to-name lookup request and response messages.
-
- There are four main functions for the getnamebyaddr opcode. One
- render function converts a getnamebyaddr request structure --
- lwres_gnbarequest_t -- to the lightweight resolver's canonical
- format. It is complemented by a parse function that converts a
- packet in this canonical format to a getnamebyaddr request
- structure. Another render function converts the getnamebyaddr
- response structure -- lwres_gnbaresponse_t to the canonical format.
- This is complemented by a parse function which converts a packet in
- canonical format to a getnamebyaddr response structure.
-
- These structures are defined in \link lwres.h <lwres/lwres.h.>\endlink They are shown
- below.
-
-\code
-#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
-
-typedef struct {
- lwres_uint32_t flags;
- lwres_addr_t addr;
-} lwres_gnbarequest_t;
-
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- void *base;
- size_t baselen;
-} lwres_gnbaresponse_t;
-\endcode
-
- lwres_gnbarequest_render() uses resolver context ctx to convert
- getnamebyaddr request structure req to canonical format. The packet
- header structure pkt is initialised and transferred to buffer b.
- The contents of *req are then appended to the buffer in canonical
- format. lwres_gnbaresponse_render() performs the same task, except
- it converts a getnamebyaddr response structure lwres_gnbaresponse_t
- to the lightweight resolver's canonical format.
-
- lwres_gnbarequest_parse() uses context ctx to convert the contents
- of packet pkt to a lwres_gnbarequest_t structure. Buffer b provides
- space to be used for storing this structure. When the function
- succeeds, the resulting lwres_gnbarequest_t is made available
- through *structp. lwres_gnbaresponse_parse() offers the same
-semantics as lwres_gnbarequest_parse() except it yields a
- lwres_gnbaresponse_t structure.
-
- lwres_gnbaresponse_free() and lwres_gnbarequest_free() release the
- memory in resolver context ctx that was allocated to the
- lwres_gnbaresponse_t or lwres_gnbarequest_t structures referenced
- via structp. Any memory associated with ancillary buffers and
- strings for those structures is also discarded.
-
-\section lwres_gbna_return Return Values
-
- The getnamebyaddr opcode functions lwres_gnbarequest_render(),
- lwres_gnbaresponse_render() lwres_gnbarequest_parse() and
- lwres_gnbaresponse_parse() all return #LWRES_R_SUCCESS on success.
- They return #LWRES_R_NOMEMORY if memory allocation fails.
- #LWRES_R_UNEXPECTEDEND is returned if the available space in the
- buffer b is too small to accommodate the packet header or the
- lwres_gnbarequest_t and lwres_gnbaresponse_t structures.
- lwres_gnbarequest_parse() and lwres_gnbaresponse_parse() will
- return #LWRES_R_UNEXPECTEDEND if the buffer is not empty after
- decoding the received packet. These functions will return
- #LWRES_R_FAILURE if pktflags in the packet header structure
- #lwres_lwpacket_t indicate that the packet is not a response to an
- earlier query.
-
-\section lwres_gbna_see See Also
-
- \link lwpacket.c lwres_packet\endlink
-
- */
-
-#include <config.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <lwres/lwbuffer.h>
-#include <lwres/lwpacket.h>
-#include <lwres/lwres.h>
-#include <lwres/result.h>
-
-#include "context_p.h"
-#include "assert_p.h"
-
-/*% Uses resolver context ctx to convert getnamebyaddr request structure req to canonical format. */
-lwres_result_t
-lwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(req->addr.family != 0);
- REQUIRE(req->addr.length != 0);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- payload_length = 4 + 4 + 2 + + req->addr.length;
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags &= ~LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_GETNAMEBYADDR;
- pkt->result = 0;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- INSIST(SPACE_OK(b, payload_length));
-
- /*
- * Put the length and the data. We know this will fit because we
- * just checked for it.
- */
- lwres_buffer_putuint32(b, req->flags);
- lwres_buffer_putuint32(b, req->addr.family);
- lwres_buffer_putuint16(b, req->addr.length);
- lwres_buffer_putmem(b, (unsigned char *)req->addr.address,
- req->addr.length);
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Converts a getnamebyaddr response structure lwres_gnbaresponse_t to the lightweight resolver's canonical format. */
-lwres_result_t
-lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
- lwres_uint16_t datalen;
- int x;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- /*
- * Calculate packet size.
- */
- payload_length = 4; /* flags */
- payload_length += 2; /* naliases */
- payload_length += 2 + req->realnamelen + 1; /* real name encoding */
- for (x = 0; x < req->naliases; x++) /* each alias */
- payload_length += 2 + req->aliaslen[x] + 1;
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags |= LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_GETNAMEBYADDR;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- INSIST(SPACE_OK(b, payload_length));
- lwres_buffer_putuint32(b, req->flags);
-
- /* encode naliases */
- lwres_buffer_putuint16(b, req->naliases);
-
- /* encode the real name */
- datalen = req->realnamelen;
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->realname, datalen);
- lwres_buffer_putuint8(b, 0);
-
- /* encode the aliases */
- for (x = 0; x < req->naliases; x++) {
- datalen = req->aliaslen[x];
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->aliases[x],
- datalen);
- lwres_buffer_putuint8(b, 0);
- }
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Uses context ctx to convert the contents of packet pkt to a lwres_gnbarequest_t structure. */
-lwres_result_t
-lwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp)
-{
- int ret;
- lwres_gnbarequest_t *gnba;
-
- REQUIRE(ctx != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) != 0)
- return (LWRES_R_FAILURE);
-
- if (!SPACE_REMAINING(b, 4))
- return (LWRES_R_UNEXPECTEDEND);
-
- gnba = CTXMALLOC(sizeof(lwres_gnbarequest_t));
- if (gnba == NULL)
- return (LWRES_R_NOMEMORY);
-
- gnba->flags = lwres_buffer_getuint32(b);
-
- ret = lwres_addr_parse(b, &gnba->addr);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- if (LWRES_BUFFER_REMAINING(b) != 0) {
- ret = LWRES_R_TRAILINGDATA;
- goto out;
- }
-
- *structp = gnba;
- return (LWRES_R_SUCCESS);
-
- out:
- if (gnba != NULL)
- lwres_gnbarequest_free(ctx, &gnba);
-
- return (ret);
-}
-
-/*% Offers the same semantics as lwres_gnbarequest_parse() except it yields a lwres_gnbaresponse_t structure. */
-
-lwres_result_t
-lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp)
-{
- int ret;
- unsigned int x;
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_gnbaresponse_t *gnba;
-
- REQUIRE(ctx != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- gnba = NULL;
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) == 0)
- return (LWRES_R_FAILURE);
-
- /*
- * Pull off flags & naliases
- */
- if (!SPACE_REMAINING(b, 4 + 2))
- return (LWRES_R_UNEXPECTEDEND);
- flags = lwres_buffer_getuint32(b);
- naliases = lwres_buffer_getuint16(b);
-
- gnba = CTXMALLOC(sizeof(lwres_gnbaresponse_t));
- if (gnba == NULL)
- return (LWRES_R_NOMEMORY);
- gnba->base = NULL;
- gnba->aliases = NULL;
- gnba->aliaslen = NULL;
-
- gnba->flags = flags;
- gnba->naliases = naliases;
-
- if (naliases > 0) {
- gnba->aliases = CTXMALLOC(sizeof(char *) * naliases);
- if (gnba->aliases == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- gnba->aliaslen = CTXMALLOC(sizeof(lwres_uint16_t) * naliases);
- if (gnba->aliaslen == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
- }
-
- /*
- * Now, pull off the real name.
- */
- ret = lwres_string_parse(b, &gnba->realname, &gnba->realnamelen);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- /*
- * Parse off the aliases.
- */
- for (x = 0; x < gnba->naliases; x++) {
- ret = lwres_string_parse(b, &gnba->aliases[x],
- &gnba->aliaslen[x]);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- }
-
- if (LWRES_BUFFER_REMAINING(b) != 0) {
- ret = LWRES_R_TRAILINGDATA;
- goto out;
- }
-
- *structp = gnba;
- return (LWRES_R_SUCCESS);
-
- out:
- if (gnba != NULL) {
- if (gnba->aliases != NULL)
- CTXFREE(gnba->aliases, sizeof(char *) * naliases);
- if (gnba->aliaslen != NULL)
- CTXFREE(gnba->aliaslen,
- sizeof(lwres_uint16_t) * naliases);
- CTXFREE(gnba, sizeof(lwres_gnbaresponse_t));
- }
-
- return (ret);
-}
-
-/*% Release the memory in resolver context ctx that was allocated to the lwres_gnbarequest_t. */
-void
-lwres_gnbarequest_free(lwres_context_t *ctx, lwres_gnbarequest_t **structp)
-{
- lwres_gnbarequest_t *gnba;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- gnba = *structp;
- *structp = NULL;
-
- CTXFREE(gnba, sizeof(lwres_gnbarequest_t));
-}
-
-/*% Release the memory in resolver context ctx that was allocated to the lwres_gnbaresponse_t. */
-void
-lwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp)
-{
- lwres_gnbaresponse_t *gnba;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- gnba = *structp;
- *structp = NULL;
-
- if (gnba->naliases > 0) {
- CTXFREE(gnba->aliases, sizeof(char *) * gnba->naliases);
- CTXFREE(gnba->aliaslen,
- sizeof(lwres_uint16_t) * gnba->naliases);
- }
- if (gnba->base != NULL)
- CTXFREE(gnba->base, gnba->baselen);
- CTXFREE(gnba, sizeof(lwres_gnbaresponse_t));
-}
diff --git a/usr.sbin/bind/lib/lwres/lwres_grbn.c b/usr.sbin/bind/lib/lwres/lwres_grbn.c
deleted file mode 100644
index aff24328b38..00000000000
--- a/usr.sbin/bind/lib/lwres/lwres_grbn.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwres_grbn.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file lwres_grbn.c
-
- */
-
-#include <config.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <lwres/lwbuffer.h>
-#include <lwres/lwpacket.h>
-#include <lwres/lwres.h>
-#include <lwres/result.h>
-
-#include "context_p.h"
-#include "assert_p.h"
-
-/*% Thread-save equivalent to \link lwres_gabn.c lwres_gabn* \endlink routines. */
-lwres_result_t
-lwres_grbnrequest_render(lwres_context_t *ctx, lwres_grbnrequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
- lwres_uint16_t datalen;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(req->name != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- datalen = strlen(req->name);
-
- payload_length = 4 + 2 + 2 + 2 + req->namelen + 1;
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
-
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags &= ~LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_GETRDATABYNAME;
- pkt->result = 0;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- INSIST(SPACE_OK(b, payload_length));
-
- /*
- * Flags.
- */
- lwres_buffer_putuint32(b, req->flags);
-
- /*
- * Class.
- */
- lwres_buffer_putuint16(b, req->rdclass);
-
- /*
- * Type.
- */
- lwres_buffer_putuint16(b, req->rdtype);
-
- /*
- * Put the length and the data. We know this will fit because we
- * just checked for it.
- */
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->name, datalen);
- lwres_buffer_putuint8(b, 0); /* trailing NUL */
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Thread-save equivalent to \link lwres_gabn.c lwres_gabn* \endlink routines. */
-lwres_result_t
-lwres_grbnresponse_render(lwres_context_t *ctx, lwres_grbnresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
- lwres_uint16_t datalen;
- int x;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- /* flags, class, type, ttl, nrdatas, nsigs */
- payload_length = 4 + 2 + 2 + 4 + 2 + 2;
- /* real name encoding */
- payload_length += 2 + req->realnamelen + 1;
- /* each rr */
- for (x = 0; x < req->nrdatas; x++)
- payload_length += 2 + req->rdatalen[x];
- for (x = 0; x < req->nsigs; x++)
- payload_length += 2 + req->siglen[x];
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags |= LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_GETRDATABYNAME;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- /*
- * Check space needed here.
- */
- INSIST(SPACE_OK(b, payload_length));
-
- /* Flags. */
- lwres_buffer_putuint32(b, req->flags);
-
- /* encode class, type, ttl, and nrdatas */
- lwres_buffer_putuint16(b, req->rdclass);
- lwres_buffer_putuint16(b, req->rdtype);
- lwres_buffer_putuint32(b, req->ttl);
- lwres_buffer_putuint16(b, req->nrdatas);
- lwres_buffer_putuint16(b, req->nsigs);
-
- /* encode the real name */
- datalen = req->realnamelen;
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, (unsigned char *)req->realname, datalen);
- lwres_buffer_putuint8(b, 0);
-
- /* encode the rdatas */
- for (x = 0; x < req->nrdatas; x++) {
- datalen = req->rdatalen[x];
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, req->rdatas[x], datalen);
- }
-
- /* encode the signatures */
- for (x = 0; x < req->nsigs; x++) {
- datalen = req->siglen[x];
- lwres_buffer_putuint16(b, datalen);
- lwres_buffer_putmem(b, req->sigs[x], datalen);
- }
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
- INSIST(LWRES_BUFFER_USEDCOUNT(b) == pkt->length);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Thread-save equivalent to \link lwres_gabn.c lwres_gabn* \endlink routines. */
-lwres_result_t
-lwres_grbnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_grbnrequest_t **structp)
-{
- int ret;
- char *name;
- lwres_grbnrequest_t *grbn;
- lwres_uint32_t flags;
- lwres_uint16_t rdclass, rdtype;
- lwres_uint16_t namelen;
-
- REQUIRE(ctx != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) != 0)
- return (LWRES_R_FAILURE);
-
- if (!SPACE_REMAINING(b, 4 + 2 + 2))
- return (LWRES_R_UNEXPECTEDEND);
-
- /*
- * Pull off the flags, class, and type.
- */
- flags = lwres_buffer_getuint32(b);
- rdclass = lwres_buffer_getuint16(b);
- rdtype = lwres_buffer_getuint16(b);
-
- /*
- * Pull off the name itself
- */
- ret = lwres_string_parse(b, &name, &namelen);
- if (ret != LWRES_R_SUCCESS)
- return (ret);
-
- if (LWRES_BUFFER_REMAINING(b) != 0)
- return (LWRES_R_TRAILINGDATA);
-
- grbn = CTXMALLOC(sizeof(lwres_grbnrequest_t));
- if (grbn == NULL)
- return (LWRES_R_NOMEMORY);
-
- grbn->flags = flags;
- grbn->rdclass = rdclass;
- grbn->rdtype = rdtype;
- grbn->name = name;
- grbn->namelen = namelen;
-
- *structp = grbn;
- return (LWRES_R_SUCCESS);
-}
-
-/*% Thread-safe equivalent to \link lwres_gabn.c lwres_gabn* \endlink routines. */
-lwres_result_t
-lwres_grbnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_grbnresponse_t **structp)
-{
- lwres_result_t ret;
- unsigned int x;
- lwres_uint32_t flags;
- lwres_uint16_t rdclass, rdtype;
- lwres_uint32_t ttl;
- lwres_uint16_t nrdatas, nsigs;
- lwres_grbnresponse_t *grbn;
-
- REQUIRE(ctx != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- grbn = NULL;
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) == 0)
- return (LWRES_R_FAILURE);
-
- /*
- * Pull off the flags, class, type, ttl, nrdatas, and nsigs
- */
- if (!SPACE_REMAINING(b, 4 + 2 + 2 + 4 + 2 + 2))
- return (LWRES_R_UNEXPECTEDEND);
- flags = lwres_buffer_getuint32(b);
- rdclass = lwres_buffer_getuint16(b);
- rdtype = lwres_buffer_getuint16(b);
- ttl = lwres_buffer_getuint32(b);
- nrdatas = lwres_buffer_getuint16(b);
- nsigs = lwres_buffer_getuint16(b);
-
- /*
- * Pull off the name itself
- */
-
- grbn = CTXMALLOC(sizeof(lwres_grbnresponse_t));
- if (grbn == NULL)
- return (LWRES_R_NOMEMORY);
- grbn->rdatas = NULL;
- grbn->rdatalen = NULL;
- grbn->sigs = NULL;
- grbn->siglen = NULL;
- grbn->base = NULL;
-
- grbn->flags = flags;
- grbn->rdclass = rdclass;
- grbn->rdtype = rdtype;
- grbn->ttl = ttl;
- grbn->nrdatas = nrdatas;
- grbn->nsigs = nsigs;
-
- if (nrdatas > 0) {
- grbn->rdatas = CTXMALLOC(sizeof(char *) * nrdatas);
- if (grbn->rdatas == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- grbn->rdatalen = CTXMALLOC(sizeof(lwres_uint16_t) * nrdatas);
- if (grbn->rdatalen == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
- }
-
- if (nsigs > 0) {
- grbn->sigs = CTXMALLOC(sizeof(char *) * nsigs);
- if (grbn->sigs == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- grbn->siglen = CTXMALLOC(sizeof(lwres_uint16_t) * nsigs);
- if (grbn->siglen == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
- }
-
- /*
- * Now, pull off the real name.
- */
- ret = lwres_string_parse(b, &grbn->realname, &grbn->realnamelen);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- /*
- * Parse off the rdatas.
- */
- for (x = 0; x < grbn->nrdatas; x++) {
- ret = lwres_data_parse(b, &grbn->rdatas[x],
- &grbn->rdatalen[x]);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- }
-
- /*
- * Parse off the signatures.
- */
- for (x = 0; x < grbn->nsigs; x++) {
- ret = lwres_data_parse(b, &grbn->sigs[x], &grbn->siglen[x]);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- }
-
- if (LWRES_BUFFER_REMAINING(b) != 0) {
- ret = LWRES_R_TRAILINGDATA;
- goto out;
- }
-
- *structp = grbn;
- return (LWRES_R_SUCCESS);
-
- out:
- if (grbn != NULL) {
- if (grbn->rdatas != NULL)
- CTXFREE(grbn->rdatas, sizeof(char *) * nrdatas);
- if (grbn->rdatalen != NULL)
- CTXFREE(grbn->rdatalen,
- sizeof(lwres_uint16_t) * nrdatas);
- if (grbn->sigs != NULL)
- CTXFREE(grbn->sigs, sizeof(char *) * nsigs);
- if (grbn->siglen != NULL)
- CTXFREE(grbn->siglen, sizeof(lwres_uint16_t) * nsigs);
- CTXFREE(grbn, sizeof(lwres_grbnresponse_t));
- }
-
- return (ret);
-}
-
-/*% Thread-save equivalent to \link lwres_gabn.c lwres_gabn* \endlink routines. */
-void
-lwres_grbnrequest_free(lwres_context_t *ctx, lwres_grbnrequest_t **structp)
-{
- lwres_grbnrequest_t *grbn;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- grbn = *structp;
- *structp = NULL;
-
- CTXFREE(grbn, sizeof(lwres_grbnrequest_t));
-}
-
-/*% Thread-save equivalent to \link lwres_gabn.c lwres_gabn* \endlink routines. */
-void
-lwres_grbnresponse_free(lwres_context_t *ctx, lwres_grbnresponse_t **structp)
-{
- lwres_grbnresponse_t *grbn;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- grbn = *structp;
- *structp = NULL;
-
- if (grbn->nrdatas > 0) {
- CTXFREE(grbn->rdatas, sizeof(char *) * grbn->nrdatas);
- CTXFREE(grbn->rdatalen,
- sizeof(lwres_uint16_t) * grbn->nrdatas);
- }
- if (grbn->nsigs > 0) {
- CTXFREE(grbn->sigs, sizeof(char *) * grbn->nsigs);
- CTXFREE(grbn->siglen, sizeof(lwres_uint16_t) * grbn->nsigs);
- }
- if (grbn->base != NULL)
- CTXFREE(grbn->base, grbn->baselen);
- CTXFREE(grbn, sizeof(lwres_grbnresponse_t));
-}
diff --git a/usr.sbin/bind/lib/lwres/lwres_noop.c b/usr.sbin/bind/lib/lwres/lwres_noop.c
deleted file mode 100644
index 01c30bd3e94..00000000000
--- a/usr.sbin/bind/lib/lwres/lwres_noop.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwres_noop.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * These are low-level routines for creating and parsing lightweight
- * resolver no-op request and response messages.
- *
- * The no-op message is analogous to a ping packet: a packet is sent to
- * the resolver daemon and is simply echoed back. The opcode is intended
- * to allow a client to determine if the server is operational or not.
- *
- * There are four main functions for the no-op opcode. One render
- * function converts a no-op request structure -- lwres_nooprequest_t --
- * to the lighweight resolver's canonical format. It is complemented by a
- * parse function that converts a packet in this canonical format to a
- * no-op request structure. Another render function converts the no-op
- * response structure -- lwres_noopresponse_t to the canonical format.
- * This is complemented by a parse function which converts a packet in
- * canonical format to a no-op response structure.
- *
- * These structures are defined in \link lwres.h <lwres/lwres.h.> \endlink They are shown below.
- *
- * \code
- * #define LWRES_OPCODE_NOOP 0x00000000U
- *
- * typedef struct {
- * lwres_uint16_t datalength;
- * unsigned char *data;
- * } lwres_nooprequest_t;
- *
- * typedef struct {
- * lwres_uint16_t datalength;
- * unsigned char *data;
- * } lwres_noopresponse_t;
- * \endcode
- *
- * Although the structures have different types, they are identical. This
- * is because the no-op opcode simply echos whatever data was sent: the
- * response is therefore identical to the request.
- *
- * lwres_nooprequest_render() uses resolver context ctx to convert no-op
- * request structure req to canonical format. The packet header structure
- * pkt is initialised and transferred to buffer b. The contents of *req
- * are then appended to the buffer in canonical format.
- * lwres_noopresponse_render() performs the same task, except it converts
- * a no-op response structure lwres_noopresponse_t to the lightweight
- * resolver's canonical format.
- *
- * lwres_nooprequest_parse() uses context ctx to convert the contents of
- * packet pkt to a lwres_nooprequest_t structure. Buffer b provides space
- * to be used for storing this structure. When the function succeeds, the
- * resulting lwres_nooprequest_t is made available through *structp.
- * lwres_noopresponse_parse() offers the same semantics as
- * lwres_nooprequest_parse() except it yields a lwres_noopresponse_t
- * structure.
- *
- * lwres_noopresponse_free() and lwres_nooprequest_free() release the
- * memory in resolver context ctx that was allocated to the
- * lwres_noopresponse_t or lwres_nooprequest_t structures referenced via
- * structp.
- *
- * \section lwres_noop_return Return Values
- *
- * The no-op opcode functions lwres_nooprequest_render(),
- * lwres_noopresponse_render() lwres_nooprequest_parse() and
- * lwres_noopresponse_parse() all return #LWRES_R_SUCCESS on success. They
- * return #LWRES_R_NOMEMORY if memory allocation fails.
- * #LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer
- * b is too small to accommodate the packet header or the
- * lwres_nooprequest_t and lwres_noopresponse_t structures.
- * lwres_nooprequest_parse() and lwres_noopresponse_parse() will return
- * #LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the
- * received packet. These functions will return #LWRES_R_FAILURE if
- * pktflags in the packet header structure #lwres_lwpacket_t indicate that
- * the packet is not a response to an earlier query.
- *
- * \section lwres_noop_see See Also
- *
- * lwpacket.c
- */
-
-#include <config.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <lwres/lwbuffer.h>
-#include <lwres/lwpacket.h>
-#include <lwres/lwres.h>
-#include <lwres/result.h>
-
-#include "context_p.h"
-#include "assert_p.h"
-
-/*% Uses resolver context ctx to convert no-op request structure req to canonical format. */
-lwres_result_t
-lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- payload_length = sizeof(lwres_uint16_t) + req->datalength;
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags &= ~LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_NOOP;
- pkt->result = 0;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- INSIST(SPACE_OK(b, payload_length));
-
- /*
- * Put the length and the data. We know this will fit because we
- * just checked for it.
- */
- lwres_buffer_putuint16(b, req->datalength);
- lwres_buffer_putmem(b, req->data, req->datalength);
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Converts a no-op response structure lwres_noopresponse_t to the lightweight resolver's canonical format. */
-
-lwres_result_t
-lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req,
- lwres_lwpacket_t *pkt, lwres_buffer_t *b)
-{
- unsigned char *buf;
- size_t buflen;
- int ret;
- size_t payload_length;
-
- REQUIRE(ctx != NULL);
- REQUIRE(req != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(b != NULL);
-
- payload_length = sizeof(lwres_uint16_t) + req->datalength;
-
- buflen = LWRES_LWPACKET_LENGTH + payload_length;
- buf = CTXMALLOC(buflen);
- if (buf == NULL)
- return (LWRES_R_NOMEMORY);
- lwres_buffer_init(b, buf, (unsigned int)buflen);
-
- pkt->length = (lwres_uint32_t)buflen;
- pkt->version = LWRES_LWPACKETVERSION_0;
- pkt->pktflags |= LWRES_LWPACKETFLAG_RESPONSE;
- pkt->opcode = LWRES_OPCODE_NOOP;
- pkt->authtype = 0;
- pkt->authlength = 0;
-
- ret = lwres_lwpacket_renderheader(b, pkt);
- if (ret != LWRES_R_SUCCESS) {
- lwres_buffer_invalidate(b);
- CTXFREE(buf, buflen);
- return (ret);
- }
-
- INSIST(SPACE_OK(b, payload_length));
-
- /*
- * Put the length and the data. We know this will fit because we
- * just checked for it.
- */
- lwres_buffer_putuint16(b, req->datalength);
- lwres_buffer_putmem(b, req->data, req->datalength);
-
- INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Uses context ctx to convert the contents of packet pkt to a lwres_nooprequest_t structure. */
-lwres_result_t
-lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp)
-{
- int ret;
- lwres_nooprequest_t *req;
-
- REQUIRE(ctx != NULL);
- REQUIRE(b != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) != 0)
- return (LWRES_R_FAILURE);
-
- req = CTXMALLOC(sizeof(lwres_nooprequest_t));
- if (req == NULL)
- return (LWRES_R_NOMEMORY);
-
- if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t))) {
- ret = LWRES_R_UNEXPECTEDEND;
- goto out;
- }
- req->datalength = lwres_buffer_getuint16(b);
-
- if (!SPACE_REMAINING(b, req->datalength)) {
- ret = LWRES_R_UNEXPECTEDEND;
- goto out;
- }
- req->data = b->base + b->current;
- lwres_buffer_forward(b, req->datalength);
-
- if (LWRES_BUFFER_REMAINING(b) != 0) {
- ret = LWRES_R_TRAILINGDATA;
- goto out;
- }
-
- /* success! */
- *structp = req;
- return (LWRES_R_SUCCESS);
-
- /* Error return */
- out:
- CTXFREE(req, sizeof(lwres_nooprequest_t));
- return (ret);
-}
-
-/*% Offers the same semantics as lwres_nooprequest_parse() except it yields a lwres_noopresponse_t structure. */
-lwres_result_t
-lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
- lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp)
-{
- int ret;
- lwres_noopresponse_t *req;
-
- REQUIRE(ctx != NULL);
- REQUIRE(b != NULL);
- REQUIRE(pkt != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- if ((pkt->pktflags & LWRES_LWPACKETFLAG_RESPONSE) == 0)
- return (LWRES_R_FAILURE);
-
- req = CTXMALLOC(sizeof(lwres_noopresponse_t));
- if (req == NULL)
- return (LWRES_R_NOMEMORY);
-
- if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t))) {
- ret = LWRES_R_UNEXPECTEDEND;
- goto out;
- }
- req->datalength = lwres_buffer_getuint16(b);
-
- if (!SPACE_REMAINING(b, req->datalength)) {
- ret = LWRES_R_UNEXPECTEDEND;
- goto out;
- }
- req->data = b->base + b->current;
-
- lwres_buffer_forward(b, req->datalength);
- if (LWRES_BUFFER_REMAINING(b) != 0) {
- ret = LWRES_R_TRAILINGDATA;
- goto out;
- }
-
- /* success! */
- *structp = req;
- return (LWRES_R_SUCCESS);
-
- /* Error return */
- out:
- CTXFREE(req, sizeof(lwres_noopresponse_t));
- return (ret);
-}
-
-/*% Release the memory in resolver context ctx. */
-void
-lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp)
-{
- lwres_noopresponse_t *noop;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- noop = *structp;
- *structp = NULL;
-
- CTXFREE(noop, sizeof(lwres_noopresponse_t));
-}
-
-/*% Release the memory in resolver context ctx. */
-void
-lwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp)
-{
- lwres_nooprequest_t *noop;
-
- REQUIRE(ctx != NULL);
- REQUIRE(structp != NULL && *structp != NULL);
-
- noop = *structp;
- *structp = NULL;
-
- CTXFREE(noop, sizeof(lwres_nooprequest_t));
-}
diff --git a/usr.sbin/bind/lib/lwres/lwresutil.c b/usr.sbin/bind/lib/lwres/lwresutil.c
deleted file mode 100644
index 29a3d6a073f..00000000000
--- a/usr.sbin/bind/lib/lwres/lwresutil.c
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: lwresutil.c,v 1.6 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-/**
- * lwres_string_parse() retrieves a DNS-encoded string starting the
- * current pointer of lightweight resolver buffer b: i.e. b->current.
- * When the function returns, the address of the first byte of the
- * encoded string is returned via *c and the length of that string is
- * given by *len. The buffer's current pointer is advanced to point at
- * the character following the string length, the encoded string, and
- * the trailing NULL character.
- *
- * lwres_addr_parse() extracts an address from the buffer b. The
- * buffer's current pointer b->current is presumed to point at an
- * encoded address: the address preceded by a 32-bit protocol family
- * identifier and a 16-bit length field. The encoded address is copied
- * to addr->address and addr->length indicates the size in bytes of
- * the address that was copied. b->current is advanced to point at the
- * next byte of available data in the buffer following the encoded
- * address.
- *
- * lwres_getaddrsbyname() and lwres_getnamebyaddr() use the
- * lwres_gnbaresponse_t structure defined below:
- *
- * \code
- * typedef struct {
- * lwres_uint32_t flags;
- * lwres_uint16_t naliases;
- * lwres_uint16_t naddrs;
- * char *realname;
- * char **aliases;
- * lwres_uint16_t realnamelen;
- * lwres_uint16_t *aliaslen;
- * lwres_addrlist_t addrs;
- * void *base;
- * size_t baselen;
- * } lwres_gabnresponse_t;
- * \endcode
- *
- * The contents of this structure are not manipulated directly but
- * they are controlled through the \link lwres_gabn.c lwres_gabn*\endlink functions.
- *
- * The lightweight resolver uses lwres_getaddrsbyname() to perform
- * foward lookups. Hostname name is looked up using the resolver
- * context ctx for memory allocation. addrtypes is a bitmask
- * indicating which type of addresses are to be looked up. Current
- * values for this bitmask are #LWRES_ADDRTYPE_V4 for IPv4 addresses
- * and #LWRES_ADDRTYPE_V6 for IPv6 addresses. Results of the lookup are
- * returned in *structp.
- *
- * lwres_getnamebyaddr() performs reverse lookups. Resolver context
- * ctx is used for memory allocation. The address type is indicated by
- * addrtype: #LWRES_ADDRTYPE_V4 or #LWRES_ADDRTYPE_V6. The address to be
- * looked up is given by addr and its length is addrlen bytes. The
- * result of the function call is made available through *structp.
- *
- * \section lwresutil_return Return Values
- *
- * Successful calls to lwres_string_parse() and lwres_addr_parse()
- * return #LWRES_R_SUCCESS. Both functions return #LWRES_R_FAILURE if
- * the buffer is corrupt or #LWRES_R_UNEXPECTEDEND if the buffer has
- * less space than expected for the components of the encoded string
- * or address.
- *
- * lwres_getaddrsbyname() returns #LWRES_R_SUCCESS on success and it
- * returns #LWRES_R_NOTFOUND if the hostname name could not be found.
- *
- * #LWRES_R_SUCCESS is returned by a successful call to
- * lwres_getnamebyaddr().
- *
- * Both lwres_getaddrsbyname() and lwres_getnamebyaddr() return
- * #LWRES_R_NOMEMORY when memory allocation requests fail and
- * #LWRES_R_UNEXPECTEDEND if the buffers used for sending queries and
- * receiving replies are too small.
- *
- * \section lwresutil_see See Also
- *
- * lwbuffer.c, lwres_gabn.c
- */
-
-#include <config.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <lwres/lwbuffer.h>
-#include <lwres/lwres.h>
-#include <lwres/result.h>
-
-#include "assert_p.h"
-#include "context_p.h"
-
-/*% Parse data. */
-/*!
- * Requires:
- *
- * The "current" pointer in "b" points to encoded raw data.
- *
- * Ensures:
- *
- * The address of the first byte of the data is returned via "p",
- * and the length is returned via "len". If NULL, they are not
- * set.
- *
- * On return, the current pointer of "b" will point to the character
- * following the data length and the data.
- *
- */
-lwres_result_t
-lwres_data_parse(lwres_buffer_t *b, unsigned char **p, lwres_uint16_t *len)
-{
- lwres_uint16_t datalen;
- unsigned char *data;
-
- REQUIRE(b != NULL);
-
- /*
- * Pull off the length (2 bytes)
- */
- if (!SPACE_REMAINING(b, 2))
- return (LWRES_R_UNEXPECTEDEND);
- datalen = lwres_buffer_getuint16(b);
-
- /*
- * Set the pointer to this string to the right place, then
- * advance the buffer pointer.
- */
- if (!SPACE_REMAINING(b, datalen))
- return (LWRES_R_UNEXPECTEDEND);
- data = b->base + b->current;
- lwres_buffer_forward(b, datalen);
-
- if (len != NULL)
- *len = datalen;
- if (p != NULL)
- *p = data;
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Retrieves a DNS-encoded string. */
-/*!
- * Requires:
- *
- * The "current" pointer in "b" point to an encoded string.
- *
- * Ensures:
- *
- * The address of the first byte of the string is returned via "c",
- * and the length is returned via "len". If NULL, they are not
- * set.
- *
- * On return, the current pointer of "b" will point to the character
- * following the string length, the string, and the trailing NULL.
- *
- */
-lwres_result_t
-lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len)
-{
- lwres_uint16_t datalen;
- char *string;
-
- REQUIRE(b != NULL);
-
- /*
- * Pull off the length (2 bytes)
- */
- if (!SPACE_REMAINING(b, 2))
- return (LWRES_R_UNEXPECTEDEND);
- datalen = lwres_buffer_getuint16(b);
-
- /*
- * Set the pointer to this string to the right place, then
- * advance the buffer pointer.
- */
- if (!SPACE_REMAINING(b, datalen))
- return (LWRES_R_UNEXPECTEDEND);
- string = (char *)b->base + b->current;
- lwres_buffer_forward(b, datalen);
-
- /*
- * Skip the "must be zero" byte.
- */
- if (!SPACE_REMAINING(b, 1))
- return (LWRES_R_UNEXPECTEDEND);
- if (0 != lwres_buffer_getuint8(b))
- return (LWRES_R_FAILURE);
-
- if (len != NULL)
- *len = datalen;
- if (c != NULL)
- *c = string;
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Extracts an address from the buffer b. */
-lwres_result_t
-lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr)
-{
- REQUIRE(addr != NULL);
-
- if (!SPACE_REMAINING(b, 6))
- return (LWRES_R_UNEXPECTEDEND);
-
- addr->family = lwres_buffer_getuint32(b);
- addr->length = lwres_buffer_getuint16(b);
-
- if (!SPACE_REMAINING(b, addr->length))
- return (LWRES_R_UNEXPECTEDEND);
- if (addr->length > LWRES_ADDR_MAXLEN)
- return (LWRES_R_FAILURE);
-
- lwres_buffer_getmem(b, addr->address, addr->length);
-
- return (LWRES_R_SUCCESS);
-}
-
-/*% Used to perform forward lookups. */
-lwres_result_t
-lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
- lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp)
-{
- lwres_gabnrequest_t request;
- lwres_gabnresponse_t *response;
- int ret;
- int recvlen;
- lwres_buffer_t b_in, b_out;
- lwres_lwpacket_t pkt;
- lwres_uint32_t serial;
- char *buffer;
- char target_name[1024];
- unsigned int target_length;
-
- REQUIRE(ctx != NULL);
- REQUIRE(name != NULL);
- REQUIRE(addrtypes != 0);
- REQUIRE(structp != NULL && *structp == NULL);
-
- b_in.base = NULL;
- b_out.base = NULL;
- response = NULL;
- buffer = NULL;
- serial = lwres_context_nextserial(ctx);
-
- buffer = CTXMALLOC(LWRES_RECVLENGTH);
- if (buffer == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- target_length = strlen(name);
- if (target_length >= sizeof(target_name))
- return (LWRES_R_FAILURE);
- strcpy(target_name, name); /* strcpy is safe */
-
- /*
- * Set up our request and render it to a buffer.
- */
- request.flags = 0;
- request.addrtypes = addrtypes;
- request.name = target_name;
- request.namelen = target_length;
- pkt.pktflags = 0;
- pkt.serial = serial;
- pkt.result = 0;
- pkt.recvlength = LWRES_RECVLENGTH;
-
- again:
- ret = lwres_gabnrequest_render(ctx, &request, &pkt, &b_out);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
- LWRES_RECVLENGTH, &recvlen);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- lwres_buffer_init(&b_in, buffer, recvlen);
- b_in.used = recvlen;
-
- /*
- * Parse the packet header.
- */
- ret = lwres_lwpacket_parseheader(&b_in, &pkt);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- /*
- * Sanity check.
- */
- if (pkt.serial != serial)
- goto again;
- if (pkt.opcode != LWRES_OPCODE_GETADDRSBYNAME)
- goto again;
-
- /*
- * Free what we've transmitted
- */
- CTXFREE(b_out.base, b_out.length);
- b_out.base = NULL;
- b_out.length = 0;
-
- if (pkt.result != LWRES_R_SUCCESS) {
- ret = pkt.result;
- goto out;
- }
-
- /*
- * Parse the response.
- */
- ret = lwres_gabnresponse_parse(ctx, &b_in, &pkt, &response);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- response->base = buffer;
- response->baselen = LWRES_RECVLENGTH;
- buffer = NULL; /* don't free this below */
-
- *structp = response;
- return (LWRES_R_SUCCESS);
-
- out:
- if (b_out.base != NULL)
- CTXFREE(b_out.base, b_out.length);
- if (buffer != NULL)
- CTXFREE(buffer, LWRES_RECVLENGTH);
- if (response != NULL)
- lwres_gabnresponse_free(ctx, &response);
-
- return (ret);
-}
-
-
-/*% Used to perform reverse lookups. */
-lwres_result_t
-lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype,
- lwres_uint16_t addrlen, const unsigned char *addr,
- lwres_gnbaresponse_t **structp)
-{
- lwres_gnbarequest_t request;
- lwres_gnbaresponse_t *response;
- int ret;
- int recvlen;
- lwres_buffer_t b_in, b_out;
- lwres_lwpacket_t pkt;
- lwres_uint32_t serial;
- char *buffer;
-
- REQUIRE(ctx != NULL);
- REQUIRE(addrtype != 0);
- REQUIRE(addrlen != 0);
- REQUIRE(addr != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- b_in.base = NULL;
- b_out.base = NULL;
- response = NULL;
- buffer = NULL;
- serial = lwres_context_nextserial(ctx);
-
- buffer = CTXMALLOC(LWRES_RECVLENGTH);
- if (buffer == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- /*
- * Set up our request and render it to a buffer.
- */
- request.flags = 0;
- request.addr.family = addrtype;
- request.addr.length = addrlen;
- memmove(request.addr.address, addr, addrlen);
- pkt.pktflags = 0;
- pkt.serial = serial;
- pkt.result = 0;
- pkt.recvlength = LWRES_RECVLENGTH;
-
- again:
- ret = lwres_gnbarequest_render(ctx, &request, &pkt, &b_out);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
- LWRES_RECVLENGTH, &recvlen);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- lwres_buffer_init(&b_in, buffer, recvlen);
- b_in.used = recvlen;
-
- /*
- * Parse the packet header.
- */
- ret = lwres_lwpacket_parseheader(&b_in, &pkt);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- /*
- * Sanity check.
- */
- if (pkt.serial != serial)
- goto again;
- if (pkt.opcode != LWRES_OPCODE_GETNAMEBYADDR)
- goto again;
-
- /*
- * Free what we've transmitted
- */
- CTXFREE(b_out.base, b_out.length);
- b_out.base = NULL;
- b_out.length = 0;
-
- if (pkt.result != LWRES_R_SUCCESS) {
- ret = pkt.result;
- goto out;
- }
-
- /*
- * Parse the response.
- */
- ret = lwres_gnbaresponse_parse(ctx, &b_in, &pkt, &response);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- response->base = buffer;
- response->baselen = LWRES_RECVLENGTH;
- buffer = NULL; /* don't free this below */
-
- *structp = response;
- return (LWRES_R_SUCCESS);
-
- out:
- if (b_out.base != NULL)
- CTXFREE(b_out.base, b_out.length);
- if (buffer != NULL)
- CTXFREE(buffer, LWRES_RECVLENGTH);
- if (response != NULL)
- lwres_gnbaresponse_free(ctx, &response);
-
- return (ret);
-}
-
-/*% Get rdata by name. */
-lwres_result_t
-lwres_getrdatabyname(lwres_context_t *ctx, const char *name,
- lwres_uint16_t rdclass, lwres_uint16_t rdtype,
- lwres_uint32_t flags, lwres_grbnresponse_t **structp)
-{
- int ret;
- int recvlen;
- lwres_buffer_t b_in, b_out;
- lwres_lwpacket_t pkt;
- lwres_uint32_t serial;
- char *buffer;
- lwres_grbnrequest_t request;
- lwres_grbnresponse_t *response;
- char target_name[1024];
- unsigned int target_length;
-
- REQUIRE(ctx != NULL);
- REQUIRE(name != NULL);
- REQUIRE(structp != NULL && *structp == NULL);
-
- b_in.base = NULL;
- b_out.base = NULL;
- response = NULL;
- buffer = NULL;
- serial = lwres_context_nextserial(ctx);
-
- buffer = CTXMALLOC(LWRES_RECVLENGTH);
- if (buffer == NULL) {
- ret = LWRES_R_NOMEMORY;
- goto out;
- }
-
- target_length = strlen(name);
- if (target_length >= sizeof(target_name))
- return (LWRES_R_FAILURE);
- strcpy(target_name, name); /* strcpy is safe */
-
- /*
- * Set up our request and render it to a buffer.
- */
- request.rdclass = rdclass;
- request.rdtype = rdtype;
- request.flags = flags;
- request.name = target_name;
- request.namelen = target_length;
- pkt.pktflags = 0;
- pkt.serial = serial;
- pkt.result = 0;
- pkt.recvlength = LWRES_RECVLENGTH;
-
- again:
- ret = lwres_grbnrequest_render(ctx, &request, &pkt, &b_out);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
- LWRES_RECVLENGTH, &recvlen);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- lwres_buffer_init(&b_in, buffer, recvlen);
- b_in.used = recvlen;
-
- /*
- * Parse the packet header.
- */
- ret = lwres_lwpacket_parseheader(&b_in, &pkt);
- if (ret != LWRES_R_SUCCESS)
- goto out;
-
- /*
- * Sanity check.
- */
- if (pkt.serial != serial)
- goto again;
- if (pkt.opcode != LWRES_OPCODE_GETRDATABYNAME)
- goto again;
-
- /*
- * Free what we've transmitted
- */
- CTXFREE(b_out.base, b_out.length);
- b_out.base = NULL;
- b_out.length = 0;
-
- if (pkt.result != LWRES_R_SUCCESS) {
- ret = pkt.result;
- goto out;
- }
-
- /*
- * Parse the response.
- */
- ret = lwres_grbnresponse_parse(ctx, &b_in, &pkt, &response);
- if (ret != LWRES_R_SUCCESS)
- goto out;
- response->base = buffer;
- response->baselen = LWRES_RECVLENGTH;
- buffer = NULL; /* don't free this below */
-
- *structp = response;
- return (LWRES_R_SUCCESS);
-
- out:
- if (b_out.base != NULL)
- CTXFREE(b_out.base, b_out.length);
- if (buffer != NULL)
- CTXFREE(buffer, LWRES_RECVLENGTH);
- if (response != NULL)
- lwres_grbnresponse_free(ctx, &response);
-
- return (ret);
-}
diff --git a/usr.sbin/bind/lib/lwres/man/Makefile.in b/usr.sbin/bind/lib/lwres/man/Makefile.in
deleted file mode 100644
index 43f3e4eae54..00000000000
--- a/usr.sbin/bind/lib/lwres/man/Makefile.in
+++ /dev/null
@@ -1,308 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:38 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-VERSION=@BIND9_VERSION@
-
-@BIND9_MAKE_RULES@
-
-# Alphabetically
-#MANPAGES = lwres.3 lwres_addr_parse.3 lwres_buffer.3 \
-# lwres_buffer_add.3 lwres_buffer_back.3 lwres_buffer_clear.3 \
-# lwres_buffer_first.3 lwres_buffer_forward.3 \
-# lwres_buffer_getmem.3 lwres_buffer_getuint16.3 \
-# lwres_buffer_getuint32.3 lwres_buffer_getuint8.3 \
-# lwres_buffer_init.3 lwres_buffer_invalidate.3 \
-# lwres_buffer_putmem.3 lwres_buffer_putuint16.3 \
-# lwres_buffer_putuint32.3 lwres_buffer_putuint8.3 \
-# lwres_buffer_subtract.3 lwres_conf_clear.3 \
-# lwres_conf_get.3 lwres_conf_init.3 \
-# lwres_conf_parse.3 lwres_conf_print.3 \
-# lwres_config.3 lwres_context.3 \
-# lwres_context_allocmem.3 lwres_context_create.3 \
-# lwres_context_destroy.3 lwres_context_freemem.3 \
-# lwres_context_initserial.3 lwres_context_nextserial.3 \
-# lwres_context_sendrecv.3 lwres_endhostent.3 \
-# lwres_endhostent_r.3 lwres_freeaddrinfo.3 \
-# lwres_freehostent.3 lwres_gabn.3 \
-# lwres_gabnrequest_free.3 lwres_gabnrequest_parse.3 \
-# lwres_gabnrequest_render.3 lwres_gabnresponse_free.3 \
-# lwres_gabnresponse_parse.3 lwres_gabnresponse_render.3 \
-# lwres_gai_strerror.3 lwres_getaddrinfo.3 \
-# lwres_getaddrsbyname.3 lwres_gethostbyaddr.3 \
-# lwres_gethostbyaddr_r.3 lwres_gethostbyname.3 \
-# lwres_gethostbyname2.3 lwres_gethostbyname_r.3 \
-# lwres_gethostent.3 lwres_gethostent_r.3 \
-# lwres_getipnode.3 lwres_getipnodebyaddr.3 \
-# lwres_getipnodebyname.3 lwres_getnamebyaddr.3 \
-# lwres_getnameinfo.3 lwres_getrrsetbyname.3 \
-# lwres_gnba.3 lwres_gnbarequest_free.3 \
-# lwres_gnbarequest_parse.3 lwres_gnbarequest_render.3 \
-# lwres_gnbaresponse_free.3 lwres_gnbaresponse_parse.3 \
-# lwres_gnbaresponse_render.3 lwres_herror.3 \
-# lwres_hstrerror.3 lwres_inetntop.3 \
-# lwres_lwpacket_parseheader.3 lwres_lwpacket_renderheader.3 \
-# lwres_net_ntop.3 lwres_noop.3 \
-# lwres_nooprequest_free.3 lwres_nooprequest_parse.3 \
-# lwres_nooprequest_render.3 lwres_noopresponse_free.3 \
-# lwres_noopresponse_parse.3 lwres_noopresponse_render.3 \
-# lwres_packet.3 lwres_resutil.3 \
-# lwres_sethostent.3 lwres_sethostent_r.3 \
-# lwres_string_parse.3
-
-
-MANPAGES = lwres.3 lwres_buffer.3 lwres_config.3 lwres_context.3 \
- lwres_gabn.3 lwres_gai_strerror.3 lwres_getaddrinfo.3 \
- lwres_gethostent.3 lwres_getipnode.3 lwres_getnameinfo.3 \
- lwres_getrrsetbyname.3 lwres_gnba.3 lwres_hstrerror.3 lwres_inetntop.3 \
- lwres_noop.3 lwres_packet.3 lwres_resutil.3
-
-HTMLPAGES = lwres.html lwres_buffer.html lwres_config.html lwres_context.html \
- lwres_gabn.html lwres_gai_strerror.html lwres_getaddrinfo.html \
- lwres_gethostent.html lwres_getipnode.html lwres_getnameinfo.html \
- lwres_getrrsetbyname.html lwres_gnba.html lwres_hstrerror.html lwres_inetntop.html \
- lwres_noop.html lwres_packet.html lwres_resutil.html
-
-MANOBJS = ${MANPAGES} ${HTMLPAGES}
-
-doc man:: ${MANOBJS}
-
-docclean manclean maintainer-clean::
- rm -f ${MANOBJS}
-
-clean::
- rm -f timestamp
-
-installdirs:
- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
-
-man3 = ${DESTDIR}${mandir}/man3
-
-timestamp: ${MANOBJS}
- touch timestamp
-
-install:: installdirs
- for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man3; done
- rm -f ${man3}/lwres_addr_parse.3
- @LN@ ${man3}/lwres_resutil.3 ${man3}/lwres_addr_parse.3
- rm -f ${man3}/lwres_buffer_add.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_add.3
- rm -f ${man3}/lwres_buffer_back.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_back.3
- rm -f ${man3}/lwres_buffer_clear.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_clear.3
- rm -f ${man3}/lwres_buffer_first.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_first.3
- rm -f ${man3}/lwres_buffer_forward.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_forward.3
- rm -f ${man3}/lwres_buffer_getmem.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_getmem.3
- rm -f ${man3}/lwres_buffer_getuint16.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_getuint16.3
- rm -f ${man3}/lwres_buffer_getuint32.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_getuint32.3
- rm -f ${man3}/lwres_buffer_getuint8.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_getuint8.3
- rm -f ${man3}/lwres_buffer_init.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_init.3
- rm -f ${man3}/lwres_buffer_invalidate.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_invalidate.3
- rm -f ${man3}/lwres_buffer_putmem.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_putmem.3
- rm -f ${man3}/lwres_buffer_putuint16.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_putuint16.3
- rm -f ${man3}/lwres_buffer_putuint32.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_putuint32.3
- rm -f ${man3}/lwres_buffer_putuint8.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_putuint8.3
- rm -f ${man3}/lwres_buffer_subtract.3
- @LN@ ${man3}/lwres_buffer.3 ${man3}/lwres_buffer_subtract.3
- rm -f ${man3}/lwres_conf_clear.3
- @LN@ ${man3}/lwres_config.3 ${man3}/lwres_conf_clear.3
- rm -f ${man3}/lwres_conf_get.3
- @LN@ ${man3}/lwres_config.3 ${man3}/lwres_conf_get.3
- rm -f ${man3}/lwres_conf_init.3
- @LN@ ${man3}/lwres_config.3 ${man3}/lwres_conf_init.3
- rm -f ${man3}/lwres_conf_parse.3
- @LN@ ${man3}/lwres_config.3 ${man3}/lwres_conf_parse.3
- rm -f ${man3}/lwres_conf_print.3
- @LN@ ${man3}/lwres_config.3 ${man3}/lwres_conf_print.3
- rm -f ${man3}/lwres_context_allocmem.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_allocmem.3
- rm -f ${man3}/lwres_context_create.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_create.3
- rm -f ${man3}/lwres_context_destroy.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_destroy.3
- rm -f ${man3}/lwres_context_freemem.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_freemem.3
- rm -f ${man3}/lwres_context_initserial.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_initserial.3
- rm -f ${man3}/lwres_context_nextserial.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_nextserial.3
- rm -f ${man3}/lwres_context_sendrecv.3
- @LN@ ${man3}/lwres_context.3 ${man3}/lwres_context_sendrecv.3
- rm -f ${man3}/lwres_endhostent.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_endhostent.3
- rm -f ${man3}/lwres_endhostent_r.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_endhostent_r.3
- rm -f ${man3}/lwres_freeaddrinfo.3
- @LN@ ${man3}/lwres_getaddrinfo.3 ${man3}/lwres_freeaddrinfo.3
- rm -f ${man3}/lwres_freehostent.3
- @LN@ ${man3}/lwres_getipnode.3 ${man3}/lwres_freehostent.3
- rm -f ${man3}/lwres_gabnrequest_free.3
- @LN@ ${man3}/lwres_gabn.3 ${man3}/lwres_gabnrequest_free.3
- rm -f ${man3}/lwres_gabnrequest_parse.3
- @LN@ ${man3}/lwres_gabn.3 ${man3}/lwres_gabnrequest_parse.3
- rm -f ${man3}/lwres_gabnrequest_render.3
- @LN@ ${man3}/lwres_gabn.3 ${man3}/lwres_gabnrequest_render.3
- rm -f ${man3}/lwres_gabnresponse_free.3
- @LN@ ${man3}/lwres_gabn.3 ${man3}/lwres_gabnresponse_free.3
- rm -f ${man3}/lwres_gabnresponse_parse.3
- @LN@ ${man3}/lwres_gabn.3 ${man3}/lwres_gabnresponse_parse.3
- rm -f ${man3}/lwres_gabnresponse_render.3
- @LN@ ${man3}/lwres_gabn.3 ${man3}/lwres_gabnresponse_render.3
- rm -f ${man3}/lwres_getaddrsbyname.3
- @LN@ ${man3}/lwres_resutil.3 ${man3}/lwres_getaddrsbyname.3
- rm -f ${man3}/lwres_gethostbyaddr.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_gethostbyaddr.3
- rm -f ${man3}/lwres_gethostbyaddr_r.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_gethostbyaddr_r.3
- rm -f ${man3}/lwres_gethostbyname.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_gethostbyname.3
- rm -f ${man3}/lwres_gethostbyname2.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_gethostbyname2.3
- rm -f ${man3}/lwres_gethostbyname_r.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_gethostbyname_r.3
- rm -f ${man3}/lwres_gethostent_r.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_gethostent_r.3
- rm -f ${man3}/lwres_getipnodebyaddr.3
- @LN@ ${man3}/lwres_getipnode.3 ${man3}/lwres_getipnodebyaddr.3
- rm -f ${man3}/lwres_getipnodebyname.3
- @LN@ ${man3}/lwres_getipnode.3 ${man3}/lwres_getipnodebyname.3
- rm -f ${man3}/lwres_getnamebyaddr.3
- @LN@ ${man3}/lwres_resutil.3 ${man3}/lwres_getnamebyaddr.3
- rm -f ${man3}/lwres_gnbarequest_free.3
- @LN@ ${man3}/lwres_gnba.3 ${man3}/lwres_gnbarequest_free.3
- rm -f ${man3}/lwres_gnbarequest_parse.3
- @LN@ ${man3}/lwres_gnba.3 ${man3}/lwres_gnbarequest_parse.3
- rm -f ${man3}/lwres_gnbarequest_render.3
- @LN@ ${man3}/lwres_gnba.3 ${man3}/lwres_gnbarequest_render.3
- rm -f ${man3}/lwres_gnbaresponse_free.3
- @LN@ ${man3}/lwres_gnba.3 ${man3}/lwres_gnbaresponse_free.3
- rm -f ${man3}/lwres_gnbaresponse_parse.3
- @LN@ ${man3}/lwres_gnba.3 ${man3}/lwres_gnbaresponse_parse.3
- rm -f ${man3}/lwres_gnbaresponse_render.3
- @LN@ ${man3}/lwres_gnba.3 ${man3}/lwres_gnbaresponse_render.3
- rm -f ${man3}/lwres_herror.3
- @LN@ ${man3}/lwres_hstrerror.3 ${man3}/lwres_herror.3
- rm -f ${man3}/lwres_lwpacket_parseheader.3
- @LN@ ${man3}/lwres_packet.3 ${man3}/lwres_lwpacket_parseheader.3
- rm -f ${man3}/lwres_lwpacket_renderheader.3
- @LN@ ${man3}/lwres_packet.3 ${man3}/lwres_lwpacket_renderheader.3
- rm -f ${man3}/lwres_net_ntop.3
- @LN@ ${man3}/lwres_inetntop.3 ${man3}/lwres_net_ntop.3
- rm -f ${man3}/lwres_nooprequest_free.3
- @LN@ ${man3}/lwres_noop.3 ${man3}/lwres_nooprequest_free.3
- rm -f ${man3}/lwres_nooprequest_parse.3
- @LN@ ${man3}/lwres_noop.3 ${man3}/lwres_nooprequest_parse.3
- rm -f ${man3}/lwres_nooprequest_render.3
- @LN@ ${man3}/lwres_noop.3 ${man3}/lwres_nooprequest_render.3
- rm -f ${man3}/lwres_noopresponse_free.3
- @LN@ ${man3}/lwres_noop.3 ${man3}/lwres_noopresponse_free.3
- rm -f ${man3}/lwres_noopresponse_parse.3
- @LN@ ${man3}/lwres_noop.3 ${man3}/lwres_noopresponse_parse.3
- rm -f ${man3}/lwres_noopresponse_render.3
- @LN@ ${man3}/lwres_noop.3 ${man3}/lwres_noopresponse_render.3
- rm -f ${man3}/lwres_sethostent.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_sethostent.3
- rm -f ${man3}/lwres_sethostent_r.3
- @LN@ ${man3}/lwres_gethostent.3 ${man3}/lwres_sethostent_r.3
- rm -f ${man3}/lwres_string_parse.3
- @LN@ ${man3}/lwres_resutil.3 ${man3}/lwres_string_parse.3
-
-uninstall::
- for m in ${MANPAGES}; do rm -f ${man3}/$$m ; done
- rm -f ${man3}/lwres_addr_parse.3
- rm -f ${man3}/lwres_buffer_add.3
- rm -f ${man3}/lwres_buffer_back.3
- rm -f ${man3}/lwres_buffer_clear.3
- rm -f ${man3}/lwres_buffer_first.3
- rm -f ${man3}/lwres_buffer_forward.3
- rm -f ${man3}/lwres_buffer_getmem.3
- rm -f ${man3}/lwres_buffer_getuint16.3
- rm -f ${man3}/lwres_buffer_getuint32.3
- rm -f ${man3}/lwres_buffer_getuint8.3
- rm -f ${man3}/lwres_buffer_init.3
- rm -f ${man3}/lwres_buffer_invalidate.3
- rm -f ${man3}/lwres_buffer_putmem.3
- rm -f ${man3}/lwres_buffer_putuint16.3
- rm -f ${man3}/lwres_buffer_putuint32.3
- rm -f ${man3}/lwres_buffer_putuint8.3
- rm -f ${man3}/lwres_buffer_subtract.3
- rm -f ${man3}/lwres_conf_clear.3
- rm -f ${man3}/lwres_conf_get.3
- rm -f ${man3}/lwres_conf_init.3
- rm -f ${man3}/lwres_conf_parse.3
- rm -f ${man3}/lwres_conf_print.3
- rm -f ${man3}/lwres_context_allocmem.3
- rm -f ${man3}/lwres_context_create.3
- rm -f ${man3}/lwres_context_destroy.3
- rm -f ${man3}/lwres_context_freemem.3
- rm -f ${man3}/lwres_context_initserial.3
- rm -f ${man3}/lwres_context_nextserial.3
- rm -f ${man3}/lwres_context_sendrecv.3
- rm -f ${man3}/lwres_endhostent.3
- rm -f ${man3}/lwres_endhostent_r.3
- rm -f ${man3}/lwres_freeaddrinfo.3
- rm -f ${man3}/lwres_freehostent.3
- rm -f ${man3}/lwres_gabnrequest_free.3
- rm -f ${man3}/lwres_gabnrequest_parse.3
- rm -f ${man3}/lwres_gabnrequest_render.3
- rm -f ${man3}/lwres_gabnresponse_free.3
- rm -f ${man3}/lwres_gabnresponse_parse.3
- rm -f ${man3}/lwres_gabnresponse_render.3
- rm -f ${man3}/lwres_getaddrsbyname.3
- rm -f ${man3}/lwres_gethostbyaddr.3
- rm -f ${man3}/lwres_gethostbyaddr_r.3
- rm -f ${man3}/lwres_gethostbyname.3
- rm -f ${man3}/lwres_gethostbyname2.3
- rm -f ${man3}/lwres_gethostbyname_r.3
- rm -f ${man3}/lwres_gethostent_r.3
- rm -f ${man3}/lwres_getipnodebyaddr.3
- rm -f ${man3}/lwres_getipnodebyname.3
- rm -f ${man3}/lwres_getnamebyaddr.3
- rm -f ${man3}/lwres_gnbarequest_free.3
- rm -f ${man3}/lwres_gnbarequest_parse.3
- rm -f ${man3}/lwres_gnbarequest_render.3
- rm -f ${man3}/lwres_gnbaresponse_free.3
- rm -f ${man3}/lwres_gnbaresponse_parse.3
- rm -f ${man3}/lwres_gnbaresponse_render.3
- rm -f ${man3}/lwres_herror.3
- rm -f ${man3}/lwres_lwpacket_parseheader.3
- rm -f ${man3}/lwres_lwpacket_renderheader.3
- rm -f ${man3}/lwres_net_ntop.3
- rm -f ${man3}/lwres_nooprequest_free.3
- rm -f ${man3}/lwres_nooprequest_parse.3
- rm -f ${man3}/lwres_nooprequest_render.3
- rm -f ${man3}/lwres_noopresponse_free.3
- rm -f ${man3}/lwres_noopresponse_parse.3
- rm -f ${man3}/lwres_noopresponse_render.3
- rm -f ${man3}/lwres_sethostent.3
- rm -f ${man3}/lwres_sethostent_r.3
- rm -f ${man3}/lwres_string_parse.3
diff --git a/usr.sbin/bind/lib/lwres/man/lwres.3 b/usr.sbin/bind/lib/lwres/man/lwres.3
deleted file mode 100644
index 1faedba8e51..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres.3
+++ /dev/null
@@ -1,184 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres \- introduction to the lightweight resolver library
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.SH "DESCRIPTION"
-.PP
-The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library\&. It provides hostname\-to\-address and address\-to\-hostname lookup services to applications by transmitting lookup requests to a resolver daemon
-\fBlwresd\fR
-running on the local host\&. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library\&. The library and resolver daemon communicate using a simple UDP\-based protocol\&.
-.SH "OVERVIEW"
-.PP
-The lwresd library implements multiple name service APIs\&. The standard
-\fBgethostbyname()\fR,
-\fBgethostbyaddr()\fR,
-\fBgethostbyname_r()\fR,
-\fBgethostbyaddr_r()\fR,
-\fBgetaddrinfo()\fR,
-\fBgetipnodebyname()\fR, and
-\fBgetipnodebyaddr()\fR
-functions are all supported\&. To allow the lwres library to coexist with system libraries that define functions of the same name, the library defines these functions with names prefixed by
-lwres_\&. To define the standard names, applications must include the header file
-<lwres/netdb\&.h>
-which contains macro definitions mapping the standard function names into
-lwres_
-prefixed ones\&. Operating system vendors who integrate the lwres library into their base distributions should rename the functions in the library proper so that the renaming macros are not needed\&.
-.PP
-The library also provides a native API consisting of the functions
-\fBlwres_getaddrsbyname()\fR
-and
-\fBlwres_getnamebyaddr()\fR\&. These may be called by applications that require more detailed control over the lookup process than the standard functions provide\&.
-.PP
-In addition to these name service independent address lookup functions, the library implements a new, experimental API for looking up arbitrary DNS resource records, using the
-\fBlwres_getaddrsbyname()\fR
-function\&.
-.PP
-Finally, there is a low\-level API for converting lookup requests and responses to and from raw lwres protocol packets\&. This API can be used by clients requiring nonblocking operation, and is also used when implementing the server side of the lwres protocol, for example in the
-\fBlwresd\fR
-resolver daemon\&. The use of this low\-level API in clients and servers is outlined in the following sections\&.
-.SH "CLIENT-SIDE LOW-LEVEL API CALL FLOW"
-.PP
-When a client program wishes to make an lwres request using the native low\-level API, it typically performs the following sequence of actions\&.
-.PP
-(1) Allocate or use an existing
-\fBlwres_packet_t\fR, called
-\fIpkt\fR
-below\&.
-.PP
-(2) Set
-\fIpkt\&.recvlength\fR
-to the maximum length we will accept\&. This is done so the receiver of our packets knows how large our receive buffer is\&. The "default" is a constant in
-lwres\&.h:
-\fBLWRES_RECVLENGTH = 4096\fR\&.
-.PP
-(3) Set
-\fIpkt\&.serial\fR
-to a unique serial number\&. This value is echoed back to the application by the remote server\&.
-.PP
-(4) Set
-\fIpkt\&.pktflags\fR\&. Usually this is set to 0\&.
-.PP
-(5) Set
-\fIpkt\&.result\fR
-to 0\&.
-.PP
-(6) Call
-\fBlwres_*request_render()\fR, or marshall in the data using the primitives such as
-\fBlwres_packet_render()\fR
-and storing the packet data\&.
-.PP
-(7) Transmit the resulting buffer\&.
-.PP
-(8) Call
-\fBlwres_*response_parse()\fR
-to parse any packets received\&.
-.PP
-(9) Verify that the opcode and serial match a request, and process the packet specific information contained in the body\&.
-.SH "SERVER-SIDE LOW-LEVEL API CALL FLOW"
-.PP
-When implementing the server side of the lightweight resolver protocol using the lwres library, a sequence of actions like the following is typically involved in processing each request packet\&.
-.PP
-Note that the same
-\fBlwres_packet_t\fR
-is used in both the
-\fB_parse()\fR
-and
-\fB_render()\fR
-calls, with only a few modifications made to the packet header\*(Aqs contents between uses\&. This method is recommended as it keeps the serial, opcode, and other fields correct\&.
-.PP
-(1) When a packet is received, call
-\fBlwres_*request_parse()\fR
-to unmarshall it\&. This returns a
-\fBlwres_packet_t\fR
-(also called
-\fIpkt\fR, below) as well as a data specific type, such as
-\fBlwres_gabnrequest_t\fR\&.
-.PP
-(2) Process the request in the data specific type\&.
-.PP
-(3) Set the
-\fIpkt\&.result\fR,
-\fIpkt\&.recvlength\fR
-as above\&. All other fields can be left untouched since they were filled in by the
-\fB*_parse()\fR
-call above\&. If using
-\fBlwres_*response_render()\fR,
-\fIpkt\&.pktflags\fR
-will be set up properly\&. Otherwise, the
-\fBLWRES_LWPACKETFLAG_RESPONSE\fR
-bit should be set\&.
-.PP
-(4) Call the data specific rendering function, such as
-\fBlwres_gabnresponse_render()\fR\&.
-.PP
-(5) Send the resulting packet to the client\&.
-.PP
-.SH "SEE ALSO"
-.PP
-\fBlwres_gethostent\fR(3),
-\fBlwres_getipnode\fR(3),
-\fBlwres_getnameinfo\fR(3),
-\fBlwres_noop\fR(3),
-\fBlwres_gabn\fR(3),
-\fBlwres_gnba\fR(3),
-\fBlwres_context\fR(3),
-\fBlwres_config\fR(3),
-\fBresolver\fR(5),
-\fBlwresd\fR(8)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres.html b/usr.sbin/bind/lib/lwres/man/lwres.html
deleted file mode 100644
index 5e838ffbf08..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres.html
+++ /dev/null
@@ -1,256 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres
- &#8212; introduction to the lightweight resolver library
- </p>
-</div>
-
-
-
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/lwres.h&gt;</pre>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p>
- The BIND 9 lightweight resolver library is a simple, name service
- independent stub resolver library. It provides hostname-to-address
- and address-to-hostname lookup services to applications by
- transmitting lookup requests to a resolver daemon
- <span class="command"><strong>lwresd</strong></span>
- running on the local host. The resolver daemon performs the
- lookup using the DNS or possibly other name service protocols,
- and returns the results to the application through the library.
- The library and resolver daemon communicate using a simple
- UDP-based protocol.
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>OVERVIEW</h2>
-
- <p>
- The lwresd library implements multiple name service APIs.
- The standard
- <code class="function">gethostbyname()</code>,
- <code class="function">gethostbyaddr()</code>,
- <code class="function">gethostbyname_r()</code>,
- <code class="function">gethostbyaddr_r()</code>,
- <code class="function">getaddrinfo()</code>,
- <code class="function">getipnodebyname()</code>,
- and
- <code class="function">getipnodebyaddr()</code>
- functions are all supported. To allow the lwres library to coexist
- with system libraries that define functions of the same name,
- the library defines these functions with names prefixed by
- <code class="literal">lwres_</code>.
- To define the standard names, applications must include the
- header file
- <code class="filename">&lt;lwres/netdb.h&gt;</code>
- which contains macro definitions mapping the standard function names
- into
- <code class="literal">lwres_</code>
- prefixed ones. Operating system vendors who integrate the lwres
- library into their base distributions should rename the functions
- in the library proper so that the renaming macros are not needed.
- </p>
- <p>
- The library also provides a native API consisting of the functions
- <code class="function">lwres_getaddrsbyname()</code>
- and
- <code class="function">lwres_getnamebyaddr()</code>.
- These may be called by applications that require more detailed
- control over the lookup process than the standard functions
- provide.
- </p>
- <p>
- In addition to these name service independent address lookup
- functions, the library implements a new, experimental API
- for looking up arbitrary DNS resource records, using the
- <code class="function">lwres_getaddrsbyname()</code>
- function.
- </p>
- <p>
- Finally, there is a low-level API for converting lookup
- requests and responses to and from raw lwres protocol packets.
- This API can be used by clients requiring nonblocking operation,
- and is also used when implementing the server side of the lwres
- protocol, for example in the
- <span class="command"><strong>lwresd</strong></span>
- resolver daemon. The use of this low-level API in clients
- and servers is outlined in the following sections.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>CLIENT-SIDE LOW-LEVEL API CALL FLOW</h2>
-
- <p>
- When a client program wishes to make an lwres request using the
- native low-level API, it typically performs the following
- sequence of actions.
- </p>
- <p>
- (1) Allocate or use an existing <span class="type">lwres_packet_t</span>,
- called <code class="varname">pkt</code> below.
- </p>
- <p>
- (2) Set <code class="varname">pkt.recvlength</code> to the maximum length
- we will accept.
- This is done so the receiver of our packets knows how large our receive
- buffer is. The "default" is a constant in
- <code class="filename">lwres.h</code>: <code class="constant">LWRES_RECVLENGTH = 4096</code>.
- </p>
- <p>
- (3) Set <code class="varname">pkt.serial</code>
- to a unique serial number. This value is echoed
- back to the application by the remote server.
- </p>
- <p>
- (4) Set <code class="varname">pkt.pktflags</code>. Usually this is set to
- 0.
- </p>
- <p>
- (5) Set <code class="varname">pkt.result</code> to 0.
- </p>
- <p>
- (6) Call <code class="function">lwres_*request_render()</code>,
- or marshall in the data using the primitives
- such as <code class="function">lwres_packet_render()</code>
- and storing the packet data.
- </p>
- <p>
- (7) Transmit the resulting buffer.
- </p>
- <p>
- (8) Call <code class="function">lwres_*response_parse()</code>
- to parse any packets received.
- </p>
- <p>
- (9) Verify that the opcode and serial match a request, and process the
- packet specific information contained in the body.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.10"></a><h2>SERVER-SIDE LOW-LEVEL API CALL FLOW</h2>
-
- <p>
- When implementing the server side of the lightweight resolver
- protocol using the lwres library, a sequence of actions like the
- following is typically involved in processing each request packet.
- </p>
- <p>
- Note that the same <span class="type">lwres_packet_t</span> is used
- in both the <code class="function">_parse()</code> and <code class="function">_render()</code> calls,
- with only a few modifications made
- to the packet header's contents between uses. This method is
- recommended
- as it keeps the serial, opcode, and other fields correct.
- </p>
- <p>
- (1) When a packet is received, call <code class="function">lwres_*request_parse()</code> to
- unmarshall it. This returns a <span class="type">lwres_packet_t</span> (also called <code class="varname">pkt</code>, below)
- as well as a data specific type, such as <span class="type">lwres_gabnrequest_t</span>.
- </p>
- <p>
- (2) Process the request in the data specific type.
- </p>
- <p>
- (3) Set the <code class="varname">pkt.result</code>,
- <code class="varname">pkt.recvlength</code> as above. All other fields
- can
- be left untouched since they were filled in by the <code class="function">*_parse()</code> call
- above. If using <code class="function">lwres_*response_render()</code>,
- <code class="varname">pkt.pktflags</code> will be set up
- properly. Otherwise, the <code class="constant">LWRES_LWPACKETFLAG_RESPONSE</code> bit should be
- set.
- </p>
- <p>
- (4) Call the data specific rendering function, such as
- <code class="function">lwres_gabnresponse_render()</code>.
- </p>
- <p>
- (5) Send the resulting packet to the client.
- </p>
- <p></p>
- </div>
- <div class="refsection">
-<a name="id-1.11"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_gethostent</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getipnode</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getnameinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_noop</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_gabn</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_gnba</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_context</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_config</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">resolver</span>(5)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwresd</span>(8)
- </span>.
-
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_buffer.3 b/usr.sbin/bind/lib/lwres/man/lwres_buffer.3
deleted file mode 100644
index db5931a979e..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_buffer.3
+++ /dev/null
@@ -1,260 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_buffer
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_BUFFER" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_buffer_init, lwres_buffer_invalidate, lwres_buffer_add, lwres_buffer_subtract, lwres_buffer_clear, lwres_buffer_first, lwres_buffer_forward, lwres_buffer_back, lwres_buffer_getuint8, lwres_buffer_putuint8, lwres_buffer_getuint16, lwres_buffer_putuint16, lwres_buffer_getuint32, lwres_buffer_putuint32, lwres_buffer_putmem, lwres_buffer_getmem \- lightweight resolver buffer management
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwbuffer\&.h>
-.fi
-.ft
-.HP \w'void\ lwres_buffer_init('u
-.BI "void lwres_buffer_init(lwres_buffer_t\ *" "b" ", void\ *" "base" ", unsigned\ int\ " "length" ");"
-.HP \w'void\ lwres_buffer_invalidate('u
-.BI "void lwres_buffer_invalidate(lwres_buffer_t\ *" "b" ");"
-.HP \w'void\ lwres_buffer_add('u
-.BI "void lwres_buffer_add(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");"
-.HP \w'void\ lwres_buffer_subtract('u
-.BI "void lwres_buffer_subtract(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");"
-.HP \w'void\ lwres_buffer_clear('u
-.BI "void lwres_buffer_clear(lwres_buffer_t\ *" "b" ");"
-.HP \w'void\ lwres_buffer_first('u
-.BI "void lwres_buffer_first(lwres_buffer_t\ *" "b" ");"
-.HP \w'void\ lwres_buffer_forward('u
-.BI "void lwres_buffer_forward(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");"
-.HP \w'void\ lwres_buffer_back('u
-.BI "void lwres_buffer_back(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");"
-.HP \w'lwres_uint8_t\ lwres_buffer_getuint8('u
-.BI "lwres_uint8_t lwres_buffer_getuint8(lwres_buffer_t\ *" "b" ");"
-.HP \w'void\ lwres_buffer_putuint8('u
-.BI "void lwres_buffer_putuint8(lwres_buffer_t\ *" "b" ", lwres_uint8_t\ " "val" ");"
-.HP \w'lwres_uint16_t\ lwres_buffer_getuint16('u
-.BI "lwres_uint16_t lwres_buffer_getuint16(lwres_buffer_t\ *" "b" ");"
-.HP \w'void\ lwres_buffer_putuint16('u
-.BI "void lwres_buffer_putuint16(lwres_buffer_t\ *" "b" ", lwres_uint16_t\ " "val" ");"
-.HP \w'lwres_uint32_t\ lwres_buffer_getuint32('u
-.BI "lwres_uint32_t lwres_buffer_getuint32(lwres_buffer_t\ *" "b" ");"
-.HP \w'void\ lwres_buffer_putuint32('u
-.BI "void lwres_buffer_putuint32(lwres_buffer_t\ *" "b" ", lwres_uint32_t\ " "val" ");"
-.HP \w'void\ lwres_buffer_putmem('u
-.BI "void lwres_buffer_putmem(lwres_buffer_t\ *" "b" ", const\ unsigned\ char\ *" "base" ", unsigned\ int\ " "length" ");"
-.HP \w'void\ lwres_buffer_getmem('u
-.BI "void lwres_buffer_getmem(lwres_buffer_t\ *" "b" ", unsigned\ char\ *" "base" ", unsigned\ int\ " "length" ");"
-.SH "DESCRIPTION"
-.PP
-These functions provide bounds checked access to a region of memory where data is being read or written\&. They are based on, and similar to, the
-isc_buffer_
-functions in the ISC library\&.
-.PP
-A buffer is a region of memory, together with a set of related subregions\&. The
-\fIused region\fR
-and the
-\fIavailable\fR
-region are disjoint, and their union is the buffer\*(Aqs region\&. The used region extends from the beginning of the buffer region to the last used byte\&. The available region extends from one byte greater than the last used byte to the end of the buffer\*(Aqs region\&. The size of the used region can be changed using various buffer commands\&. Initially, the used region is empty\&.
-.PP
-The used region is further subdivided into two disjoint regions: the
-\fIconsumed region\fR
-and the
-\fIremaining region\fR\&. The union of these two regions is the used region\&. The consumed region extends from the beginning of the used region to the byte before the
-\fIcurrent\fR
-offset (if any)\&. The
-\fIremaining\fR
-region the current pointer to the end of the used region\&. The size of the consumed region can be changed using various buffer commands\&. Initially, the consumed region is empty\&.
-.PP
-The
-\fIactive region\fR
-is an (optional) subregion of the remaining region\&. It extends from the current offset to an offset in the remaining region\&. Initially, the active region is empty\&. If the current offset advances beyond the chosen offset, the active region will also be empty\&.
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
- /\-\-\-\-\-\-\-\-\-\-\-\-entire length\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\e\e
- /\-\-\-\-\- used region \-\-\-\-\-\e\e/\-\- available \-\-\e\e
- +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
- | consumed | remaining | |
- +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
- a b c d e
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
- a == base of buffer\&.
- b == current pointer\&. Can be anywhere between a and d\&.
- c == active pointer\&. Meaningful between b and d\&.
- d == used pointer\&.
- e == length of buffer\&.
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
- a\-e == entire length of buffer\&.
- a\-d == used region\&.
- a\-b == consumed region\&.
- b\-d == remaining region\&.
- b\-c == optional active region\&.
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fBlwres_buffer_init()\fR
-initializes the
-\fBlwres_buffer_t\fR\fI*b\fR
-and assocates it with the memory region of size
-\fIlength\fR
-bytes starting at location
-\fIbase\&.\fR
-.PP
-\fBlwres_buffer_invalidate()\fR
-marks the buffer
-\fI*b\fR
-as invalid\&. Invalidating a buffer after use is not required, but makes it possible to catch its possible accidental use\&.
-.PP
-The functions
-\fBlwres_buffer_add()\fR
-and
-\fBlwres_buffer_subtract()\fR
-respectively increase and decrease the used space in buffer
-\fI*b\fR
-by
-\fIn\fR
-bytes\&.
-\fBlwres_buffer_add()\fR
-checks for buffer overflow and
-\fBlwres_buffer_subtract()\fR
-checks for underflow\&. These functions do not allocate or deallocate memory\&. They just change the value of
-\fIused\fR\&.
-.PP
-A buffer is re\-initialised by
-\fBlwres_buffer_clear()\fR\&. The function sets
-\fIused\fR,
-\fIcurrent\fR
-and
-\fIactive\fR
-to zero\&.
-.PP
-\fBlwres_buffer_first\fR
-makes the consumed region of buffer
-\fI*p\fR
-empty by setting
-\fIcurrent\fR
-to zero (the start of the buffer)\&.
-.PP
-\fBlwres_buffer_forward()\fR
-increases the consumed region of buffer
-\fI*b\fR
-by
-\fIn\fR
-bytes, checking for overflow\&. Similarly,
-\fBlwres_buffer_back()\fR
-decreases buffer
-\fIb\fR\*(Aqs consumed region by
-\fIn\fR
-bytes and checks for underflow\&.
-.PP
-\fBlwres_buffer_getuint8()\fR
-reads an unsigned 8\-bit integer from
-\fI*b\fR
-and returns it\&.
-\fBlwres_buffer_putuint8()\fR
-writes the unsigned 8\-bit integer
-\fIval\fR
-to buffer
-\fI*b\fR\&.
-.PP
-\fBlwres_buffer_getuint16()\fR
-and
-\fBlwres_buffer_getuint32()\fR
-are identical to
-\fBlwres_buffer_putuint8()\fR
-except that they respectively read an unsigned 16\-bit or 32\-bit integer in network byte order from
-\fIb\fR\&. Similarly,
-\fBlwres_buffer_putuint16()\fR
-and
-\fBlwres_buffer_putuint32()\fR
-writes the unsigned 16\-bit or 32\-bit integer
-\fIval\fR
-to buffer
-\fIb\fR, in network byte order\&.
-.PP
-Arbitrary amounts of data are read or written from a lightweight resolver buffer with
-\fBlwres_buffer_getmem()\fR
-and
-\fBlwres_buffer_putmem()\fR
-respectively\&.
-\fBlwres_buffer_putmem()\fR
-copies
-\fIlength\fR
-bytes of memory at
-\fIbase\fR
-to
-\fIb\fR\&. Conversely,
-\fBlwres_buffer_getmem()\fR
-copies
-\fIlength\fR
-bytes of memory from
-\fIb\fR
-to
-\fIbase\fR\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_buffer.html b/usr.sbin/bind/lib/lwres/man/lwres_buffer.html
deleted file mode 100644
index 901c54a8108..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_buffer.html
+++ /dev/null
@@ -1,457 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_buffer</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_buffer_init,
- lwres_buffer_invalidate,
- lwres_buffer_add,
- lwres_buffer_subtract,
- lwres_buffer_clear,
- lwres_buffer_first,
- lwres_buffer_forward,
- lwres_buffer_back,
- lwres_buffer_getuint8,
- lwres_buffer_putuint8,
- lwres_buffer_getuint16,
- lwres_buffer_putuint16,
- lwres_buffer_getuint32,
- lwres_buffer_putuint32,
- lwres_buffer_putmem,
- lwres_buffer_getmem
- &#8212; lightweight resolver buffer management
- </p>
-</div>
-
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
-
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">
-#include &lt;lwres/lwbuffer.h&gt;
-</pre>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_init</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>void *<var class="pdparam">base</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">length</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_invalidate</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_add</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_subtract</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_clear</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_first</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_forward</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_back</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-lwres_uint8_t
-<b class="fsfunc">lwres_buffer_getuint8</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_putuint8</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint8_t <var class="pdparam">val</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-lwres_uint16_t
-<b class="fsfunc">lwres_buffer_getuint16</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_putuint16</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint16_t <var class="pdparam">val</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-lwres_uint32_t
-<b class="fsfunc">lwres_buffer_getuint32</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_putuint32</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint32_t <var class="pdparam">val</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_putmem</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const unsigned char *<var class="pdparam">base</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">length</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_buffer_getmem</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned char *<var class="pdparam">base</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">length</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p>
- These functions provide bounds checked access to a region of memory
- where data is being read or written.
- They are based on, and similar to, the
- <code class="literal">isc_buffer_</code>
- functions in the ISC library.
- </p>
- <p>
- A buffer is a region of memory, together with a set of related
- subregions.
- The <span class="emphasis"><em>used region</em></span> and the
- <span class="emphasis"><em>available</em></span> region are disjoint, and
- their union is the buffer's region.
- The used region extends from the beginning of the buffer region to the
- last used byte.
- The available region extends from one byte greater than the last used
- byte to the end of the buffer's region.
- The size of the used region can be changed using various
- buffer commands.
- Initially, the used region is empty.
- </p>
- <p>
- The used region is further subdivided into two disjoint regions: the
- <span class="emphasis"><em>consumed region</em></span> and the <span class="emphasis"><em>remaining region</em></span>.
- The union of these two regions is the used region.
- The consumed region extends from the beginning of the used region to
- the byte before the <span class="emphasis"><em>current</em></span> offset (if any).
- The <span class="emphasis"><em>remaining</em></span> region the current pointer to the end
- of the used
- region.
- The size of the consumed region can be changed using various
- buffer commands.
- Initially, the consumed region is empty.
- </p>
- <p>
- The <span class="emphasis"><em>active region</em></span> is an (optional) subregion of the
- remaining
- region.
- It extends from the current offset to an offset in the
- remaining region.
- Initially, the active region is empty.
- If the current offset advances beyond the chosen offset,
- the active region will also be empty.
- </p>
- <pre class="programlisting">
- /------------entire length---------------\\
- /----- used region -----\\/-- available --\\
- +----------------------------------------+
- | consumed | remaining | |
- +----------------------------------------+
- a b c d e
- </pre>
-<p>
- </p>
- <pre class="programlisting">
- a == base of buffer.
- b == current pointer. Can be anywhere between a and d.
- c == active pointer. Meaningful between b and d.
- d == used pointer.
- e == length of buffer.
- </pre>
-<p>
- </p>
- <pre class="programlisting">
- a-e == entire length of buffer.
- a-d == used region.
- a-b == consumed region.
- b-d == remaining region.
- b-c == optional active region.
-</pre>
-<p>
- </p>
- <p><code class="function">lwres_buffer_init()</code>
- initializes the
- <span class="type">lwres_buffer_t</span>
- <em class="parameter"><code>*b</code></em>
- and assocates it with the memory region of size
- <em class="parameter"><code>length</code></em>
- bytes starting at location
- <em class="parameter"><code>base.</code></em>
- </p>
- <p><code class="function">lwres_buffer_invalidate()</code>
- marks the buffer <em class="parameter"><code>*b</code></em>
- as invalid. Invalidating a buffer after use is not required,
- but makes it possible to catch its possible accidental use.
- </p>
- <p>
- The functions
- <code class="function">lwres_buffer_add()</code>
- and
- <code class="function">lwres_buffer_subtract()</code>
- respectively increase and decrease the used space in
- buffer
- <em class="parameter"><code>*b</code></em>
- by
- <em class="parameter"><code>n</code></em>
- bytes.
- <code class="function">lwres_buffer_add()</code>
- checks for buffer overflow and
- <code class="function">lwres_buffer_subtract()</code>
- checks for underflow.
- These functions do not allocate or deallocate memory.
- They just change the value of
- <code class="varname">used</code>.
- </p>
- <p>
- A buffer is re-initialised by
- <code class="function">lwres_buffer_clear()</code>.
- The function sets
- <code class="varname">used</code>,
- <code class="varname">current</code>
- and
- <code class="varname">active</code>
- to zero.
- </p>
- <p><code class="function">lwres_buffer_first</code>
- makes the consumed region of buffer
- <em class="parameter"><code>*p</code></em>
- empty by setting
- <code class="varname">current</code>
- to zero (the start of the buffer).
- </p>
- <p><code class="function">lwres_buffer_forward()</code>
- increases the consumed region of buffer
- <em class="parameter"><code>*b</code></em>
- by
- <em class="parameter"><code>n</code></em>
- bytes, checking for overflow.
- Similarly,
- <code class="function">lwres_buffer_back()</code>
- decreases buffer
- <em class="parameter"><code>b</code></em>'s
- consumed region by
- <em class="parameter"><code>n</code></em>
- bytes and checks for underflow.
- </p>
- <p><code class="function">lwres_buffer_getuint8()</code>
- reads an unsigned 8-bit integer from
- <em class="parameter"><code>*b</code></em>
- and returns it.
- <code class="function">lwres_buffer_putuint8()</code>
- writes the unsigned 8-bit integer
- <em class="parameter"><code>val</code></em>
- to buffer
- <em class="parameter"><code>*b</code></em>.
- </p>
- <p><code class="function">lwres_buffer_getuint16()</code>
- and
- <code class="function">lwres_buffer_getuint32()</code>
- are identical to
- <code class="function">lwres_buffer_putuint8()</code>
- except that they respectively read an unsigned 16-bit or 32-bit integer
- in network byte order from
- <em class="parameter"><code>b</code></em>.
- Similarly,
- <code class="function">lwres_buffer_putuint16()</code>
- and
- <code class="function">lwres_buffer_putuint32()</code>
- writes the unsigned 16-bit or 32-bit integer
- <em class="parameter"><code>val</code></em>
- to buffer
- <em class="parameter"><code>b</code></em>,
- in network byte order.
- </p>
- <p>
- Arbitrary amounts of data are read or written from a lightweight
- resolver buffer with
- <code class="function">lwres_buffer_getmem()</code>
- and
- <code class="function">lwres_buffer_putmem()</code>
- respectively.
- <code class="function">lwres_buffer_putmem()</code>
- copies
- <em class="parameter"><code>length</code></em>
- bytes of memory at
- <em class="parameter"><code>base</code></em>
- to
- <em class="parameter"><code>b</code></em>.
- Conversely,
- <code class="function">lwres_buffer_getmem()</code>
- copies
- <em class="parameter"><code>length</code></em>
- bytes of memory from
- <em class="parameter"><code>b</code></em>
- to
- <em class="parameter"><code>base</code></em>.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_config.3 b/usr.sbin/bind/lib/lwres/man/lwres_config.3
deleted file mode 100644
index ff0d8c81327..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_config.3
+++ /dev/null
@@ -1,124 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_config
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_CONFIG" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_conf_init, lwres_conf_clear, lwres_conf_parse, lwres_conf_print, lwres_conf_get \- lightweight resolver configuration
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.HP \w'void\ lwres_conf_init('u
-.BI "void lwres_conf_init(lwres_context_t\ *" "ctx" ");"
-.HP \w'void\ lwres_conf_clear('u
-.BI "void lwres_conf_clear(lwres_context_t\ *" "ctx" ");"
-.HP \w'lwres_result_t\ lwres_conf_parse('u
-.BI "lwres_result_t lwres_conf_parse(lwres_context_t\ *" "ctx" ", const\ char\ *" "filename" ");"
-.HP \w'lwres_result_t\ lwres_conf_print('u
-.BI "lwres_result_t lwres_conf_print(lwres_context_t\ *" "ctx" ", FILE\ *" "fp" ");"
-.HP \w'lwres_conf_t\ *\ lwres_conf_get('u
-.BI "lwres_conf_t * lwres_conf_get(lwres_context_t\ *" "ctx" ");"
-.SH "DESCRIPTION"
-.PP
-\fBlwres_conf_init()\fR
-creates an empty
-\fBlwres_conf_t\fR
-structure for lightweight resolver context
-\fIctx\fR\&.
-.PP
-\fBlwres_conf_clear()\fR
-frees up all the internal memory used by that
-\fBlwres_conf_t\fR
-structure in resolver context
-\fIctx\fR\&.
-.PP
-\fBlwres_conf_parse()\fR
-opens the file
-\fIfilename\fR
-and parses it to initialise the resolver context
-\fIctx\fR\*(Aqs
-\fBlwres_conf_t\fR
-structure\&.
-.PP
-\fBlwres_conf_print()\fR
-prints the
-\fBlwres_conf_t\fR
-structure for resolver context
-\fIctx\fR
-to the
-\fBFILE\fR\fIfp\fR\&.
-.SH "RETURN VALUES"
-.PP
-\fBlwres_conf_parse()\fR
-returns
-\fBLWRES_R_SUCCESS\fR
-if it successfully read and parsed
-\fIfilename\fR\&. It returns
-\fBLWRES_R_FAILURE\fR
-if
-\fIfilename\fR
-could not be opened or contained incorrect resolver statements\&.
-.PP
-\fBlwres_conf_print()\fR
-returns
-\fBLWRES_R_SUCCESS\fR
-unless an error occurred when converting the network addresses to a numeric host address string\&. If this happens, the function returns
-\fBLWRES_R_FAILURE\fR\&.
-.SH "SEE ALSO"
-.PP
-\fBstdio\fR(3),
-\fBresolver\fR(5)\&.
-.SH "FILES"
-.PP
-/etc/resolv\&.conf
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_config.html b/usr.sbin/bind/lib/lwres/man/lwres_config.html
deleted file mode 100644
index aed0adf68be..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_config.html
+++ /dev/null
@@ -1,177 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_config</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_conf_init,
- lwres_conf_clear,
- lwres_conf_parse,
- lwres_conf_print,
- lwres_conf_get
- &#8212; lightweight resolver configuration
- </p>
-</div>
-
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/lwres.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_conf_init</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_conf_clear</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_conf_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const char *<var class="pdparam">filename</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_conf_print</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>FILE *<var class="pdparam">fp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-lwres_conf_t *
-<b class="fsfunc">lwres_conf_get</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_conf_init()</code>
- creates an empty
- <span class="type">lwres_conf_t</span>
- structure for lightweight resolver context
- <em class="parameter"><code>ctx</code></em>.
- </p>
-
- <p><code class="function">lwres_conf_clear()</code>
- frees up all the internal memory used by
- that
- <span class="type">lwres_conf_t</span>
- structure in resolver context
- <em class="parameter"><code>ctx</code></em>.
- </p>
-
- <p><code class="function">lwres_conf_parse()</code>
- opens the file
- <em class="parameter"><code>filename</code></em>
- and parses it to initialise the resolver context
- <em class="parameter"><code>ctx</code></em>'s
- <span class="type">lwres_conf_t</span>
- structure.
- </p>
-
- <p><code class="function">lwres_conf_print()</code>
- prints the
- <span class="type">lwres_conf_t</span>
- structure for resolver context
- <em class="parameter"><code>ctx</code></em>
- to the
- <span class="type">FILE</span>
- <em class="parameter"><code>fp</code></em>.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
-
-
- <p><code class="function">lwres_conf_parse()</code>
- returns <span class="errorcode">LWRES_R_SUCCESS</span>
- if it successfully read and parsed
- <em class="parameter"><code>filename</code></em>.
- It returns <span class="errorcode">LWRES_R_FAILURE</span>
- if <em class="parameter"><code>filename</code></em>
- could not be opened or contained incorrect
- resolver statements.
- </p>
-
- <p><code class="function">lwres_conf_print()</code>
- returns <span class="errorcode">LWRES_R_SUCCESS</span>
- unless an error occurred when converting the network addresses to a
- numeric host address string.
- If this happens, the function returns
- <span class="errorcode">LWRES_R_FAILURE</span>.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">stdio</span>(3)
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">resolver</span>(5)
- </span>.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.10"></a><h2>FILES</h2>
-
- <p><code class="filename">/etc/resolv.conf</code>
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_context.3 b/usr.sbin/bind/lib/lwres/man/lwres_context.3
deleted file mode 100644
index 9c93ef2d4c7..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_context.3
+++ /dev/null
@@ -1,189 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_context
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_CONTEXT" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_context_create, lwres_context_destroy, lwres_context_nextserial, lwres_context_initserial, lwres_context_freemem, lwres_context_allocmem, lwres_context_sendrecv \- lightweight resolver context management
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.HP \w'lwres_result_t\ lwres_context_create('u
-.BI "lwres_result_t lwres_context_create(lwres_context_t\ **" "contextp" ", void\ *" "arg" ", lwres_malloc_t\ " "malloc_function" ", lwres_free_t\ " "free_function" ");"
-.HP \w'lwres_result_t\ lwres_context_destroy('u
-.BI "lwres_result_t lwres_context_destroy(lwres_context_t\ **" "contextp" ");"
-.HP \w'void\ lwres_context_initserial('u
-.BI "void lwres_context_initserial(lwres_context_t\ *" "ctx" ", lwres_uint32_t\ " "serial" ");"
-.HP \w'lwres_uint32_t\ lwres_context_nextserial('u
-.BI "lwres_uint32_t lwres_context_nextserial(lwres_context_t\ *" "ctx" ");"
-.HP \w'void\ lwres_context_freemem('u
-.BI "void lwres_context_freemem(lwres_context_t\ *" "ctx" ", void\ *" "mem" ", size_t\ " "len" ");"
-.HP \w'void\ lwres_context_allocmem('u
-.BI "void lwres_context_allocmem(lwres_context_t\ *" "ctx" ", size_t\ " "len" ");"
-.HP \w'void\ *\ lwres_context_sendrecv('u
-.BI "void * lwres_context_sendrecv(lwres_context_t\ *" "ctx" ", void\ *" "sendbase" ", int\ " "sendlen" ", void\ *" "recvbase" ", int\ " "recvlen" ", int\ *" "recvd_len" ");"
-.SH "DESCRIPTION"
-.PP
-\fBlwres_context_create()\fR
-creates a
-\fBlwres_context_t\fR
-structure for use in lightweight resolver operations\&. It holds a socket and other data needed for communicating with a resolver daemon\&. The new
-\fBlwres_context_t\fR
-is returned through
-\fIcontextp\fR, a pointer to a
-\fBlwres_context_t\fR
-pointer\&. This
-\fBlwres_context_t\fR
-pointer must initially be NULL, and is modified to point to the newly created
-\fBlwres_context_t\fR\&.
-.PP
-When the lightweight resolver needs to perform dynamic memory allocation, it will call
-\fImalloc_function\fR
-to allocate memory and
-\fIfree_function\fR
-to free it\&. If
-\fImalloc_function\fR
-and
-\fIfree_function\fR
-are NULL, memory is allocated using
-\fBmalloc\fR(3)\&. and
-\fBfree\fR(3)\&. It is not permitted to have a NULL
-\fImalloc_function\fR
-and a non\-NULL
-\fIfree_function\fR
-or vice versa\&.
-\fIarg\fR
-is passed as the first parameter to the memory allocation functions\&. If
-\fImalloc_function\fR
-and
-\fIfree_function\fR
-are NULL,
-\fIarg\fR
-is unused and should be passed as NULL\&.
-.PP
-Once memory for the structure has been allocated, it is initialized using
-\fBlwres_conf_init\fR(3)
-and returned via
-\fI*contextp\fR\&.
-.PP
-\fBlwres_context_destroy()\fR
-destroys a
-\fBlwres_context_t\fR, closing its socket\&.
-\fIcontextp\fR
-is a pointer to a pointer to the context that is to be destroyed\&. The pointer will be set to NULL when the context has been destroyed\&.
-.PP
-The context holds a serial number that is used to identify resolver request packets and associate responses with the corresponding requests\&. This serial number is controlled using
-\fBlwres_context_initserial()\fR
-and
-\fBlwres_context_nextserial()\fR\&.
-\fBlwres_context_initserial()\fR
-sets the serial number for context
-\fI*ctx\fR
-to
-\fIserial\fR\&.
-\fBlwres_context_nextserial()\fR
-increments the serial number and returns the previous value\&.
-.PP
-Memory for a lightweight resolver context is allocated and freed using
-\fBlwres_context_allocmem()\fR
-and
-\fBlwres_context_freemem()\fR\&. These use whatever allocations were defined when the context was created with
-\fBlwres_context_create()\fR\&.
-\fBlwres_context_allocmem()\fR
-allocates
-\fIlen\fR
-bytes of memory and if successful returns a pointer to the allocated storage\&.
-\fBlwres_context_freemem()\fR
-frees
-\fIlen\fR
-bytes of space starting at location
-\fImem\fR\&.
-.PP
-\fBlwres_context_sendrecv()\fR
-performs I/O for the context
-\fIctx\fR\&. Data are read and written from the context\*(Aqs socket\&. It writes data from
-\fIsendbase\fR
-\(em typically a lightweight resolver query packet \(em and waits for a reply which is copied to the receive buffer at
-\fIrecvbase\fR\&. The number of bytes that were written to this receive buffer is returned in
-\fI*recvd_len\fR\&.
-.SH "RETURN VALUES"
-.PP
-\fBlwres_context_create()\fR
-returns
-\fBLWRES_R_NOMEMORY\fR
-if memory for the
-\fBstruct lwres_context\fR
-could not be allocated,
-\fBLWRES_R_SUCCESS\fR
-otherwise\&.
-.PP
-Successful calls to the memory allocator
-\fBlwres_context_allocmem()\fR
-return a pointer to the start of the allocated space\&. It returns NULL if memory could not be allocated\&.
-.PP
-\fBLWRES_R_SUCCESS\fR
-is returned when
-\fBlwres_context_sendrecv()\fR
-completes successfully\&.
-\fBLWRES_R_IOERROR\fR
-is returned if an I/O error occurs and
-\fBLWRES_R_TIMEOUT\fR
-is returned if
-\fBlwres_context_sendrecv()\fR
-times out waiting for a response\&.
-.SH "SEE ALSO"
-.PP
-\fBlwres_conf_init\fR(3),
-\fBmalloc\fR(3),
-\fBfree\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_context.html b/usr.sbin/bind/lib/lwres/man/lwres_context.html
deleted file mode 100644
index 9acbf2483f4..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_context.html
+++ /dev/null
@@ -1,302 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_context</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_context_create,
- lwres_context_destroy,
- lwres_context_nextserial,
- lwres_context_initserial,
- lwres_context_freemem,
- lwres_context_allocmem,
- lwres_context_sendrecv
- &#8212; lightweight resolver context management
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/lwres.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_context_create</b>(</code></td>
-<td>lwres_context_t **<var class="pdparam">contextp</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>void *<var class="pdparam">arg</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_malloc_t <var class="pdparam">malloc_function</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_free_t <var class="pdparam">free_function</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_context_destroy</b>(</code></td>
-<td>lwres_context_t **<var class="pdparam">contextp</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_context_initserial</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint32_t <var class="pdparam">serial</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-lwres_uint32_t
-<b class="fsfunc">lwres_context_nextserial</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_context_freemem</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>void *<var class="pdparam">mem</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">len</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_context_allocmem</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">len</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void *
-<b class="fsfunc">lwres_context_sendrecv</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>void *<var class="pdparam">sendbase</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">sendlen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>void *<var class="pdparam">recvbase</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">recvlen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int *<var class="pdparam">recvd_len</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_context_create()</code>
- creates a <span class="type">lwres_context_t</span> structure for use in
- lightweight resolver operations. It holds a socket and other
- data needed for communicating with a resolver daemon. The new
- <span class="type">lwres_context_t</span> is returned through
- <em class="parameter"><code>contextp</code></em>, a pointer to a
- <span class="type">lwres_context_t</span> pointer. This
- <span class="type">lwres_context_t</span> pointer must initially be NULL, and
- is modified to point to the newly created
- <span class="type">lwres_context_t</span>.
- </p>
- <p>
- When the lightweight resolver needs to perform dynamic memory
- allocation, it will call
- <em class="parameter"><code>malloc_function</code></em>
- to allocate memory and
- <em class="parameter"><code>free_function</code></em>
- to free it. If
- <em class="parameter"><code>malloc_function</code></em>
- and
- <em class="parameter"><code>free_function</code></em>
- are NULL, memory is allocated using
- <span class="citerefentry">
- <span class="refentrytitle">malloc</span>(3)
- </span>.
- and
- <span class="citerefentry">
- <span class="refentrytitle">free</span>(3)
- </span>.
-
- It is not permitted to have a NULL
- <em class="parameter"><code>malloc_function</code></em> and a non-NULL
- <em class="parameter"><code>free_function</code></em> or vice versa.
- <em class="parameter"><code>arg</code></em> is passed as the first parameter to
- the memory allocation functions. If
- <em class="parameter"><code>malloc_function</code></em> and
- <em class="parameter"><code>free_function</code></em> are NULL,
- <em class="parameter"><code>arg</code></em> is unused and should be passed as
- NULL.
- </p>
-
- <p>
- Once memory for the structure has been allocated,
- it is initialized using
- <span class="citerefentry">
- <span class="refentrytitle">lwres_conf_init</span>(3)
- </span>
- and returned via <em class="parameter"><code>*contextp</code></em>.
- </p>
-
- <p><code class="function">lwres_context_destroy()</code>
- destroys a <span class="type">lwres_context_t</span>, closing its socket.
- <em class="parameter"><code>contextp</code></em> is a pointer to a pointer to the
- context that is to be destroyed. The pointer will be set to
- NULL when the context has been destroyed.
- </p>
-
- <p>
- The context holds a serial number that is used to identify
- resolver request packets and associate responses with the
- corresponding requests. This serial number is controlled using
- <code class="function">lwres_context_initserial()</code> and
- <code class="function">lwres_context_nextserial()</code>.
- <code class="function">lwres_context_initserial()</code> sets the serial
- number for context <em class="parameter"><code>*ctx</code></em> to
- <em class="parameter"><code>serial</code></em>.
- <code class="function">lwres_context_nextserial()</code> increments the
- serial number and returns the previous value.
- </p>
-
- <p>
- Memory for a lightweight resolver context is allocated and freed
- using <code class="function">lwres_context_allocmem()</code> and
- <code class="function">lwres_context_freemem()</code>. These use
- whatever allocations were defined when the context was created
- with <code class="function">lwres_context_create()</code>.
- <code class="function">lwres_context_allocmem()</code> allocates
- <em class="parameter"><code>len</code></em> bytes of memory and if successful
- returns a pointer to the allocated storage.
- <code class="function">lwres_context_freemem()</code> frees
- <em class="parameter"><code>len</code></em> bytes of space starting at location
- <em class="parameter"><code>mem</code></em>.
- </p>
-
- <p><code class="function">lwres_context_sendrecv()</code>
- performs I/O for the context <em class="parameter"><code>ctx</code></em>. Data
- are read and written from the context's socket. It writes data
- from <em class="parameter"><code>sendbase</code></em> &#8212; typically a
- lightweight resolver query packet &#8212; and waits for a reply
- which is copied to the receive buffer at
- <em class="parameter"><code>recvbase</code></em>. The number of bytes that were
- written to this receive buffer is returned in
- <em class="parameter"><code>*recvd_len</code></em>.
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
-
- <p><code class="function">lwres_context_create()</code>
- returns <span class="errorcode">LWRES_R_NOMEMORY</span> if memory for
- the <span class="type">struct lwres_context</span> could not be allocated,
- <span class="errorcode">LWRES_R_SUCCESS</span> otherwise.
- </p>
- <p>
- Successful calls to the memory allocator
- <code class="function">lwres_context_allocmem()</code>
- return a pointer to the start of the allocated space.
- It returns NULL if memory could not be allocated.
- </p>
- <p><span class="errorcode">LWRES_R_SUCCESS</span>
- is returned when
- <code class="function">lwres_context_sendrecv()</code>
- completes successfully.
- <span class="errorcode">LWRES_R_IOERROR</span>
- is returned if an I/O error occurs and
- <span class="errorcode">LWRES_R_TIMEOUT</span>
- is returned if
- <code class="function">lwres_context_sendrecv()</code>
- times out waiting for a response.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_conf_init</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">malloc</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">free</span>(3)
- </span>.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gabn.3 b/usr.sbin/bind/lib/lwres/man/lwres_gabn.3
deleted file mode 100644
index 97cd0004850..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gabn.3
+++ /dev/null
@@ -1,225 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_gabn
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GABN" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.HP \w'lwres_result_t\ lwres_gabnrequest_render('u
-.BI "lwres_result_t lwres_gabnrequest_render(lwres_context_t\ *" "ctx" ", lwres_gabnrequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
-.HP \w'lwres_result_t\ lwres_gabnresponse_render('u
-.BI "lwres_result_t lwres_gabnresponse_render(lwres_context_t\ *" "ctx" ", lwres_gabnresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
-.HP \w'lwres_result_t\ lwres_gabnrequest_parse('u
-.BI "lwres_result_t lwres_gabnrequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gabnrequest_t\ **" "structp" ");"
-.HP \w'lwres_result_t\ lwres_gabnresponse_parse('u
-.BI "lwres_result_t lwres_gabnresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gabnresponse_t\ **" "structp" ");"
-.HP \w'void\ lwres_gabnresponse_free('u
-.BI "void lwres_gabnresponse_free(lwres_context_t\ *" "ctx" ", lwres_gabnresponse_t\ **" "structp" ");"
-.HP \w'void\ lwres_gabnrequest_free('u
-.BI "void lwres_gabnrequest_free(lwres_context_t\ *" "ctx" ", lwres_gabnrequest_t\ **" "structp" ");"
-.SH "DESCRIPTION"
-.PP
-These are low\-level routines for creating and parsing lightweight resolver name\-to\-address lookup request and response messages\&.
-.PP
-There are four main functions for the getaddrbyname opcode\&. One render function converts a getaddrbyname request structure \(em
-\fBlwres_gabnrequest_t\fR
-\(em to the lightweight resolver\*(Aqs canonical format\&. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure\&. Another render function converts the getaddrbyname response structure \(em
-\fBlwres_gabnresponse_t\fR
-\(em to the canonical format\&. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure\&.
-.PP
-These structures are defined in
-<lwres/lwres\&.h>\&. They are shown below\&.
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct lwres_addr lwres_addr_t;
-typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint32_t addrtypes;
- lwres_uint16_t namelen;
- char *name;
-} lwres_gabnrequest_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- lwres_addrlist_t addrs;
- void *base;
- size_t baselen;
-} lwres_gabnresponse_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fBlwres_gabnrequest_render()\fR
-uses resolver context
-\fIctx\fR
-to convert getaddrbyname request structure
-\fIreq\fR
-to canonical format\&. The packet header structure
-\fIpkt\fR
-is initialised and transferred to buffer
-\fIb\fR\&. The contents of
-\fI*req\fR
-are then appended to the buffer in canonical format\&.
-\fBlwres_gabnresponse_render()\fR
-performs the same task, except it converts a getaddrbyname response structure
-\fBlwres_gabnresponse_t\fR
-to the lightweight resolver\*(Aqs canonical format\&.
-.PP
-\fBlwres_gabnrequest_parse()\fR
-uses context
-\fIctx\fR
-to convert the contents of packet
-\fIpkt\fR
-to a
-\fBlwres_gabnrequest_t\fR
-structure\&. Buffer
-\fIb\fR
-provides space to be used for storing this structure\&. When the function succeeds, the resulting
-\fBlwres_gabnrequest_t\fR
-is made available through
-\fI*structp\fR\&.
-\fBlwres_gabnresponse_parse()\fR
-offers the same semantics as
-\fBlwres_gabnrequest_parse()\fR
-except it yields a
-\fBlwres_gabnresponse_t\fR
-structure\&.
-.PP
-\fBlwres_gabnresponse_free()\fR
-and
-\fBlwres_gabnrequest_free()\fR
-release the memory in resolver context
-\fIctx\fR
-that was allocated to the
-\fBlwres_gabnresponse_t\fR
-or
-\fBlwres_gabnrequest_t\fR
-structures referenced via
-\fIstructp\fR\&. Any memory associated with ancillary buffers and strings for those structures is also discarded\&.
-.SH "RETURN VALUES"
-.PP
-The getaddrbyname opcode functions
-\fBlwres_gabnrequest_render()\fR,
-\fBlwres_gabnresponse_render()\fR\fBlwres_gabnrequest_parse()\fR
-and
-\fBlwres_gabnresponse_parse()\fR
-all return
-\fBLWRES_R_SUCCESS\fR
-on success\&. They return
-\fBLWRES_R_NOMEMORY\fR
-if memory allocation fails\&.
-\fBLWRES_R_UNEXPECTEDEND\fR
-is returned if the available space in the buffer
-\fIb\fR
-is too small to accommodate the packet header or the
-\fBlwres_gabnrequest_t\fR
-and
-\fBlwres_gabnresponse_t\fR
-structures\&.
-\fBlwres_gabnrequest_parse()\fR
-and
-\fBlwres_gabnresponse_parse()\fR
-will return
-\fBLWRES_R_UNEXPECTEDEND\fR
-if the buffer is not empty after decoding the received packet\&. These functions will return
-\fBLWRES_R_FAILURE\fR
-if
-\fIpktflags\fR
-in the packet header structure
-\fBlwres_lwpacket_t\fR
-indicate that the packet is not a response to an earlier query\&.
-.SH "SEE ALSO"
-.PP
-\fBlwres_packet\fR(3)
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gabn.html b/usr.sbin/bind/lib/lwres/man/lwres_gabn.html
deleted file mode 100644
index 2aefac6df5c..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gabn.html
+++ /dev/null
@@ -1,312 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_gabn</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_gabnrequest_render,
- lwres_gabnresponse_render,
- lwres_gabnrequest_parse,
- lwres_gabnresponse_parse,
- lwres_gabnresponse_free,
- lwres_gabnrequest_free
- &#8212; lightweight resolver getaddrbyname message handling
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/lwres.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gabnrequest_render</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnrequest_t *<var class="pdparam">req</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gabnresponse_render</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnresponse_t *<var class="pdparam">req</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gabnrequest_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnrequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gabnresponse_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_gabnresponse_free</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_gabnrequest_free</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnrequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p>
- These are low-level routines for creating and parsing
- lightweight resolver name-to-address lookup request and
- response messages.
- </p>
- <p>
- There are four main functions for the getaddrbyname opcode.
- One render function converts a getaddrbyname request structure &#8212;
- <span class="type">lwres_gabnrequest_t</span> &#8212;
- to the lightweight resolver's canonical format.
- It is complemented by a parse function that converts a packet in this
- canonical format to a getaddrbyname request structure.
- Another render function converts the getaddrbyname response structure
- &#8212; <span class="type">lwres_gabnresponse_t</span> &#8212;
- to the canonical format.
- This is complemented by a parse function which converts a packet in
- canonical format to a getaddrbyname response structure.
- </p>
- <p>
- These structures are defined in
- <code class="filename">&lt;lwres/lwres.h&gt;</code>.
- They are shown below.
- </p>
- <pre class="programlisting">
-#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct lwres_addr lwres_addr_t;
-typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint32_t addrtypes;
- lwres_uint16_t namelen;
- char *name;
-} lwres_gabnrequest_t;
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- lwres_addrlist_t addrs;
- void *base;
- size_t baselen;
-} lwres_gabnresponse_t;
-</pre>
-<p>
- </p>
-
- <p><code class="function">lwres_gabnrequest_render()</code>
- uses resolver context <em class="parameter"><code>ctx</code></em> to convert
- getaddrbyname request structure <em class="parameter"><code>req</code></em> to
- canonical format. The packet header structure
- <em class="parameter"><code>pkt</code></em> is initialised and transferred to
- buffer <em class="parameter"><code>b</code></em>.
-
- The contents of <em class="parameter"><code>*req</code></em> are then appended to
- the buffer in canonical format.
- <code class="function">lwres_gabnresponse_render()</code> performs the
- same task, except it converts a getaddrbyname response structure
- <span class="type">lwres_gabnresponse_t</span> to the lightweight resolver's
- canonical format.
- </p>
-
- <p><code class="function">lwres_gabnrequest_parse()</code>
- uses context <em class="parameter"><code>ctx</code></em> to convert the contents
- of packet <em class="parameter"><code>pkt</code></em> to a
- <span class="type">lwres_gabnrequest_t</span> structure. Buffer
- <em class="parameter"><code>b</code></em> provides space to be used for storing
- this structure. When the function succeeds, the resulting
- <span class="type">lwres_gabnrequest_t</span> is made available through
- <em class="parameter"><code>*structp</code></em>.
-
- <code class="function">lwres_gabnresponse_parse()</code> offers the same
- semantics as <code class="function">lwres_gabnrequest_parse()</code>
- except it yields a <span class="type">lwres_gabnresponse_t</span> structure.
- </p>
-
- <p><code class="function">lwres_gabnresponse_free()</code>
- and <code class="function">lwres_gabnrequest_free()</code> release the
- memory in resolver context <em class="parameter"><code>ctx</code></em> that was
- allocated to the <span class="type">lwres_gabnresponse_t</span> or
- <span class="type">lwres_gabnrequest_t</span> structures referenced via
- <em class="parameter"><code>structp</code></em>.
-
- Any memory associated with ancillary buffers and strings for
- those structures is also discarded.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- The getaddrbyname opcode functions
- <code class="function">lwres_gabnrequest_render()</code>,
- <code class="function">lwres_gabnresponse_render()</code>
- <code class="function">lwres_gabnrequest_parse()</code>
- and
- <code class="function">lwres_gabnresponse_parse()</code>
- all return
- <span class="errorcode">LWRES_R_SUCCESS</span>
- on success.
- They return
- <span class="errorcode">LWRES_R_NOMEMORY</span>
- if memory allocation fails.
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- is returned if the available space in the buffer
- <em class="parameter"><code>b</code></em>
- is too small to accommodate the packet header or the
- <span class="type">lwres_gabnrequest_t</span>
- and
- <span class="type">lwres_gabnresponse_t</span>
- structures.
- <code class="function">lwres_gabnrequest_parse()</code>
- and
- <code class="function">lwres_gabnresponse_parse()</code>
- will return
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- if the buffer is not empty after decoding the received packet.
- These functions will return
- <span class="errorcode">LWRES_R_FAILURE</span>
- if
- <code class="varname">pktflags</code>
- in the packet header structure
- <span class="type">lwres_lwpacket_t</span>
- indicate that the packet is not a response to an earlier query.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_packet</span>(3)
- </span>
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.3 b/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.3
deleted file mode 100644
index 42068c9b0fc..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.3
+++ /dev/null
@@ -1,148 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_gai_strerror
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GAI_STRERROR" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_gai_strerror \- print suitable error string
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'char\ *\ gai_strerror('u
-.BI "char * gai_strerror(int\ " "ecode" ");"
-.SH "DESCRIPTION"
-.PP
-\fBlwres_gai_strerror()\fR
-returns an error message corresponding to an error code returned by
-\fBgetaddrinfo()\fR\&. The following error codes and their meaning are defined in
-include/lwres/netdb\&.h\&.
-.PP
-\fBEAI_ADDRFAMILY\fR
-.RS 4
-address family for hostname not supported
-.RE
-.PP
-\fBEAI_AGAIN\fR
-.RS 4
-temporary failure in name resolution
-.RE
-.PP
-\fBEAI_BADFLAGS\fR
-.RS 4
-invalid value for
-\fBai_flags\fR
-.RE
-.PP
-\fBEAI_FAIL\fR
-.RS 4
-non\-recoverable failure in name resolution
-.RE
-.PP
-\fBEAI_FAMILY\fR
-.RS 4
-\fBai_family\fR
-not supported
-.RE
-.PP
-\fBEAI_MEMORY\fR
-.RS 4
-memory allocation failure
-.RE
-.PP
-\fBEAI_NODATA\fR
-.RS 4
-no address associated with hostname
-.RE
-.PP
-\fBEAI_NONAME\fR
-.RS 4
-hostname or servname not provided, or not known
-.RE
-.PP
-\fBEAI_SERVICE\fR
-.RS 4
-servname not supported for
-\fBai_socktype\fR
-.RE
-.PP
-\fBEAI_SOCKTYPE\fR
-.RS 4
-\fBai_socktype\fR
-not supported
-.RE
-.PP
-\fBEAI_SYSTEM\fR
-.RS 4
-system error returned in errno
-.RE
-The message
-invalid error code
-is returned if
-\fIecode\fR
-is out of range\&.
-.PP
-\fBai_flags\fR,
-\fBai_family\fR
-and
-\fBai_socktype\fR
-are elements of the
-\fBstruct addrinfo\fR
-used by
-\fBlwres_getaddrinfo()\fR\&.
-.SH "SEE ALSO"
-.PP
-\fBstrerror\fR(3),
-\fBlwres_getaddrinfo\fR(3),
-\fBgetaddrinfo\fR(3),
-\fBRFC2133\fR()\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html b/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html
deleted file mode 100644
index 2b63797b983..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html
+++ /dev/null
@@ -1,168 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_gai_strerror</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_gai_strerror
- &#8212; print suitable error string
- </p>
-</div>
-
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-char *
-<b class="fsfunc">gai_strerror</b>(</code></td>
-<td>int <var class="pdparam">ecode</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_gai_strerror()</code>
- returns an error message corresponding to an error code returned by
- <code class="function">getaddrinfo()</code>.
- The following error codes and their meaning are defined in
- <code class="filename">include/lwres/netdb.h</code>.
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><span class="errorcode">EAI_ADDRFAMILY</span></span></dt>
-<dd>
- <p>
- address family for hostname not supported
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_AGAIN</span></span></dt>
-<dd>
- <p>
- temporary failure in name resolution
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_BADFLAGS</span></span></dt>
-<dd>
- <p>
- invalid value for
- <code class="constant">ai_flags</code>
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_FAIL</span></span></dt>
-<dd>
- <p>
- non-recoverable failure in name resolution
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_FAMILY</span></span></dt>
-<dd>
- <p><code class="constant">ai_family</code> not supported
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_MEMORY</span></span></dt>
-<dd>
- <p>
- memory allocation failure
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_NODATA</span></span></dt>
-<dd>
- <p>
- no address associated with hostname
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_NONAME</span></span></dt>
-<dd>
- <p>
- hostname or servname not provided, or not known
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_SERVICE</span></span></dt>
-<dd>
- <p>
- servname not supported for <code class="constant">ai_socktype</code>
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_SOCKTYPE</span></span></dt>
-<dd>
- <p><code class="constant">ai_socktype</code> not supported
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">EAI_SYSTEM</span></span></dt>
-<dd>
- <p>
- system error returned in errno
- </p>
- </dd>
-</dl></div>
-<p>
- The message <span class="errorname">invalid error code</span> is returned if
- <em class="parameter"><code>ecode</code></em>
- is out of range.
- </p>
- <p><code class="constant">ai_flags</code>,
- <code class="constant">ai_family</code>
- and
- <code class="constant">ai_socktype</code>
- are elements of the
- <span class="type">struct addrinfo</span>
- used by
- <code class="function">lwres_getaddrinfo()</code>.
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">strerror</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getaddrinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">getaddrinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">RFC2133</span>
- </span>.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.3 b/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.3
deleted file mode 100644
index a448ebe5bf3..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.3
+++ /dev/null
@@ -1,262 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_getaddrinfo
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GETADDRINFO" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_getaddrinfo, lwres_freeaddrinfo \- socket address structure to host and service name
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'int\ lwres_getaddrinfo('u
-.BI "int lwres_getaddrinfo(const\ char\ *" "hostname" ", const\ char\ *" "servname" ", const\ struct\ addrinfo\ *" "hints" ", struct\ addrinfo\ **" "res" ");"
-.HP \w'void\ lwres_freeaddrinfo('u
-.BI "void lwres_freeaddrinfo(struct\ addrinfo\ *" "ai" ");"
-.PP
-If the operating system does not provide a
-\fBstruct addrinfo\fR, the following structure is used:
-.PP
-.nf
-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 */
-};
-.fi
-.sp
-.SH "DESCRIPTION"
-.PP
-\fBlwres_getaddrinfo()\fR
-is used to get a list of IP addresses and port numbers for host
-\fIhostname\fR
-and service
-\fIservname\fR\&. The function is the lightweight resolver\*(Aqs implementation of
-\fBgetaddrinfo()\fR
-as defined in RFC2133\&.
-\fIhostname\fR
-and
-\fIservname\fR
-are pointers to null\-terminated strings or
-\fBNULL\fR\&.
-\fIhostname\fR
-is either a host name or a numeric host address string: a dotted decimal IPv4 address or an IPv6 address\&.
-\fIservname\fR
-is either a decimal port number or a service name as listed in
-/etc/services\&.
-.PP
-\fIhints\fR
-is an optional pointer to a
-\fBstruct addrinfo\fR\&. This structure can be used to provide hints concerning the type of socket that the caller supports or wishes to use\&. The caller can supply the following structure elements in
-\fI*hints\fR:
-.PP
-\fBai_family\fR
-.RS 4
-The protocol family that should be used\&. When
-\fBai_family\fR
-is set to
-\fBPF_UNSPEC\fR, it means the caller will accept any protocol family supported by the operating system\&.
-.RE
-.PP
-\fBai_socktype\fR
-.RS 4
-denotes the type of socket \(em
-\fBSOCK_STREAM\fR,
-\fBSOCK_DGRAM\fR
-or
-\fBSOCK_RAW\fR
-\(em that is wanted\&. When
-\fBai_socktype\fR
-is zero the caller will accept any socket type\&.
-.RE
-.PP
-\fBai_protocol\fR
-.RS 4
-indicates which transport protocol is wanted: IPPROTO_UDP or IPPROTO_TCP\&. If
-\fBai_protocol\fR
-is zero the caller will accept any protocol\&.
-.RE
-.PP
-\fBai_flags\fR
-.RS 4
-Flag bits\&. If the
-\fBAI_CANONNAME\fR
-bit is set, a successful call to
-\fBlwres_getaddrinfo()\fR
-will return a null\-terminated string containing the canonical name of the specified hostname in
-\fBai_canonname\fR
-of the first
-\fBaddrinfo\fR
-structure returned\&. Setting the
-\fBAI_PASSIVE\fR
-bit indicates that the returned socket address structure is intended for used in a call to
-\fBbind\fR(2)\&. In this case, if the hostname argument is a
-\fBNULL\fR
-pointer, then the IP address portion of the socket address structure will be set to
-\fBINADDR_ANY\fR
-for an IPv4 address or
-\fBIN6ADDR_ANY_INIT\fR
-for an IPv6 address\&.
-.sp
-When
-\fBai_flags\fR
-does not set the
-\fBAI_PASSIVE\fR
-bit, the returned socket address structure will be ready for use in a call to
-\fBconnect\fR(2)
-for a connection\-oriented protocol or
-\fBconnect\fR(2),
-\fBsendto\fR(2), or
-\fBsendmsg\fR(2)
-if a connectionless protocol was chosen\&. The IP address portion of the socket address structure will be set to the loopback address if
-\fIhostname\fR
-is a
-\fBNULL\fR
-pointer and
-\fBAI_PASSIVE\fR
-is not set in
-\fBai_flags\fR\&.
-.sp
-If
-\fBai_flags\fR
-is set to
-\fBAI_NUMERICHOST\fR
-it indicates that
-\fIhostname\fR
-should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted\&.
-.RE
-.PP
-All other elements of the
-\fBstruct addrinfo\fR
-passed via
-\fIhints\fR
-must be zero\&.
-.PP
-A
-\fIhints\fR
-of
-\fBNULL\fR
-is treated as if the caller provided a
-\fBstruct addrinfo\fR
-initialized to zero with
-\fBai_family\fRset to
-\fBPF_UNSPEC\fR\&.
-.PP
-After a successful call to
-\fBlwres_getaddrinfo()\fR,
-\fI*res\fR
-is a pointer to a linked list of one or more
-\fBaddrinfo\fR
-structures\&. Each
-\fBstruct addrinfo\fR
-in this list cn be processed by following the
-\fBai_next\fR
-pointer, until a
-\fBNULL\fR
-pointer is encountered\&. The three members
-\fBai_family\fR,
-\fBai_socktype\fR, and
-\fBai_protocol\fR
-in each returned
-\fBaddrinfo\fR
-structure contain the corresponding arguments for a call to
-\fBsocket\fR(2)\&. For each
-\fBaddrinfo\fR
-structure in the list, the
-\fBai_addr\fR
-member points to a filled\-in socket address structure of length
-\fBai_addrlen\fR\&.
-.PP
-All of the information returned by
-\fBlwres_getaddrinfo()\fR
-is dynamically allocated: the addrinfo structures, and the socket address structures and canonical host name strings pointed to by the
-\fBaddrinfo\fRstructures\&. Memory allocated for the dynamically allocated structures created by a successful call to
-\fBlwres_getaddrinfo()\fR
-is released by
-\fBlwres_freeaddrinfo()\fR\&.
-\fIai\fR
-is a pointer to a
-\fBstruct addrinfo\fR
-created by a call to
-\fBlwres_getaddrinfo()\fR\&.
-.SH "RETURN VALUES"
-.PP
-\fBlwres_getaddrinfo()\fR
-returns zero on success or one of the error codes listed in
-\fBgai_strerror\fR(3)
-if an error occurs\&. If both
-\fIhostname\fR
-and
-\fIservname\fR
-are
-\fBNULL\fR\fBlwres_getaddrinfo()\fR
-returns
-\fBEAI_NONAME\fR\&.
-.SH "SEE ALSO"
-.PP
-\fBlwres\fR(3),
-\fBlwres_getaddrinfo\fR(3),
-\fBlwres_freeaddrinfo\fR(3),
-\fBlwres_gai_strerror\fR(3),
-\fBRFC2133\fR(),
-\fBgetservbyname\fR(3),
-\fBbind\fR(2),
-\fBconnect\fR(2),
-\fBsendto\fR(2),
-\fBsendmsg\fR(2),
-\fBsocket\fR(2)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html b/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html
deleted file mode 100644
index f2d1ce182f7..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html
+++ /dev/null
@@ -1,382 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_getaddrinfo</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_getaddrinfo,
- lwres_freeaddrinfo
- &#8212; socket address structure to host and service name
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-int
-<b class="fsfunc">lwres_getaddrinfo</b>(</code></td>
-<td>const char *<var class="pdparam">hostname</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const char *<var class="pdparam">servname</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const struct addrinfo *<var class="pdparam">hints</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>struct addrinfo **<var class="pdparam">res</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_freeaddrinfo</b>(</code></td>
-<td>struct addrinfo *<var class="pdparam">ai</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
-
- <p>
- If the operating system does not provide a
- <span class="type">struct addrinfo</span>,
- the following structure is used:
- </p>
- <pre class="programlisting">
-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 */
-};
-</pre>
-<p>
- </p>
-
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_getaddrinfo()</code>
- is used to get a list of IP addresses and port numbers for host
- <em class="parameter"><code>hostname</code></em> and service
- <em class="parameter"><code>servname</code></em>.
-
- The function is the lightweight resolver's implementation of
- <code class="function">getaddrinfo()</code> as defined in RFC2133.
- <em class="parameter"><code>hostname</code></em> and
- <em class="parameter"><code>servname</code></em> are pointers to null-terminated
- strings or <span class="type">NULL</span>.
-
- <em class="parameter"><code>hostname</code></em> is either a host name or a
- numeric host address string: a dotted decimal IPv4 address or an
- IPv6 address. <em class="parameter"><code>servname</code></em> is either a
- decimal port number or a service name as listed in
- <code class="filename">/etc/services</code>.
- </p>
-
- <p><em class="parameter"><code>hints</code></em>
- is an optional pointer to a
- <span class="type">struct addrinfo</span>.
- This structure can be used to provide hints concerning the type of
- socket
- that the caller supports or wishes to use.
- The caller can supply the following structure elements in
- <em class="parameter"><code>*hints</code></em>:
-
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">ai_family</code></span></dt>
-<dd>
- <p>
- The protocol family that should be used.
- When
- <code class="constant">ai_family</code>
- is set to
- <span class="type">PF_UNSPEC</span>,
- it means the caller will accept any protocol family supported by
- the
- operating system.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ai_socktype</code></span></dt>
-<dd>
- <p>
- denotes the type of socket &#8212;
- <span class="type">SOCK_STREAM</span>,
- <span class="type">SOCK_DGRAM</span>
- or
- <span class="type">SOCK_RAW</span>
- &#8212; that is wanted.
- When
- <code class="constant">ai_socktype</code>
- is zero the caller will accept any socket type.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ai_protocol</code></span></dt>
-<dd>
- <p>
- indicates which transport protocol is wanted: IPPROTO_UDP or
- IPPROTO_TCP.
- If
- <code class="constant">ai_protocol</code>
- is zero the caller will accept any protocol.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ai_flags</code></span></dt>
-<dd>
- <p>
- Flag bits.
- If the
- <span class="type">AI_CANONNAME</span>
- bit is set, a successful call to
- <code class="function">lwres_getaddrinfo()</code>
- will return a null-terminated string containing the canonical
- name
- of the specified hostname in
- <code class="constant">ai_canonname</code>
- of the first
- <span class="type">addrinfo</span>
- structure returned.
- Setting the
- <span class="type">AI_PASSIVE</span>
- bit indicates that the returned socket address structure is
- intended
- for used in a call to
- <span class="citerefentry">
- <span class="refentrytitle">bind</span>(2)
- </span>.
-
- In this case, if the hostname argument is a
- <span class="type">NULL</span>
- pointer, then the IP address portion of the socket
- address structure will be set to
- <span class="type">INADDR_ANY</span>
- for an IPv4 address or
- <span class="type">IN6ADDR_ANY_INIT</span>
- for an IPv6 address.
- </p>
- <p>
- When
- <code class="constant">ai_flags</code>
- does not set the
- <span class="type">AI_PASSIVE</span>
- bit, the returned socket address structure will be ready
- for use in a call to
- <span class="citerefentry">
- <span class="refentrytitle">connect</span>(2)
- </span>
- for a connection-oriented protocol or
- <span class="citerefentry">
- <span class="refentrytitle">connect</span>(2)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">sendto</span>(2)
- </span>,
-
- or
- <span class="citerefentry">
- <span class="refentrytitle">sendmsg</span>(2)
- </span>
- if a connectionless protocol was chosen.
- The IP address portion of the socket address structure will be
- set to the loopback address if
- <em class="parameter"><code>hostname</code></em>
- is a
- <span class="type">NULL</span>
- pointer and
- <span class="type">AI_PASSIVE</span>
- is not set in
- <code class="constant">ai_flags</code>.
- </p>
- <p>
- If
- <code class="constant">ai_flags</code>
- is set to
- <span class="type">AI_NUMERICHOST</span>
- it indicates that
- <em class="parameter"><code>hostname</code></em>
- should be treated as a numeric string defining an IPv4 or IPv6
- address
- and no name resolution should be attempted.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
-
- <p>
- All other elements of the <span class="type">struct addrinfo</span> passed
- via <em class="parameter"><code>hints</code></em> must be zero.
- </p>
-
- <p>
- A <em class="parameter"><code>hints</code></em> of <span class="type">NULL</span> is
- treated as if
- the caller provided a <span class="type">struct addrinfo</span> initialized to zero
- with <code class="constant">ai_family</code>set to
- <code class="constant">PF_UNSPEC</code>.
- </p>
-
- <p>
- After a successful call to
- <code class="function">lwres_getaddrinfo()</code>,
- <em class="parameter"><code>*res</code></em>
- is a pointer to a linked list of one or more
- <span class="type">addrinfo</span>
- structures.
- Each
- <span class="type">struct addrinfo</span>
- in this list cn be processed by following
- the
- <code class="constant">ai_next</code>
- pointer, until a
- <span class="type">NULL</span>
- pointer is encountered.
- The three members
- <code class="constant">ai_family</code>,
- <code class="constant">ai_socktype</code>,
- and
- <code class="constant">ai_protocol</code>
- in each
- returned
- <span class="type">addrinfo</span>
- structure contain the corresponding arguments for a call to
- <span class="citerefentry">
- <span class="refentrytitle">socket</span>(2)
- </span>.
- For each
- <span class="type">addrinfo</span>
- structure in the list, the
- <code class="constant">ai_addr</code>
- member points to a filled-in socket address structure of length
- <code class="constant">ai_addrlen</code>.
- </p>
-
- <p>
- All of the information returned by
- <code class="function">lwres_getaddrinfo()</code>
- is dynamically allocated: the addrinfo structures, and the socket
- address structures and canonical host name strings pointed to by the
- <code class="constant">addrinfo</code>structures.
- Memory allocated for the dynamically allocated structures created by
- a successful call to
- <code class="function">lwres_getaddrinfo()</code>
- is released by
- <code class="function">lwres_freeaddrinfo()</code>.
- <em class="parameter"><code>ai</code></em>
- is a pointer to a
- <span class="type">struct addrinfo</span>
- created by a call to
- <code class="function">lwres_getaddrinfo()</code>.
- </p>
-
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
-
- <p><code class="function">lwres_getaddrinfo()</code>
- returns zero on success or one of the error codes listed in
- <span class="citerefentry">
- <span class="refentrytitle">gai_strerror</span>(3)
- </span>
- if an error occurs. If both <em class="parameter"><code>hostname</code></em> and
- <em class="parameter"><code>servname</code></em> are <span class="type">NULL</span>
- <code class="function">lwres_getaddrinfo()</code> returns
- <span class="errorcode">EAI_NONAME</span>.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getaddrinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_freeaddrinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_gai_strerror</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">RFC2133</span>
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">getservbyname</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">bind</span>(2)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">connect</span>(2)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">sendto</span>(2)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">sendmsg</span>(2)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">socket</span>(2)
- </span>.
- </p>
-
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gethostent.3 b/usr.sbin/bind/lib/lwres/man/lwres_gethostent.3
deleted file mode 100644
index 98f6104b510..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gethostent.3
+++ /dev/null
@@ -1,337 +0,0 @@
-.\" Copyright (C) 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_gethostent
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GETHOSTENT" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_gethostbyname, lwres_gethostbyname2, lwres_gethostbyaddr, lwres_gethostent, lwres_sethostent, lwres_endhostent, lwres_gethostbyname_r, lwres_gethostbyaddr_r, lwres_gethostent_r, lwres_sethostent_r, lwres_endhostent_r \- lightweight resolver get network host entry
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'struct\ hostent\ *\ lwres_gethostbyname('u
-.BI "struct hostent * lwres_gethostbyname(const\ char\ *" "name" ");"
-.HP \w'struct\ hostent\ *\ lwres_gethostbyname2('u
-.BI "struct hostent * lwres_gethostbyname2(const\ char\ *" "name" ", int\ " "af" ");"
-.HP \w'struct\ hostent\ *\ lwres_gethostbyaddr('u
-.BI "struct hostent * lwres_gethostbyaddr(const\ char\ *" "addr" ", int\ " "len" ", int\ " "type" ");"
-.HP \w'struct\ hostent\ *\ lwres_gethostent('u
-.BI "struct hostent * lwres_gethostent(void);"
-.HP \w'void\ lwres_sethostent('u
-.BI "void lwres_sethostent(int\ " "stayopen" ");"
-.HP \w'void\ lwres_endhostent('u
-.BI "void lwres_endhostent(void);"
-.HP \w'struct\ hostent\ *\ lwres_gethostbyname_r('u
-.BI "struct hostent * lwres_gethostbyname_r(const\ char\ *" "name" ", struct\ hostent\ *" "resbuf" ", char\ *" "buf" ", int\ " "buflen" ", int\ *" "error" ");"
-.HP \w'struct\ hostent\ *\ lwres_gethostbyaddr_r('u
-.BI "struct hostent * lwres_gethostbyaddr_r(const\ char\ *" "addr" ", int\ " "len" ", int\ " "type" ", struct\ hostent\ *" "resbuf" ", char\ *" "buf" ", int\ " "buflen" ", int\ *" "error" ");"
-.HP \w'struct\ hostent\ *\ lwres_gethostent_r('u
-.BI "struct hostent * lwres_gethostent_r(struct\ hostent\ *" "resbuf" ", char\ *" "buf" ", int\ " "buflen" ", int\ *" "error" ");"
-.HP \w'void\ lwres_sethostent_r('u
-.BI "void lwres_sethostent_r(int\ " "stayopen" ");"
-.HP \w'void\ lwres_endhostent_r('u
-.BI "void lwres_endhostent_r(void);"
-.SH "DESCRIPTION"
-.PP
-These functions provide hostname\-to\-address and address\-to\-hostname lookups by means of the lightweight resolver\&. They are similar to the standard
-\fBgethostent\fR(3)
-functions provided by most operating systems\&. They use a
-\fBstruct hostent\fR
-which is usually defined in
-<namedb\&.h>\&.
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-struct hostent {
- char *h_name; /* official name of host */
- char **h_aliases; /* alias list */
- int h_addrtype; /* host address type */
- int h_length; /* length of address */
- char **h_addr_list; /* list of addresses from name server */
-};
-#define h_addr h_addr_list[0] /* address, for backward compatibility */
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The members of this structure are:
-.PP
-\fBh_name\fR
-.RS 4
-The official (canonical) name of the host\&.
-.RE
-.PP
-\fBh_aliases\fR
-.RS 4
-A NULL\-terminated array of alternate names (nicknames) for the host\&.
-.RE
-.PP
-\fBh_addrtype\fR
-.RS 4
-The type of address being returned \(em
-\fBPF_INET\fR
-or
-\fBPF_INET6\fR\&.
-.RE
-.PP
-\fBh_length\fR
-.RS 4
-The length of the address in bytes\&.
-.RE
-.PP
-\fBh_addr_list\fR
-.RS 4
-A
-\fBNULL\fR
-terminated array of network addresses for the host\&. Host addresses are returned in network byte order\&.
-.RE
-.PP
-For backward compatibility with very old software,
-\fBh_addr\fR
-is the first address in
-\fBh_addr_list\&.\fR
-.PP
-\fBlwres_gethostent()\fR,
-\fBlwres_sethostent()\fR,
-\fBlwres_endhostent()\fR,
-\fBlwres_gethostent_r()\fR,
-\fBlwres_sethostent_r()\fR
-and
-\fBlwres_endhostent_r()\fR
-provide iteration over the known host entries on systems that provide such functionality through facilities like
-/etc/hosts
-or NIS\&. The lightweight resolver does not currently implement these functions; it only provides them as stub functions that always return failure\&.
-.PP
-\fBlwres_gethostbyname()\fR
-and
-\fBlwres_gethostbyname2()\fR
-look up the hostname
-\fIname\fR\&.
-\fBlwres_gethostbyname()\fR
-always looks for an IPv4 address while
-\fBlwres_gethostbyname2()\fR
-looks for an address of protocol family
-\fIaf\fR: either
-\fBPF_INET\fR
-or
-\fBPF_INET6\fR
-\(em IPv4 or IPV6 addresses respectively\&. Successful calls of the functions return a
-\fBstruct hostent\fRfor the name that was looked up\&.
-\fBNULL\fR
-is returned if the lookups by
-\fBlwres_gethostbyname()\fR
-or
-\fBlwres_gethostbyname2()\fR
-fail\&.
-.PP
-Reverse lookups of addresses are performed by
-\fBlwres_gethostbyaddr()\fR\&.
-\fIaddr\fR
-is an address of length
-\fIlen\fR
-bytes and protocol family
-\fItype\fR
-\(em
-\fBPF_INET\fR
-or
-\fBPF_INET6\fR\&.
-\fBlwres_gethostbyname_r()\fR
-is a thread\-safe function for forward lookups\&. If an error occurs, an error code is returned in
-\fI*error\fR\&.
-\fIresbuf\fR
-is a pointer to a
-\fBstruct hostent\fR
-which is initialised by a successful call to
-\fBlwres_gethostbyname_r()\fR\&.
-\fIbuf\fR
-is a buffer of length
-\fIlen\fR
-bytes which is used to store the
-\fBh_name\fR,
-\fBh_aliases\fR, and
-\fBh_addr_list\fR
-elements of the
-\fBstruct hostent\fR
-returned in
-\fIresbuf\fR\&. Successful calls to
-\fBlwres_gethostbyname_r()\fR
-return
-\fIresbuf\fR, which is a pointer to the
-\fBstruct hostent\fR
-it created\&.
-.PP
-\fBlwres_gethostbyaddr_r()\fR
-is a thread\-safe function that performs a reverse lookup of address
-\fIaddr\fR
-which is
-\fIlen\fR
-bytes long and is of protocol family
-\fItype\fR
-\(em
-\fBPF_INET\fR
-or
-\fBPF_INET6\fR\&. If an error occurs, the error code is returned in
-\fI*error\fR\&. The other function parameters are identical to those in
-\fBlwres_gethostbyname_r()\fR\&.
-\fIresbuf\fR
-is a pointer to a
-\fBstruct hostent\fR
-which is initialised by a successful call to
-\fBlwres_gethostbyaddr_r()\fR\&.
-\fIbuf\fR
-is a buffer of length
-\fIlen\fR
-bytes which is used to store the
-\fBh_name\fR,
-\fBh_aliases\fR, and
-\fBh_addr_list\fR
-elements of the
-\fBstruct hostent\fR
-returned in
-\fIresbuf\fR\&. Successful calls to
-\fBlwres_gethostbyaddr_r()\fR
-return
-\fIresbuf\fR, which is a pointer to the
-\fBstruct hostent()\fR
-it created\&.
-.SH "RETURN VALUES"
-.PP
-The functions
-\fBlwres_gethostbyname()\fR,
-\fBlwres_gethostbyname2()\fR,
-\fBlwres_gethostbyaddr()\fR, and
-\fBlwres_gethostent()\fR
-return NULL to indicate an error\&. In this case the global variable
-\fBlwres_h_errno\fR
-will contain one of the following error codes defined in
-<lwres/netdb\&.h>:
-.PP
-\fBHOST_NOT_FOUND\fR
-.RS 4
-The host or address was not found\&.
-.RE
-.PP
-\fBTRY_AGAIN\fR
-.RS 4
-A recoverable error occurred, e\&.g\&., a timeout\&. Retrying the lookup may succeed\&.
-.RE
-.PP
-\fBNO_RECOVERY\fR
-.RS 4
-A non\-recoverable error occurred\&.
-.RE
-.PP
-\fBNO_DATA\fR
-.RS 4
-The name exists, but has no address information associated with it (or vice versa in the case of a reverse lookup)\&. The code NO_ADDRESS is accepted as a synonym for NO_DATA for backwards compatibility\&.
-.RE
-.PP
-\fBlwres_hstrerror\fR(3)
-translates these error codes to suitable error messages\&.
-.PP
-\fBlwres_gethostent()\fR
-and
-\fBlwres_gethostent_r()\fR
-always return
-\fBNULL\fR\&.
-.PP
-Successful calls to
-\fBlwres_gethostbyname_r()\fR
-and
-\fBlwres_gethostbyaddr_r()\fR
-return
-\fIresbuf\fR, a pointer to the
-\fBstruct hostent\fR
-that was initialised by these functions\&. They return
-\fBNULL\fR
-if the lookups fail or if
-\fIbuf\fR
-was too small to hold the list of addresses and names referenced by the
-\fBh_name\fR,
-\fBh_aliases\fR, and
-\fBh_addr_list\fR
-elements of the
-\fBstruct hostent\fR\&. If
-\fIbuf\fR
-was too small, both
-\fBlwres_gethostbyname_r()\fR
-and
-\fBlwres_gethostbyaddr_r()\fR
-set the global variable
-\fBerrno\fR
-to
-\fBERANGE\fR\&.
-.SH "SEE ALSO"
-.PP
-\fBgethostent\fR(3),
-\fBlwres_getipnode\fR(3),
-\fBlwres_hstrerror\fR(3)
-.SH "BUGS"
-.PP
-\fBlwres_gethostbyname()\fR,
-\fBlwres_gethostbyname2()\fR,
-\fBlwres_gethostbyaddr()\fR
-and
-\fBlwres_endhostent()\fR
-are not thread safe; they return pointers to static data and provide error codes through a global variable\&. Thread\-safe versions for name and address lookup are provided by
-\fBlwres_gethostbyname_r()\fR, and
-\fBlwres_gethostbyaddr_r()\fR
-respectively\&.
-.PP
-The resolver daemon does not currently support any non\-DNS name services such as
-/etc/hosts
-or
-\fBNIS\fR, consequently the above functions don\*(Aqt, either\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html b/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html
deleted file mode 100644
index 1d24f805752..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html
+++ /dev/null
@@ -1,485 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_gethostent</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_gethostbyname,
- lwres_gethostbyname2,
- lwres_gethostbyaddr,
- lwres_gethostent,
- lwres_sethostent,
- lwres_endhostent,
- lwres_gethostbyname_r,
- lwres_gethostbyaddr_r,
- lwres_gethostent_r,
- lwres_sethostent_r,
- lwres_endhostent_r
- &#8212; lightweight resolver get network host entry
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostbyname</b>(</code></td>
-<td>const char *<var class="pdparam">name</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostbyname2</b>(</code></td>
-<td>const char *<var class="pdparam">name</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">af</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostbyaddr</b>(</code></td>
-<td>const char *<var class="pdparam">addr</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">len</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">type</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostent</b>(</code></td>
-<td>void<code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_sethostent</b>(</code></td>
-<td>int <var class="pdparam">stayopen</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_endhostent</b>(</code></td>
-<td>void<code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostbyname_r</b>(</code></td>
-<td>const char *<var class="pdparam">name</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>struct hostent *<var class="pdparam">resbuf</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char *<var class="pdparam">buf</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">buflen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int *<var class="pdparam">error</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostbyaddr_r</b>(</code></td>
-<td>const char *<var class="pdparam">addr</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">len</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">type</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>struct hostent *<var class="pdparam">resbuf</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char *<var class="pdparam">buf</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">buflen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int *<var class="pdparam">error</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_gethostent_r</b>(</code></td>
-<td>struct hostent *<var class="pdparam">resbuf</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char *<var class="pdparam">buf</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">buflen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int *<var class="pdparam">error</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_sethostent_r</b>(</code></td>
-<td>int <var class="pdparam">stayopen</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_endhostent_r</b>(</code></td>
-<td>void<code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p>
- These functions provide hostname-to-address and
- address-to-hostname lookups by means of the lightweight resolver.
- They are similar to the standard
- <span class="citerefentry">
- <span class="refentrytitle">gethostent</span>(3)
- </span>
- functions provided by most operating systems.
- They use a
- <span class="type">struct hostent</span>
- which is usually defined in
- <code class="filename">&lt;namedb.h&gt;</code>.
- </p>
- <pre class="programlisting">
-struct hostent {
- char *h_name; /* official name of host */
- char **h_aliases; /* alias list */
- int h_addrtype; /* host address type */
- int h_length; /* length of address */
- char **h_addr_list; /* list of addresses from name server */
-};
-#define h_addr h_addr_list[0] /* address, for backward compatibility */
-</pre>
-<p>
- </p>
- <p>
- The members of this structure are:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">h_name</code></span></dt>
-<dd>
- <p>
- The official (canonical) name of the host.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_aliases</code></span></dt>
-<dd>
- <p>
- A NULL-terminated array of alternate names (nicknames) for the
- host.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_addrtype</code></span></dt>
-<dd>
- <p>
- The type of address being returned &#8212;
- <span class="type">PF_INET</span>
- or
- <span class="type">PF_INET6</span>.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_length</code></span></dt>
-<dd>
- <p>
- The length of the address in bytes.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_addr_list</code></span></dt>
-<dd>
- <p>
- A <span class="type">NULL</span>
- terminated array of network addresses for the host.
- Host addresses are returned in network byte order.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
- <p>
- For backward compatibility with very old software,
- <code class="constant">h_addr</code>
- is the first address in
- <code class="constant">h_addr_list.</code>
- </p>
- <p><code class="function">lwres_gethostent()</code>,
- <code class="function">lwres_sethostent()</code>,
- <code class="function">lwres_endhostent()</code>,
- <code class="function">lwres_gethostent_r()</code>,
- <code class="function">lwres_sethostent_r()</code>
- and
- <code class="function">lwres_endhostent_r()</code>
- provide iteration over the known host entries on systems that
- provide such functionality through facilities like
- <code class="filename">/etc/hosts</code>
- or NIS. The lightweight resolver does not currently implement
- these functions; it only provides them as stub functions that always
- return failure.
- </p>
-
- <p><code class="function">lwres_gethostbyname()</code>
- and <code class="function">lwres_gethostbyname2()</code> look up the
- hostname <em class="parameter"><code>name</code></em>.
- <code class="function">lwres_gethostbyname()</code> always looks for an
- IPv4 address while <code class="function">lwres_gethostbyname2()</code>
- looks for an address of protocol family
- <em class="parameter"><code>af</code></em>: either <span class="type">PF_INET</span> or
- <span class="type">PF_INET6</span> &#8212; IPv4 or IPV6 addresses
- respectively. Successful calls of the functions return a
- <span class="type">struct hostent</span>for the name that was looked up.
- <span class="type">NULL</span> is returned if the lookups by
- <code class="function">lwres_gethostbyname()</code> or
- <code class="function">lwres_gethostbyname2()</code> fail.
- </p>
-
- <p>
- Reverse lookups of addresses are performed by
- <code class="function">lwres_gethostbyaddr()</code>.
- <em class="parameter"><code>addr</code></em> is an address of length
- <em class="parameter"><code>len</code></em> bytes and protocol family
- <em class="parameter"><code>type</code></em> &#8212; <span class="type">PF_INET</span> or
- <span class="type">PF_INET6</span>.
- <code class="function">lwres_gethostbyname_r()</code> is a
- thread-safe function
- for forward lookups. If an error occurs, an error code is returned in
- <em class="parameter"><code>*error</code></em>.
- <em class="parameter"><code>resbuf</code></em> is a pointer to a
- <span class="type">struct hostent</span> which is initialised by a successful call to
- <code class="function">lwres_gethostbyname_r()</code>.
- <em class="parameter"><code>buf</code></em> is a buffer of length
- <em class="parameter"><code>len</code></em> bytes which is used to store the
- <code class="constant">h_name</code>, <code class="constant">h_aliases</code>, and
- <code class="constant">h_addr_list</code> elements of the
- <span class="type">struct hostent</span> returned in <em class="parameter"><code>resbuf</code></em>.
- Successful calls to <code class="function">lwres_gethostbyname_r()</code>
- return <em class="parameter"><code>resbuf</code></em>,
- which is a pointer to the <span class="type">struct hostent</span> it created.
- </p>
-
- <p><code class="function">lwres_gethostbyaddr_r()</code>
- is a thread-safe function
- that performs a reverse lookup of address <em class="parameter"><code>addr</code></em>
- which is <em class="parameter"><code>len</code></em> bytes long and is of
- protocol
- family <em class="parameter"><code>type</code></em> &#8212; <span class="type">PF_INET</span> or
- <span class="type">PF_INET6</span>. If an error occurs, the error code is returned
- in <em class="parameter"><code>*error</code></em>. The other function
- parameters are
- identical to those in <code class="function">lwres_gethostbyname_r()</code>.
- <em class="parameter"><code>resbuf</code></em> is a pointer to a
- <span class="type">struct hostent</span> which is initialised by a successful call to
- <code class="function">lwres_gethostbyaddr_r()</code>.
- <em class="parameter"><code>buf</code></em> is a buffer of length
- <em class="parameter"><code>len</code></em> bytes which is used to store the
- <code class="constant">h_name</code>, <code class="constant">h_aliases</code>, and
- <code class="constant">h_addr_list</code> elements of the
- <span class="type">struct hostent</span> returned in <em class="parameter"><code>resbuf</code></em>.
- Successful calls to <code class="function">lwres_gethostbyaddr_r()</code> return
- <em class="parameter"><code>resbuf</code></em>, which is a pointer to the
- <code class="function">struct hostent()</code> it created.
- </p>
-
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- The functions
- <code class="function">lwres_gethostbyname()</code>,
- <code class="function">lwres_gethostbyname2()</code>,
- <code class="function">lwres_gethostbyaddr()</code>,
- and
- <code class="function">lwres_gethostent()</code>
- return NULL to indicate an error. In this case the global variable
- <span class="type">lwres_h_errno</span>
- will contain one of the following error codes defined in
- <code class="filename">&lt;lwres/netdb.h&gt;</code>:
-
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">HOST_NOT_FOUND</code></span></dt>
-<dd>
- <p>
- The host or address was not found.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">TRY_AGAIN</code></span></dt>
-<dd>
- <p>
- A recoverable error occurred, e.g., a timeout.
- Retrying the lookup may succeed.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NO_RECOVERY</code></span></dt>
-<dd>
- <p>
- A non-recoverable error occurred.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NO_DATA</code></span></dt>
-<dd>
- <p>
- The name exists, but has no address information
- associated with it (or vice versa in the case
- of a reverse lookup). The code NO_ADDRESS
- is accepted as a synonym for NO_DATA for backwards
- compatibility.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_hstrerror</span>(3)
- </span>
- translates these error codes to suitable error messages.
- </p>
-
- <p><code class="function">lwres_gethostent()</code>
- and <code class="function">lwres_gethostent_r()</code>
- always return <span class="type">NULL</span>.
- </p>
-
- <p>
- Successful calls to <code class="function">lwres_gethostbyname_r()</code> and
- <code class="function">lwres_gethostbyaddr_r()</code> return
- <em class="parameter"><code>resbuf</code></em>, a pointer to the
- <span class="type">struct hostent</span> that was initialised by these functions. They return
- <span class="type">NULL</span> if the lookups fail or if <em class="parameter"><code>buf</code></em>
- was too small to hold the list of addresses and names referenced by
- the <code class="constant">h_name</code>, <code class="constant">h_aliases</code>, and
- <code class="constant">h_addr_list</code> elements of the
- <span class="type">struct hostent</span>.
- If <em class="parameter"><code>buf</code></em> was too small, both
- <code class="function">lwres_gethostbyname_r()</code> and
- <code class="function">lwres_gethostbyaddr_r()</code> set the global
- variable
- <span class="type">errno</span> to <span class="errorcode">ERANGE</span>.
- </p>
-
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">gethostent</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getipnode</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_hstrerror</span>(3)
- </span>
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.10"></a><h2>BUGS</h2>
-
- <p><code class="function">lwres_gethostbyname()</code>,
- <code class="function">lwres_gethostbyname2()</code>,
- <code class="function">lwres_gethostbyaddr()</code>
- and
- <code class="function">lwres_endhostent()</code>
- are not thread safe; they return pointers to static data and
- provide error codes through a global variable.
- Thread-safe versions for name and address lookup are provided by
- <code class="function">lwres_gethostbyname_r()</code>,
- and
- <code class="function">lwres_gethostbyaddr_r()</code>
- respectively.
- </p>
- <p>
- The resolver daemon does not currently support any non-DNS
- name services such as
- <code class="filename">/etc/hosts</code>
- or
- <span class="type">NIS</span>,
- consequently the above functions don't, either.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3 b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3
deleted file mode 100644
index b2ce9787d5b..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3
+++ /dev/null
@@ -1,228 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_getipnode
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GETIPNODE" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'struct\ hostent\ *\ lwres_getipnodebyname('u
-.BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");"
-.HP \w'struct\ hostent\ *\ lwres_getipnodebyaddr('u
-.BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");"
-.HP \w'void\ lwres_freehostent('u
-.BI "void lwres_freehostent(struct\ hostent\ *" "he" ");"
-.SH "DESCRIPTION"
-.PP
-These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553\&.
-.PP
-They use a
-\fBstruct hostent\fR
-which is defined in
-namedb\&.h:
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-struct hostent {
- char *h_name; /* official name of host */
- char **h_aliases; /* alias list */
- int h_addrtype; /* host address type */
- int h_length; /* length of address */
- char **h_addr_list; /* list of addresses from name server */
-};
-#define h_addr h_addr_list[0] /* address, for backward compatibility */
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The members of this structure are:
-.PP
-\fBh_name\fR
-.RS 4
-The official (canonical) name of the host\&.
-.RE
-.PP
-\fBh_aliases\fR
-.RS 4
-A NULL\-terminated array of alternate names (nicknames) for the host\&.
-.RE
-.PP
-\fBh_addrtype\fR
-.RS 4
-The type of address being returned \- usually
-\fBPF_INET\fR
-or
-\fBPF_INET6\fR\&.
-.RE
-.PP
-\fBh_length\fR
-.RS 4
-The length of the address in bytes\&.
-.RE
-.PP
-\fBh_addr_list\fR
-.RS 4
-A
-\fBNULL\fR
-terminated array of network addresses for the host\&. Host addresses are returned in network byte order\&.
-.RE
-.PP
-\fBlwres_getipnodebyname()\fR
-looks up addresses of protocol family
-\fIaf\fR
-for the hostname
-\fIname\fR\&. The
-\fIflags\fR
-parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned\&. The flag bits are:
-.PP
-\fBAI_V4MAPPED\fR
-.RS 4
-This is used with an
-\fIaf\fR
-of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses\&.
-.RE
-.PP
-\fBAI_ALL\fR
-.RS 4
-This is used with an
-\fIaf\fR
-of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned\&. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses\&.
-.RE
-.PP
-\fBAI_ADDRCONFIG\fR
-.RS 4
-Only return an IPv6 or IPv4 address if here is an active network interface of that type\&. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored\&.
-.RE
-.PP
-\fBAI_DEFAULT\fR
-.RS 4
-This default sets the
-\fBAI_V4MAPPED\fR
-and
-\fBAI_ADDRCONFIG\fR
-flag bits\&.
-.RE
-.PP
-\fBlwres_getipnodebyaddr()\fR
-performs a reverse lookup of address
-\fIsrc\fR
-which is
-\fIlen\fR
-bytes long\&.
-\fIaf\fR
-denotes the protocol family, typically
-\fBPF_INET\fR
-or
-\fBPF_INET6\fR\&.
-.PP
-\fBlwres_freehostent()\fR
-releases all the memory associated with the
-\fBstruct hostent\fR
-pointer
-\fIhe\fR\&. Any memory allocated for the
-\fBh_name\fR,
-\fBh_addr_list\fR
-and
-\fBh_aliases\fR
-is freed, as is the memory for the
-\fBhostent\fR
-structure itself\&.
-.SH "RETURN VALUES"
-.PP
-If an error occurs,
-\fBlwres_getipnodebyname()\fR
-and
-\fBlwres_getipnodebyaddr()\fR
-set
-\fI*error_num\fR
-to an appropriate error code and the function returns a
-\fBNULL\fR
-pointer\&. The error codes and their meanings are defined in
-<lwres/netdb\&.h>:
-.PP
-\fBHOST_NOT_FOUND\fR
-.RS 4
-No such host is known\&.
-.RE
-.PP
-\fBNO_ADDRESS\fR
-.RS 4
-The server recognised the request and the name but no address is available\&. Another type of request to the name server for the domain might return an answer\&.
-.RE
-.PP
-\fBTRY_AGAIN\fR
-.RS 4
-A temporary and possibly transient error occurred, such as a failure of a server to respond\&. The request may succeed if retried\&.
-.RE
-.PP
-\fBNO_RECOVERY\fR
-.RS 4
-An unexpected failure occurred, and retrying the request is pointless\&.
-.RE
-.PP
-\fBlwres_hstrerror\fR(3)
-translates these error codes to suitable error messages\&.
-.SH "SEE ALSO"
-.PP
-\fBRFC2553\fR(),
-\fBlwres\fR(3),
-\fBlwres_gethostent\fR(3),
-\fBlwres_getaddrinfo\fR(3),
-\fBlwres_getnameinfo\fR(3),
-\fBlwres_hstrerror\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html
deleted file mode 100644
index 4411b365217..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html
+++ /dev/null
@@ -1,324 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_getipnode</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_getipnodebyname,
- lwres_getipnodebyaddr,
- lwres_freehostent
- &#8212; lightweight resolver nodename / address translation API
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_getipnodebyname</b>(</code></td>
-<td>const char *<var class="pdparam">name</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">af</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">flags</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int *<var class="pdparam">error_num</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-struct hostent *
-<b class="fsfunc">lwres_getipnodebyaddr</b>(</code></td>
-<td>const void *<var class="pdparam">src</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">len</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">af</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int *<var class="pdparam">error_num</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_freehostent</b>(</code></td>
-<td>struct hostent *<var class="pdparam">he</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p>
- These functions perform thread safe, protocol independent
- nodename-to-address and address-to-nodename
- translation as defined in RFC2553.
- </p>
-
- <p>
- They use a
- <span class="type">struct hostent</span>
- which is defined in
- <code class="filename">namedb.h</code>:
- </p>
- <pre class="programlisting">
-struct hostent {
- char *h_name; /* official name of host */
- char **h_aliases; /* alias list */
- int h_addrtype; /* host address type */
- int h_length; /* length of address */
- char **h_addr_list; /* list of addresses from name server */
-};
-#define h_addr h_addr_list[0] /* address, for backward compatibility */
-</pre>
-<p>
- </p>
-
- <p>
- The members of this structure are:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">h_name</code></span></dt>
-<dd>
- <p>
- The official (canonical) name of the host.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_aliases</code></span></dt>
-<dd>
- <p>
- A NULL-terminated array of alternate names (nicknames) for the
- host.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_addrtype</code></span></dt>
-<dd>
- <p>
- The type of address being returned - usually
- <span class="type">PF_INET</span>
- or
- <span class="type">PF_INET6</span>.
-
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_length</code></span></dt>
-<dd>
- <p>
- The length of the address in bytes.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">h_addr_list</code></span></dt>
-<dd>
- <p>
- A
- <span class="type">NULL</span>
- terminated array of network addresses for the host.
- Host addresses are returned in network byte order.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
-
- <p><code class="function">lwres_getipnodebyname()</code>
- looks up addresses of protocol family <em class="parameter"><code>af</code></em>
- for the hostname <em class="parameter"><code>name</code></em>. The
- <em class="parameter"><code>flags</code></em> parameter contains ORed flag bits
- to specify the types of addresses that are searched for, and the
- types of addresses that are returned. The flag bits are:
-
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">AI_V4MAPPED</code></span></dt>
-<dd>
- <p>
- This is used with an
- <em class="parameter"><code>af</code></em>
- of AF_INET6, and causes IPv4 addresses to be returned as
- IPv4-mapped
- IPv6 addresses.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">AI_ALL</code></span></dt>
-<dd>
- <p>
- This is used with an
- <em class="parameter"><code>af</code></em>
- of AF_INET6, and causes all known addresses (IPv6 and IPv4) to
- be returned.
- If AI_V4MAPPED is also set, the IPv4 addresses are return as
- mapped
- IPv6 addresses.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">AI_ADDRCONFIG</code></span></dt>
-<dd>
- <p>
- Only return an IPv6 or IPv4 address if here is an active network
- interface of that type. This is not currently implemented
- in the BIND 9 lightweight resolver, and the flag is ignored.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">AI_DEFAULT</code></span></dt>
-<dd>
- <p>
- This default sets the
- <code class="constant">AI_V4MAPPED</code>
- and
- <code class="constant">AI_ADDRCONFIG</code>
- flag bits.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
-
- <p><code class="function">lwres_getipnodebyaddr()</code>
- performs a reverse lookup of address <em class="parameter"><code>src</code></em>
- which is <em class="parameter"><code>len</code></em> bytes long.
- <em class="parameter"><code>af</code></em> denotes the protocol family, typically
- <span class="type">PF_INET</span> or <span class="type">PF_INET6</span>.
- </p>
- <p><code class="function">lwres_freehostent()</code>
- releases all the memory associated with the <span class="type">struct
- hostent</span> pointer <em class="parameter"><code>he</code></em>. Any memory
- allocated for the <code class="constant">h_name</code>,
- <code class="constant">h_addr_list</code> and
- <code class="constant">h_aliases</code> is freed, as is the memory for
- the <span class="type">hostent</span> structure itself.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- If an error occurs,
- <code class="function">lwres_getipnodebyname()</code>
- and
- <code class="function">lwres_getipnodebyaddr()</code>
- set
- <em class="parameter"><code>*error_num</code></em>
- to an appropriate error code and the function returns a
- <span class="type">NULL</span>
- pointer.
- The error codes and their meanings are defined in
- <code class="filename">&lt;lwres/netdb.h&gt;</code>:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">HOST_NOT_FOUND</code></span></dt>
-<dd>
- <p>
- No such host is known.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NO_ADDRESS</code></span></dt>
-<dd>
- <p>
- The server recognised the request and the name but no address is
- available. Another type of request to the name server for the
- domain might return an answer.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">TRY_AGAIN</code></span></dt>
-<dd>
- <p>
- A temporary and possibly transient error occurred, such as a
- failure of a server to respond. The request may succeed if
- retried.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NO_RECOVERY</code></span></dt>
-<dd>
- <p>
- An unexpected failure occurred, and retrying the request
- is pointless.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_hstrerror</span>(3)
- </span>
- translates these error codes to suitable error messages.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">RFC2553</span>
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_gethostent</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getaddrinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getnameinfo</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_hstrerror</span>(3)
- </span>.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.3 b/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.3
deleted file mode 100644
index c2ab912a9c5..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.3
+++ /dev/null
@@ -1,135 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_getnameinfo
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GETNAMEINFO" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_getnameinfo \- lightweight resolver socket address structure to hostname and service name
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'int\ lwres_getnameinfo('u
-.BI "int lwres_getnameinfo(const\ struct\ sockaddr\ *" "sa" ", size_t\ " "salen" ", char\ *" "host" ", size_t\ " "hostlen" ", char\ *" "serv" ", size_t\ " "servlen" ", int\ " "flags" ");"
-.SH "DESCRIPTION"
-.PP
-This function is equivalent to the
-\fBgetnameinfo\fR(3)
-function defined in RFC2133\&.
-\fBlwres_getnameinfo()\fR
-returns the hostname for the
-\fBstruct sockaddr\fR\fIsa\fR
-which is
-\fIsalen\fR
-bytes long\&. The hostname is of length
-\fIhostlen\fR
-and is returned via
-\fI*host\&.\fR
-The maximum length of the hostname is 1025 bytes:
-\fBNI_MAXHOST\fR\&.
-.PP
-The name of the service associated with the port number in
-\fIsa\fR
-is returned in
-\fI*serv\&.\fR
-It is
-\fIservlen\fR
-bytes long\&. The maximum length of the service name is
-\fBNI_MAXSERV\fR
-\- 32 bytes\&.
-.PP
-The
-\fIflags\fR
-argument sets the following bits:
-.PP
-\fBNI_NOFQDN\fR
-.RS 4
-A fully qualified domain name is not required for local hosts\&. The local part of the fully qualified domain name is returned instead\&.
-.RE
-.PP
-\fBNI_NUMERICHOST\fR
-.RS 4
-Return the address in numeric form, as if calling inet_ntop(), instead of a host name\&.
-.RE
-.PP
-\fBNI_NAMEREQD\fR
-.RS 4
-A name is required\&. If the hostname cannot be found in the DNS and this flag is set, a non\-zero error code is returned\&. If the hostname is not found and the flag is not set, the address is returned in numeric form\&.
-.RE
-.PP
-\fBNI_NUMERICSERV\fR
-.RS 4
-The service name is returned as a digit string representing the port number\&.
-.RE
-.PP
-\fBNI_DGRAM\fR
-.RS 4
-Specifies that the service being looked up is a datagram service, and causes getservbyport() to be called with a second argument of "udp" instead of its default of "tcp"\&. This is required for the few ports (512\-514) that have different services for UDP and TCP\&.
-.RE
-.SH "RETURN VALUES"
-.PP
-\fBlwres_getnameinfo()\fR
-returns 0 on success or a non\-zero error code if an error occurs\&.
-.SH "SEE ALSO"
-.PP
-\fBRFC2133\fR(),
-\fBgetservbyport\fR(3),
-\fBlwres\fR(3),
-\fBlwres_getnameinfo\fR(3),
-\fBlwres_getnamebyaddr\fR(3)\&.
-\fBlwres_net_ntop\fR(3)\&.
-.SH "BUGS"
-.PP
-RFC2133 fails to define what the nonzero return values of
-\fBgetnameinfo\fR(3)
-are\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html b/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html
deleted file mode 100644
index 5006eaa7f89..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html
+++ /dev/null
@@ -1,207 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_getnameinfo</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_getnameinfo
- &#8212; lightweight resolver socket address structure to hostname and
- service name
-
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-int
-<b class="fsfunc">lwres_getnameinfo</b>(</code></td>
-<td>const struct sockaddr *<var class="pdparam">sa</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">salen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char *<var class="pdparam">host</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">hostlen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char *<var class="pdparam">serv</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">servlen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>int <var class="pdparam">flags</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p>
- This function is equivalent to the
- <span class="citerefentry">
- <span class="refentrytitle">getnameinfo</span>(3)
- </span> function defined in RFC2133.
- <code class="function">lwres_getnameinfo()</code> returns the
- hostname for the
- <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which
- is
- <em class="parameter"><code>salen</code></em> bytes long. The hostname is of
- length
- <em class="parameter"><code>hostlen</code></em> and is returned via
- <em class="parameter"><code>*host.</code></em> The maximum length of the
- hostname is
- 1025 bytes: <code class="constant">NI_MAXHOST</code>.
- </p>
-
- <p> The name of the service associated with the port number in
- <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em>
- It is <em class="parameter"><code>servlen</code></em> bytes long. The
- maximum length
- of the service name is <code class="constant">NI_MAXSERV</code> - 32
- bytes.
- </p>
-
- <p>
- The <em class="parameter"><code>flags</code></em> argument sets the
- following
- bits:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">NI_NOFQDN</code></span></dt>
-<dd>
- <p>
- A fully qualified domain name is not required for local hosts.
- The local part of the fully qualified domain name is returned
- instead.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt>
-<dd>
- <p>
- Return the address in numeric form, as if calling inet_ntop(),
- instead of a host name.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></dt>
-<dd>
- <p>
- A name is required. If the hostname cannot be found in the DNS
- and
- this flag is set, a non-zero error code is returned.
- If the hostname is not found and the flag is not set, the
- address is returned in numeric form.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt>
-<dd>
- <p>
- The service name is returned as a digit string representing the
- port number.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">NI_DGRAM</code></span></dt>
-<dd>
- <p>
- Specifies that the service being looked up is a datagram
- service, and causes getservbyport() to be called with a second
- argument of "udp" instead of its default of "tcp". This is
- required
- for the few ports (512-514) that have different services for UDP
- and
- TCP.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p><code class="function">lwres_getnameinfo()</code>
- returns 0 on success or a non-zero error code if an error occurs.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">RFC2133</span>
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">getservbyport</span>(3)
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">lwres</span>(3)
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getnameinfo</span>(3)
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">lwres_getnamebyaddr</span>(3)
- </span>.
- <span class="citerefentry">
- <span class="refentrytitle">lwres_net_ntop</span>(3)
- </span>.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.10"></a><h2>BUGS</h2>
-
- <p>
- RFC2133 fails to define what the nonzero return values of
- <span class="citerefentry">
- <span class="refentrytitle">getnameinfo</span>(3)
- </span>
- are.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.3 b/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.3
deleted file mode 100644
index 47037c94b8d..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.3
+++ /dev/null
@@ -1,178 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_getrrsetbyname
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GETRRSETBYNAME" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_getrrsetbyname, lwres_freerrset \- retrieve DNS records
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'int\ lwres_getrrsetbyname('u
-.BI "int lwres_getrrsetbyname(const\ char\ *" "hostname" ", unsigned\ int\ " "rdclass" ", unsigned\ int\ " "rdtype" ", unsigned\ int\ " "flags" ", struct\ rrsetinfo\ **" "res" ");"
-.HP \w'void\ lwres_freerrset('u
-.BI "void lwres_freerrset(struct\ rrsetinfo\ *" "rrset" ");"
-.PP
-The following structures are used:
-.PP
-.nf
-struct rdatainfo {
- unsigned int rdi_length; /* length of data */
- unsigned char *rdi_data; /* record data */
-};
-.fi
-.PP
-.nf
-struct rrsetinfo {
- unsigned int rri_flags; /* RRSET_VALIDATED\&.\&.\&. */
- unsigned int rri_rdclass; /* class number */
- unsigned int rri_rdtype; /* RR type number */
- unsigned int rri_ttl; /* time to live */
- unsigned int rri_nrdatas; /* size of rdatas array */
- unsigned int rri_nsigs; /* size of sigs array */
- char *rri_name; /* canonical name */
- struct rdatainfo *rri_rdatas; /* individual records */
- struct rdatainfo *rri_sigs; /* individual signatures */
-};
-.fi
-.sp
-.SH "DESCRIPTION"
-.PP
-\fBlwres_getrrsetbyname()\fR
-gets a set of resource records associated with a
-\fIhostname\fR,
-\fIclass\fR, and
-\fItype\fR\&.
-\fIhostname\fR
-is a pointer a to null\-terminated string\&. The
-\fIflags\fR
-field is currently unused and must be zero\&.
-.PP
-After a successful call to
-\fBlwres_getrrsetbyname()\fR,
-\fI*res\fR
-is a pointer to an
-\fBrrsetinfo\fR
-structure, containing a list of one or more
-\fBrdatainfo\fR
-structures containing resource records and potentially another list of
-\fBrdatainfo\fR
-structures containing SIG resource records associated with those records\&. The members
-\fBrri_rdclass\fR
-and
-\fBrri_rdtype\fR
-are copied from the parameters\&.
-\fBrri_ttl\fR
-and
-\fBrri_name\fR
-are properties of the obtained rrset\&. The resource records contained in
-\fBrri_rdatas\fR
-and
-\fBrri_sigs\fR
-are in uncompressed DNS wire format\&. Properties of the rdataset are represented in the
-\fBrri_flags\fR
-bitfield\&. If the RRSET_VALIDATED bit is set, the data has been DNSSEC validated and the signatures verified\&.
-.PP
-All of the information returned by
-\fBlwres_getrrsetbyname()\fR
-is dynamically allocated: the
-\fBrrsetinfo\fR
-and
-\fBrdatainfo\fR
-structures, and the canonical host name strings pointed to by the
-\fBrrsetinfo\fRstructure\&. Memory allocated for the dynamically allocated structures created by a successful call to
-\fBlwres_getrrsetbyname()\fR
-is released by
-\fBlwres_freerrset()\fR\&.
-\fIrrset\fR
-is a pointer to a
-\fBstruct rrset\fR
-created by a call to
-\fBlwres_getrrsetbyname()\fR\&.
-.PP
-.SH "RETURN VALUES"
-.PP
-\fBlwres_getrrsetbyname()\fR
-returns zero on success, and one of the following error codes if an error occurred:
-.PP
-\fBERRSET_NONAME\fR
-.RS 4
-the name does not exist
-.RE
-.PP
-\fBERRSET_NODATA\fR
-.RS 4
-the name exists, but does not have data of the desired type
-.RE
-.PP
-\fBERRSET_NOMEMORY\fR
-.RS 4
-memory could not be allocated
-.RE
-.PP
-\fBERRSET_INVAL\fR
-.RS 4
-a parameter is invalid
-.RE
-.PP
-\fBERRSET_FAIL\fR
-.RS 4
-other failure
-.RE
-.PP
-.RS 4
-.RE
-.SH "SEE ALSO"
-.PP
-\fBlwres\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html b/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html
deleted file mode 100644
index 2c82f23bc12..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html
+++ /dev/null
@@ -1,212 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_getrrsetbyname</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_getrrsetbyname,
- lwres_freerrset
- &#8212; retrieve DNS records
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-int
-<b class="fsfunc">lwres_getrrsetbyname</b>(</code></td>
-<td>const char *<var class="pdparam">hostname</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">rdclass</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">rdtype</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>unsigned int <var class="pdparam">flags</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>struct rrsetinfo **<var class="pdparam">res</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_freerrset</b>(</code></td>
-<td>struct rrsetinfo *<var class="pdparam">rrset</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
-
- <p>
- The following structures are used:
- </p>
- <pre class="programlisting">
-struct rdatainfo {
- unsigned int rdi_length; /* length of data */
- unsigned char *rdi_data; /* record data */
-};
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-struct rrsetinfo {
- unsigned int rri_flags; /* RRSET_VALIDATED... */
- unsigned int rri_rdclass; /* class number */
- unsigned int rri_rdtype; /* RR type number */
- unsigned int rri_ttl; /* time to live */
- unsigned int rri_nrdatas; /* size of rdatas array */
- unsigned int rri_nsigs; /* size of sigs array */
- char *rri_name; /* canonical name */
- struct rdatainfo *rri_rdatas; /* individual records */
- struct rdatainfo *rri_sigs; /* individual signatures */
-};
-</pre>
-<p>
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p><code class="function">lwres_getrrsetbyname()</code>
- gets a set of resource records associated with a
- <em class="parameter"><code>hostname</code></em>, <em class="parameter"><code>class</code></em>,
- and <em class="parameter"><code>type</code></em>.
- <em class="parameter"><code>hostname</code></em> is a pointer a to
- null-terminated string. The <em class="parameter"><code>flags</code></em> field
- is currently unused and must be zero.
- </p>
- <p>
- After a successful call to
- <code class="function">lwres_getrrsetbyname()</code>,
- <em class="parameter"><code>*res</code></em> is a pointer to an
- <span class="type">rrsetinfo</span> structure, containing a list of one or
- more <span class="type">rdatainfo</span> structures containing resource
- records and potentially another list of <span class="type">rdatainfo</span>
- structures containing SIG resource records associated with those
- records. The members <code class="constant">rri_rdclass</code> and
- <code class="constant">rri_rdtype</code> are copied from the parameters.
- <code class="constant">rri_ttl</code> and <code class="constant">rri_name</code>
- are properties of the obtained rrset. The resource records
- contained in <code class="constant">rri_rdatas</code> and
- <code class="constant">rri_sigs</code> are in uncompressed DNS wire
- format. Properties of the rdataset are represented in the
- <code class="constant">rri_flags</code> bitfield. If the RRSET_VALIDATED
- bit is set, the data has been DNSSEC validated and the
- signatures verified.
- </p>
- <p>
- All of the information returned by
- <code class="function">lwres_getrrsetbyname()</code> is dynamically
- allocated: the <code class="constant">rrsetinfo</code> and
- <code class="constant">rdatainfo</code> structures, and the canonical
- host name strings pointed to by the
- <code class="constant">rrsetinfo</code>structure.
-
- Memory allocated for the dynamically allocated structures
- created by a successful call to
- <code class="function">lwres_getrrsetbyname()</code> is released by
- <code class="function">lwres_freerrset()</code>.
-
- <em class="parameter"><code>rrset</code></em> is a pointer to a <span class="type">struct
- rrset</span> created by a call to
- <code class="function">lwres_getrrsetbyname()</code>.
- </p>
- <p></p>
- </div>
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p><code class="function">lwres_getrrsetbyname()</code>
- returns zero on success, and one of the following error codes if
- an error occurred:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">ERRSET_NONAME</code></span></dt>
-<dd>
- <p>
- the name does not exist
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ERRSET_NODATA</code></span></dt>
-<dd>
- <p>
- the name exists, but does not have data of the desired type
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ERRSET_NOMEMORY</code></span></dt>
-<dd>
- <p>
- memory could not be allocated
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ERRSET_INVAL</code></span></dt>
-<dd>
- <p>
- a parameter is invalid
- </p>
- </dd>
-<dt><span class="term"><code class="constant">ERRSET_FAIL</code></span></dt>
-<dd>
- <p>
- other failure
- </p>
- </dd>
-<dt><span class="term"><code class="constant"></code></span></dt>
-<dd>
- <p></p>
- </dd>
-</dl></div>
-<p>
-
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres</span>(3)
- </span>.
- </p>
-
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gnba.3 b/usr.sbin/bind/lib/lwres/man/lwres_gnba.3
deleted file mode 100644
index 61371705ac4..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gnba.3
+++ /dev/null
@@ -1,210 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_gnba
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_GNBA" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free \- lightweight resolver getnamebyaddress message handling
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.HP \w'lwres_result_t\ lwres_gnbarequest_render('u
-.BI "lwres_result_t lwres_gnbarequest_render(lwres_context_t\ *" "ctx" ", lwres_gnbarequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
-.HP \w'lwres_result_t\ lwres_gnbaresponse_render('u
-.BI "lwres_result_t lwres_gnbaresponse_render(lwres_context_t\ *" "ctx" ", lwres_gnbaresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
-.HP \w'lwres_result_t\ lwres_gnbarequest_parse('u
-.BI "lwres_result_t lwres_gnbarequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gnbarequest_t\ **" "structp" ");"
-.HP \w'lwres_result_t\ lwres_gnbaresponse_parse('u
-.BI "lwres_result_t lwres_gnbaresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gnbaresponse_t\ **" "structp" ");"
-.HP \w'void\ lwres_gnbaresponse_free('u
-.BI "void lwres_gnbaresponse_free(lwres_context_t\ *" "ctx" ", lwres_gnbaresponse_t\ **" "structp" ");"
-.HP \w'void\ lwres_gnbarequest_free('u
-.BI "void lwres_gnbarequest_free(lwres_context_t\ *" "ctx" ", lwres_gnbarequest_t\ **" "structp" ");"
-.SH "DESCRIPTION"
-.PP
-These are low\-level routines for creating and parsing lightweight resolver address\-to\-name lookup request and response messages\&.
-.PP
-There are four main functions for the getnamebyaddr opcode\&. One render function converts a getnamebyaddr request structure \(em
-\fBlwres_gnbarequest_t\fR
-\(em to the lightweight resolver\*(Aqs canonical format\&. It is complemented by a parse function that converts a packet in this canonical format to a getnamebyaddr request structure\&. Another render function converts the getnamebyaddr response structure \(em
-\fBlwres_gnbaresponse_t\fR
-to the canonical format\&. This is complemented by a parse function which converts a packet in canonical format to a getnamebyaddr response structure\&.
-.PP
-These structures are defined in
-lwres/lwres\&.h\&. They are shown below\&.
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint32_t flags;
- lwres_addr_t addr;
-} lwres_gnbarequest_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- void *base;
- size_t baselen;
-} lwres_gnbaresponse_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fBlwres_gnbarequest_render()\fR
-uses resolver context
-\fIctx\fR
-to convert getnamebyaddr request structure
-\fIreq\fR
-to canonical format\&. The packet header structure
-\fIpkt\fR
-is initialised and transferred to buffer
-\fIb\fR\&. The contents of
-\fI*req\fR
-are then appended to the buffer in canonical format\&.
-\fBlwres_gnbaresponse_render()\fR
-performs the same task, except it converts a getnamebyaddr response structure
-\fBlwres_gnbaresponse_t\fR
-to the lightweight resolver\*(Aqs canonical format\&.
-.PP
-\fBlwres_gnbarequest_parse()\fR
-uses context
-\fIctx\fR
-to convert the contents of packet
-\fIpkt\fR
-to a
-\fBlwres_gnbarequest_t\fR
-structure\&. Buffer
-\fIb\fR
-provides space to be used for storing this structure\&. When the function succeeds, the resulting
-\fBlwres_gnbarequest_t\fR
-is made available through
-\fI*structp\fR\&.
-\fBlwres_gnbaresponse_parse()\fR
-offers the same semantics as
-\fBlwres_gnbarequest_parse()\fR
-except it yields a
-\fBlwres_gnbaresponse_t\fR
-structure\&.
-.PP
-\fBlwres_gnbaresponse_free()\fR
-and
-\fBlwres_gnbarequest_free()\fR
-release the memory in resolver context
-\fIctx\fR
-that was allocated to the
-\fBlwres_gnbaresponse_t\fR
-or
-\fBlwres_gnbarequest_t\fR
-structures referenced via
-\fIstructp\fR\&. Any memory associated with ancillary buffers and strings for those structures is also discarded\&.
-.SH "RETURN VALUES"
-.PP
-The getnamebyaddr opcode functions
-\fBlwres_gnbarequest_render()\fR,
-\fBlwres_gnbaresponse_render()\fR\fBlwres_gnbarequest_parse()\fR
-and
-\fBlwres_gnbaresponse_parse()\fR
-all return
-\fBLWRES_R_SUCCESS\fR
-on success\&. They return
-\fBLWRES_R_NOMEMORY\fR
-if memory allocation fails\&.
-\fBLWRES_R_UNEXPECTEDEND\fR
-is returned if the available space in the buffer
-\fIb\fR
-is too small to accommodate the packet header or the
-\fBlwres_gnbarequest_t\fR
-and
-\fBlwres_gnbaresponse_t\fR
-structures\&.
-\fBlwres_gnbarequest_parse()\fR
-and
-\fBlwres_gnbaresponse_parse()\fR
-will return
-\fBLWRES_R_UNEXPECTEDEND\fR
-if the buffer is not empty after decoding the received packet\&. These functions will return
-\fBLWRES_R_FAILURE\fR
-if
-\fIpktflags\fR
-in the packet header structure
-\fBlwres_lwpacket_t\fR
-indicate that the packet is not a response to an earlier query\&.
-.SH "SEE ALSO"
-.PP
-\fBlwres_packet\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gnba.html b/usr.sbin/bind/lib/lwres/man/lwres_gnba.html
deleted file mode 100644
index 339c5b323a6..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_gnba.html
+++ /dev/null
@@ -1,312 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_gnba</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_gnbarequest_render,
- lwres_gnbaresponse_render,
- lwres_gnbarequest_parse,
- lwres_gnbaresponse_parse,
- lwres_gnbaresponse_free,
- lwres_gnbarequest_free
- &#8212; lightweight resolver getnamebyaddress message handling
- </p>
-</div>
-
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
-
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">
-#include &lt;lwres/lwres.h&gt;
-</pre>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gnbarequest_render</b>
-(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbarequest_t *<var class="pdparam">req</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gnbaresponse_render</b>
-(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbaresponse_t *<var class="pdparam">req</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gnbarequest_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbarequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_gnbaresponse_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_gnbaresponse_free</b>
-(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_gnbarequest_free</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbarequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
-
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p>
- These are low-level routines for creating and parsing
- lightweight resolver address-to-name lookup request and
- response messages.
- </p>
- <p>
- There are four main functions for the getnamebyaddr opcode.
- One render function converts a getnamebyaddr request structure &#8212;
- <span class="type">lwres_gnbarequest_t</span> &#8212;
- to the lightweight resolver's canonical format.
- It is complemented by a parse function that converts a packet in this
- canonical format to a getnamebyaddr request structure.
- Another render function converts the getnamebyaddr response structure
- &#8212;
- <span class="type">lwres_gnbaresponse_t</span>
- to the canonical format.
- This is complemented by a parse function which converts a packet in
- canonical format to a getnamebyaddr response structure.
- </p>
- <p>
- These structures are defined in
- <code class="filename">lwres/lwres.h</code>.
- They are shown below.
- </p>
- <pre class="programlisting">
-#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct {
- lwres_uint32_t flags;
- lwres_addr_t addr;
-} lwres_gnbarequest_t;
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- void *base;
- size_t baselen;
-} lwres_gnbaresponse_t;
-</pre>
-<p>
- </p>
-
- <p><code class="function">lwres_gnbarequest_render()</code>
- uses resolver context <code class="varname">ctx</code> to convert
- getnamebyaddr request structure <code class="varname">req</code> to
- canonical format. The packet header structure
- <code class="varname">pkt</code> is initialised and transferred to buffer
- <code class="varname">b</code>. The contents of <code class="varname">*req</code>
- are then appended to the buffer in canonical format.
- <code class="function">lwres_gnbaresponse_render()</code> performs the
- same task, except it converts a getnamebyaddr response structure
- <span class="type">lwres_gnbaresponse_t</span> to the lightweight resolver's
- canonical format.
- </p>
-
- <p><code class="function">lwres_gnbarequest_parse()</code>
- uses context <code class="varname">ctx</code> to convert the contents of
- packet <code class="varname">pkt</code> to a
- <span class="type">lwres_gnbarequest_t</span> structure. Buffer
- <code class="varname">b</code> provides space to be used for storing this
- structure. When the function succeeds, the resulting
- <span class="type">lwres_gnbarequest_t</span> is made available through
- <code class="varname">*structp</code>.
- <code class="function">lwres_gnbaresponse_parse()</code> offers the same
- semantics as <code class="function">lwres_gnbarequest_parse()</code>
- except it yields a <span class="type">lwres_gnbaresponse_t</span> structure.
- </p>
-
- <p><code class="function">lwres_gnbaresponse_free()</code>
- and <code class="function">lwres_gnbarequest_free()</code> release the
- memory in resolver context <code class="varname">ctx</code> that was
- allocated to the <span class="type">lwres_gnbaresponse_t</span> or
- <span class="type">lwres_gnbarequest_t</span> structures referenced via
- <code class="varname">structp</code>. Any memory associated with
- ancillary buffers and strings for those structures is also
- discarded.
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- The getnamebyaddr opcode functions
- <code class="function">lwres_gnbarequest_render()</code>,
- <code class="function">lwres_gnbaresponse_render()</code>
- <code class="function">lwres_gnbarequest_parse()</code>
- and
- <code class="function">lwres_gnbaresponse_parse()</code>
- all return
- <span class="errorcode">LWRES_R_SUCCESS</span>
- on success.
- They return
- <span class="errorcode">LWRES_R_NOMEMORY</span>
- if memory allocation fails.
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- is returned if the available space in the buffer
- <code class="varname">b</code>
- is too small to accommodate the packet header or the
- <span class="type">lwres_gnbarequest_t</span>
- and
- <span class="type">lwres_gnbaresponse_t</span>
- structures.
- <code class="function">lwres_gnbarequest_parse()</code>
- and
- <code class="function">lwres_gnbaresponse_parse()</code>
- will return
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- if the buffer is not empty after decoding the received packet.
- These functions will return
- <span class="errorcode">LWRES_R_FAILURE</span>
- if
- <code class="varname">pktflags</code>
- in the packet header structure
- <span class="type">lwres_lwpacket_t</span>
- indicate that the packet is not a response to an earlier query.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_packet</span>(3)
- </span>.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.3 b/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.3
deleted file mode 100644
index ddf2a829f3d..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.3
+++ /dev/null
@@ -1,118 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_hstrerror
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_HSTRERROR" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_herror, lwres_hstrerror \- lightweight resolver error message generation
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/netdb\&.h>
-.fi
-.ft
-.HP \w'void\ lwres_herror('u
-.BI "void lwres_herror(const\ char\ *" "s" ");"
-.HP \w'const\ char\ *\ lwres_hstrerror('u
-.BI "const char * lwres_hstrerror(int\ " "err" ");"
-.SH "DESCRIPTION"
-.PP
-\fBlwres_herror()\fR
-prints the string
-\fIs\fR
-on
-\fBstderr\fR
-followed by the string generated by
-\fBlwres_hstrerror()\fR
-for the error code stored in the global variable
-\fBlwres_h_errno\fR\&.
-.PP
-\fBlwres_hstrerror()\fR
-returns an appropriate string for the error code gievn by
-\fIerr\fR\&. The values of the error codes and messages are as follows:
-.PP
-\fBNETDB_SUCCESS\fR
-.RS 4
-Resolver Error 0 (no error)
-.RE
-.PP
-\fBHOST_NOT_FOUND\fR
-.RS 4
-Unknown host
-.RE
-.PP
-\fBTRY_AGAIN\fR
-.RS 4
-Host name lookup failure
-.RE
-.PP
-\fBNO_RECOVERY\fR
-.RS 4
-Unknown server error
-.RE
-.PP
-\fBNO_DATA\fR
-.RS 4
-No address associated with name
-.RE
-.SH "RETURN VALUES"
-.PP
-The string
-Unknown resolver error
-is returned by
-\fBlwres_hstrerror()\fR
-when the value of
-\fBlwres_h_errno\fR
-is not a valid error code\&.
-.SH "SEE ALSO"
-.PP
-\fBherror\fR(3),
-\fBlwres_hstrerror\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html b/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html
deleted file mode 100644
index 0d729ff217d..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_hstrerror</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_herror,
- lwres_hstrerror
- &#8212; lightweight resolver error message generation
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_herror</b>(</code></td>
-<td>const char *<var class="pdparam">s</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
-<td><code class="funcdef">
-const char *
-<b class="fsfunc">lwres_hstrerror</b>(</code></td>
-<td>int <var class="pdparam">err</var><code>)</code>;</td>
-</tr></table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_herror()</code>
- prints the string <em class="parameter"><code>s</code></em> on
- <span class="type">stderr</span> followed by the string generated by
- <code class="function">lwres_hstrerror()</code> for the error code stored
- in the global variable <code class="constant">lwres_h_errno</code>.
- </p>
-
- <p><code class="function">lwres_hstrerror()</code>
- returns an appropriate string for the error code gievn by
- <em class="parameter"><code>err</code></em>. The values of the error codes and
- messages are as follows:
-
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><span class="errorcode">NETDB_SUCCESS</span></span></dt>
-<dd>
- <p><span class="errorname">Resolver Error 0 (no error)</span>
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">HOST_NOT_FOUND</span></span></dt>
-<dd>
- <p><span class="errorname">Unknown host</span>
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">TRY_AGAIN</span></span></dt>
-<dd>
- <p><span class="errorname">Host name lookup failure</span>
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">NO_RECOVERY</span></span></dt>
-<dd>
- <p><span class="errorname">Unknown server error</span>
- </p>
- </dd>
-<dt><span class="term"><span class="errorcode">NO_DATA</span></span></dt>
-<dd>
- <p><span class="errorname">No address associated with name</span>
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- The string <span class="errorname">Unknown resolver error</span> is returned by
- <code class="function">lwres_hstrerror()</code>
- when the value of
- <code class="constant">lwres_h_errno</code>
- is not a valid error code.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">herror</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_hstrerror</span>(3)
- </span>.
- </p>
-
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_inetntop.3 b/usr.sbin/bind/lib/lwres/man/lwres_inetntop.3
deleted file mode 100644
index 11632efa355..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_inetntop.3
+++ /dev/null
@@ -1,96 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_inetntop
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_INETNTOP" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_net_ntop \- lightweight resolver IP address presentation
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/net\&.h>
-.fi
-.ft
-.HP \w'const\ char\ *\ lwres_net_ntop('u
-.BI "const char * lwres_net_ntop(int\ " "af" ", const\ void\ *" "src" ", char\ *" "dst" ", size_t\ " "size" ");"
-.SH "DESCRIPTION"
-.PP
-\fBlwres_net_ntop()\fR
-converts an IP address of protocol family
-\fIaf\fR
-\(em IPv4 or IPv6 \(em at location
-\fIsrc\fR
-from network format to its conventional representation as a string\&. For IPv4 addresses, that string would be a dotted\-decimal\&. An IPv6 address would be represented in colon notation as described in RFC1884\&.
-.PP
-The generated string is copied to
-\fIdst\fR
-provided
-\fIsize\fR
-indicates it is long enough to store the ASCII representation of the address\&.
-.SH "RETURN VALUES"
-.PP
-If successful, the function returns
-\fIdst\fR: a pointer to a string containing the presentation format of the address\&.
-\fBlwres_net_ntop()\fR
-returns
-\fBNULL\fR
-and sets the global variable
-\fBerrno\fR
-to
-\fBEAFNOSUPPORT\fR
-if the protocol family given in
-\fIaf\fR
-is not supported\&.
-.SH "SEE ALSO"
-.PP
-\fBRFC1884\fR(),
-\fBinet_ntop\fR(3),
-\fBerrno\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html b/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html
deleted file mode 100644
index 7f8b6f3f9c6..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_inetntop</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_net_ntop
- &#8212; lightweight resolver IP address presentation
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/net.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-const char *
-<b class="fsfunc">lwres_net_ntop</b>(</code></td>
-<td>int <var class="pdparam">af</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const void *<var class="pdparam">src</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char *<var class="pdparam">dst</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>size_t <var class="pdparam">size</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_net_ntop()</code>
- converts an IP address of protocol family
- <em class="parameter"><code>af</code></em> &#8212; IPv4 or IPv6 &#8212; at
- location <em class="parameter"><code>src</code></em> from network format to its
- conventional representation as a string. For IPv4 addresses,
- that string would be a dotted-decimal. An IPv6 address would be
- represented in colon notation as described in RFC1884.
- </p>
-
- <p>
- The generated string is copied to <em class="parameter"><code>dst</code></em>
- provided
- <em class="parameter"><code>size</code></em> indicates it is long enough to
- store the
- ASCII representation of the address.
- </p>
-
- </div>
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
-
- <p>
- If successful, the function returns <em class="parameter"><code>dst</code></em>:
- a pointer to a string containing the presentation format of the
- address. <code class="function">lwres_net_ntop()</code> returns
- <span class="type">NULL</span> and sets the global variable
- <code class="constant">errno</code> to <span class="errorcode">EAFNOSUPPORT</span> if
- the protocol family given in <em class="parameter"><code>af</code></em> is
- not
- supported.
- </p>
-
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">RFC1884</span>
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">inet_ntop</span>(3)
- </span>,
- <span class="citerefentry">
- <span class="refentrytitle">errno</span>(3)
- </span>.
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_noop.3 b/usr.sbin/bind/lib/lwres/man/lwres_noop.3
deleted file mode 100644
index cecfddde2a5..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_noop.3
+++ /dev/null
@@ -1,210 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_noop
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_NOOP" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free \- lightweight resolver no\-op message handling
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.HP \w'lwres_result_t\ lwres_nooprequest_render('u
-.BI "lwres_result_t lwres_nooprequest_render(lwres_context_t\ *" "ctx" ", lwres_nooprequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
-.HP \w'lwres_result_t\ lwres_noopresponse_render('u
-.BI "lwres_result_t lwres_noopresponse_render(lwres_context_t\ *" "ctx" ", lwres_noopresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
-.HP \w'lwres_result_t\ lwres_nooprequest_parse('u
-.BI "lwres_result_t lwres_nooprequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_nooprequest_t\ **" "structp" ");"
-.HP \w'lwres_result_t\ lwres_noopresponse_parse('u
-.BI "lwres_result_t lwres_noopresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_noopresponse_t\ **" "structp" ");"
-.HP \w'void\ lwres_noopresponse_free('u
-.BI "void lwres_noopresponse_free(lwres_context_t\ *" "ctx" ", lwres_noopresponse_t\ **" "structp" ");"
-.HP \w'void\ lwres_nooprequest_free('u
-.BI "void lwres_nooprequest_free(lwres_context_t\ *" "ctx" ", lwres_nooprequest_t\ **" "structp" ");"
-.SH "DESCRIPTION"
-.PP
-These are low\-level routines for creating and parsing lightweight resolver no\-op request and response messages\&.
-.PP
-The no\-op message is analogous to a
-\fBping\fR
-packet: a packet is sent to the resolver daemon and is simply echoed back\&. The opcode is intended to allow a client to determine if the server is operational or not\&.
-.PP
-There are four main functions for the no\-op opcode\&. One render function converts a no\-op request structure \(em
-\fBlwres_nooprequest_t\fR
-\(em to the lightweight resolver\*(Aqs canonical format\&. It is complemented by a parse function that converts a packet in this canonical format to a no\-op request structure\&. Another render function converts the no\-op response structure \(em
-\fBlwres_noopresponse_t\fR
-to the canonical format\&. This is complemented by a parse function which converts a packet in canonical format to a no\-op response structure\&.
-.PP
-These structures are defined in
-lwres/lwres\&.h\&. They are shown below\&.
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-#define LWRES_OPCODE_NOOP 0x00000000U
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint16_t datalength;
- unsigned char *data;
-} lwres_nooprequest_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint16_t datalength;
- unsigned char *data;
-} lwres_noopresponse_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-Although the structures have different types, they are identical\&. This is because the no\-op opcode simply echos whatever data was sent: the response is therefore identical to the request\&.
-.PP
-\fBlwres_nooprequest_render()\fR
-uses resolver context
-\fIctx\fR
-to convert no\-op request structure
-\fIreq\fR
-to canonical format\&. The packet header structure
-\fIpkt\fR
-is initialised and transferred to buffer
-\fIb\fR\&. The contents of
-\fI*req\fR
-are then appended to the buffer in canonical format\&.
-\fBlwres_noopresponse_render()\fR
-performs the same task, except it converts a no\-op response structure
-\fBlwres_noopresponse_t\fR
-to the lightweight resolver\*(Aqs canonical format\&.
-.PP
-\fBlwres_nooprequest_parse()\fR
-uses context
-\fIctx\fR
-to convert the contents of packet
-\fIpkt\fR
-to a
-\fBlwres_nooprequest_t\fR
-structure\&. Buffer
-\fIb\fR
-provides space to be used for storing this structure\&. When the function succeeds, the resulting
-\fBlwres_nooprequest_t\fR
-is made available through
-\fI*structp\fR\&.
-\fBlwres_noopresponse_parse()\fR
-offers the same semantics as
-\fBlwres_nooprequest_parse()\fR
-except it yields a
-\fBlwres_noopresponse_t\fR
-structure\&.
-.PP
-\fBlwres_noopresponse_free()\fR
-and
-\fBlwres_nooprequest_free()\fR
-release the memory in resolver context
-\fIctx\fR
-that was allocated to the
-\fBlwres_noopresponse_t\fR
-or
-\fBlwres_nooprequest_t\fR
-structures referenced via
-\fIstructp\fR\&.
-.SH "RETURN VALUES"
-.PP
-The no\-op opcode functions
-\fBlwres_nooprequest_render()\fR,
-\fBlwres_noopresponse_render()\fR\fBlwres_nooprequest_parse()\fR
-and
-\fBlwres_noopresponse_parse()\fR
-all return
-\fBLWRES_R_SUCCESS\fR
-on success\&. They return
-\fBLWRES_R_NOMEMORY\fR
-if memory allocation fails\&.
-\fBLWRES_R_UNEXPECTEDEND\fR
-is returned if the available space in the buffer
-\fIb\fR
-is too small to accommodate the packet header or the
-\fBlwres_nooprequest_t\fR
-and
-\fBlwres_noopresponse_t\fR
-structures\&.
-\fBlwres_nooprequest_parse()\fR
-and
-\fBlwres_noopresponse_parse()\fR
-will return
-\fBLWRES_R_UNEXPECTEDEND\fR
-if the buffer is not empty after decoding the received packet\&. These functions will return
-\fBLWRES_R_FAILURE\fR
-if
-\fBpktflags\fR
-in the packet header structure
-\fBlwres_lwpacket_t\fR
-indicate that the packet is not a response to an earlier query\&.
-.SH "SEE ALSO"
-.PP
-\fBlwres_packet\fR(3)
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_noop.html b/usr.sbin/bind/lib/lwres/man/lwres_noop.html
deleted file mode 100644
index ee779fc2a9b..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_noop.html
+++ /dev/null
@@ -1,306 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_noop</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_nooprequest_render,
- lwres_noopresponse_render,
- lwres_nooprequest_parse,
- lwres_noopresponse_parse,
- lwres_noopresponse_free,
- lwres_nooprequest_free
- &#8212; lightweight resolver no-op message handling
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">
-#include &lt;lwres/lwres.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_nooprequest_render</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_nooprequest_t *<var class="pdparam">req</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_noopresponse_render</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_noopresponse_t *<var class="pdparam">req</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_nooprequest_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_nooprequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_noopresponse_parse</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_noopresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_noopresponse_free</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_noopresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-void
-<b class="fsfunc">lwres_nooprequest_free</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_nooprequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p>
- These are low-level routines for creating and parsing
- lightweight resolver no-op request and response messages.
- </p>
- <p>
- The no-op message is analogous to a <span class="command"><strong>ping</strong></span>
- packet:
- a packet is sent to the resolver daemon and is simply echoed back.
- The opcode is intended to allow a client to determine if the server is
- operational or not.
- </p>
- <p>
- There are four main functions for the no-op opcode.
- One render function converts a no-op request structure &#8212;
- <span class="type">lwres_nooprequest_t</span> &#8212;
- to the lightweight resolver's canonical format.
- It is complemented by a parse function that converts a packet in this
- canonical format to a no-op request structure.
- Another render function converts the no-op response structure &#8212;
- <span class="type">lwres_noopresponse_t</span>
- to the canonical format.
- This is complemented by a parse function which converts a packet in
- canonical format to a no-op response structure.
- </p>
- <p>
- These structures are defined in
- <code class="filename">lwres/lwres.h</code>.
-
- They are shown below.
- </p>
- <pre class="programlisting">
-#define LWRES_OPCODE_NOOP 0x00000000U
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct {
- lwres_uint16_t datalength;
- unsigned char *data;
-} lwres_nooprequest_t;
-</pre>
-<p>
- </p>
- <pre class="programlisting">
-typedef struct {
- lwres_uint16_t datalength;
- unsigned char *data;
-} lwres_noopresponse_t;
-</pre>
-<p>
- </p>
- <p>
- Although the structures have different types, they are identical.
- This is because the no-op opcode simply echos whatever data was sent:
- the response is therefore identical to the request.
- </p>
-
- <p><code class="function">lwres_nooprequest_render()</code>
- uses resolver context <em class="parameter"><code>ctx</code></em> to convert
- no-op request structure <em class="parameter"><code>req</code></em> to canonical
- format. The packet header structure <em class="parameter"><code>pkt</code></em>
- is initialised and transferred to buffer
- <em class="parameter"><code>b</code></em>. The contents of
- <em class="parameter"><code>*req</code></em> are then appended to the buffer in
- canonical format.
- <code class="function">lwres_noopresponse_render()</code> performs the
- same task, except it converts a no-op response structure
- <span class="type">lwres_noopresponse_t</span> to the lightweight resolver's
- canonical format.
- </p>
-
- <p><code class="function">lwres_nooprequest_parse()</code>
- uses context <em class="parameter"><code>ctx</code></em> to convert the contents
- of packet <em class="parameter"><code>pkt</code></em> to a
- <span class="type">lwres_nooprequest_t</span> structure. Buffer
- <em class="parameter"><code>b</code></em> provides space to be used for storing
- this structure. When the function succeeds, the resulting
- <span class="type">lwres_nooprequest_t</span> is made available through
- <em class="parameter"><code>*structp</code></em>.
- <code class="function">lwres_noopresponse_parse()</code> offers the same
- semantics as <code class="function">lwres_nooprequest_parse()</code>
- except it yields a <span class="type">lwres_noopresponse_t</span> structure.
- </p>
-
- <p><code class="function">lwres_noopresponse_free()</code>
- and <code class="function">lwres_nooprequest_free()</code> release the
- memory in resolver context <em class="parameter"><code>ctx</code></em> that was
- allocated to the <span class="type">lwres_noopresponse_t</span> or
- <span class="type">lwres_nooprequest_t</span> structures referenced via
- <em class="parameter"><code>structp</code></em>.
- </p>
-
- </div>
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- The no-op opcode functions
- <code class="function">lwres_nooprequest_render()</code>,
-
- <code class="function">lwres_noopresponse_render()</code>
- <code class="function">lwres_nooprequest_parse()</code>
- and
- <code class="function">lwres_noopresponse_parse()</code>
- all return
- <span class="errorcode">LWRES_R_SUCCESS</span>
- on success.
- They return
- <span class="errorcode">LWRES_R_NOMEMORY</span>
- if memory allocation fails.
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- is returned if the available space in the buffer
- <em class="parameter"><code>b</code></em>
- is too small to accommodate the packet header or the
- <span class="type">lwres_nooprequest_t</span>
- and
- <span class="type">lwres_noopresponse_t</span>
- structures.
- <code class="function">lwres_nooprequest_parse()</code>
- and
- <code class="function">lwres_noopresponse_parse()</code>
- will return
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- if the buffer is not empty after decoding the received packet.
- These functions will return
- <span class="errorcode">LWRES_R_FAILURE</span>
- if
- <code class="constant">pktflags</code>
- in the packet header structure
- <span class="type">lwres_lwpacket_t</span>
- indicate that the packet is not a response to an earlier query.
- </p>
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_packet</span>(3)
- </span>
- </p>
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_packet.3 b/usr.sbin/bind/lib/lwres/man/lwres_packet.3
deleted file mode 100644
index 397bc12bf41..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_packet.3
+++ /dev/null
@@ -1,194 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_packet
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_PACKET" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwpacket\&.h>
-.fi
-.ft
-.HP \w'lwres_result_t\ lwres_lwpacket_renderheader('u
-.BI "lwres_result_t lwres_lwpacket_renderheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");"
-.HP \w'lwres_result_t\ lwres_lwpacket_parseheader('u
-.BI "lwres_result_t lwres_lwpacket_parseheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");"
-.SH "DESCRIPTION"
-.PP
-These functions rely on a
-\fBstruct lwres_lwpacket\fR
-which is defined in
-lwres/lwpacket\&.h\&.
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct lwres_lwpacket lwres_lwpacket_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-struct lwres_lwpacket {
- lwres_uint32_t length;
- lwres_uint16_t version;
- lwres_uint16_t pktflags;
- lwres_uint32_t serial;
- lwres_uint32_t opcode;
- lwres_uint32_t result;
- lwres_uint32_t recvlength;
- lwres_uint16_t authtype;
- lwres_uint16_t authlength;
-};
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The elements of this structure are:
-.PP
-\fBlength\fR
-.RS 4
-the overall packet length, including the entire packet header\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&.
-.RE
-.PP
-\fBversion\fR
-.RS 4
-the header format\&. There is currently only one format,
-\fBLWRES_LWPACKETVERSION_0\fR\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&.
-.RE
-.PP
-\fBpktflags\fR
-.RS 4
-library\-defined flags for this packet: for instance whether the packet is a request or a reply\&. Flag values can be set, but not defined by the caller\&. This field is filled in by the application wit the exception of the LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the lwres_gabn_*() and lwres_gnba_*() calls\&.
-.RE
-.PP
-\fBserial\fR
-.RS 4
-is set by the requestor and is returned in all replies\&. If two or more packets from the same source have the same serial number and are from the same source, they are assumed to be duplicates and the latter ones may be dropped\&. This field must be set by the application\&.
-.RE
-.PP
-\fBopcode\fR
-.RS 4
-indicates the operation\&. Opcodes between 0x00000000 and 0x03ffffff are reserved for use by the lightweight resolver library\&. Opcodes between 0x04000000 and 0xffffffff are application defined\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&.
-.RE
-.PP
-\fBresult\fR
-.RS 4
-is only valid for replies\&. Results between 0x04000000 and 0xffffffff are application defined\&. Results between 0x00000000 and 0x03ffffff are reserved for library use\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&.
-.RE
-.PP
-\fBrecvlength\fR
-.RS 4
-is the maximum buffer size that the receiver can handle on requests and the size of the buffer needed to satisfy a request when the buffer is too large for replies\&. This field is supplied by the application\&.
-.RE
-.PP
-\fBauthtype\fR
-.RS 4
-defines the packet level authentication that is used\&. Authorisation types between 0x1000 and 0xffff are application defined and types between 0x0000 and 0x0fff are reserved for library use\&. Currently these are not used and must be zero\&.
-.RE
-.PP
-\fBauthlen\fR
-.RS 4
-gives the length of the authentication data\&. Since packet authentication is currently not used, this must be zero\&.
-.RE
-.PP
-The following opcodes are currently defined:
-.PP
-\fBNOOP\fR
-.RS 4
-Success is always returned and the packet contents are echoed\&. The lwres_noop_*() functions should be used for this type\&.
-.RE
-.PP
-\fBGETADDRSBYNAME\fR
-.RS 4
-returns all known addresses for a given name\&. The lwres_gabn_*() functions should be used for this type\&.
-.RE
-.PP
-\fBGETNAMEBYADDR\fR
-.RS 4
-return the hostname for the given address\&. The lwres_gnba_*() functions should be used for this type\&.
-.RE
-.PP
-\fBlwres_lwpacket_renderheader()\fR
-transfers the contents of lightweight resolver packet structure
-\fBlwres_lwpacket_t\fR\fI*pkt\fR
-in network byte order to the lightweight resolver buffer,
-\fI*b\fR\&.
-.PP
-\fBlwres_lwpacket_parseheader()\fR
-performs the converse operation\&. It transfers data in network byte order from buffer
-\fI*b\fR
-to resolver packet
-\fI*pkt\fR\&. The contents of the buffer
-\fIb\fR
-should correspond to a
-\fBlwres_lwpacket_t\fR\&.
-.SH "RETURN VALUES"
-.PP
-Successful calls to
-\fBlwres_lwpacket_renderheader()\fR
-and
-\fBlwres_lwpacket_parseheader()\fR
-return
-\fBLWRES_R_SUCCESS\fR\&. If there is insufficient space to copy data between the buffer
-\fI*b\fR
-and lightweight resolver packet
-\fI*pkt\fR
-both functions return
-\fBLWRES_R_UNEXPECTEDEND\fR\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_packet.html b/usr.sbin/bind/lib/lwres/man/lwres_packet.html
deleted file mode 100644
index 10e7698ef8e..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_packet.html
+++ /dev/null
@@ -1,272 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_packet</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_lwpacket_renderheader,
- lwres_lwpacket_parseheader
- &#8212; lightweight resolver packet handling functions
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/lwpacket.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_lwpacket_renderheader</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_lwpacket_parseheader</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_lwpacket_t *<var class="pdparam">pkt</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
- <p>
- These functions rely on a
- <span class="type">struct lwres_lwpacket</span>
- which is defined in
- <code class="filename">lwres/lwpacket.h</code>.
- </p>
-
- <pre class="programlisting">
-typedef struct lwres_lwpacket lwres_lwpacket_t;
- </pre>
-<p>
- </p>
- <pre class="programlisting">
-struct lwres_lwpacket {
- lwres_uint32_t length;
- lwres_uint16_t version;
- lwres_uint16_t pktflags;
- lwres_uint32_t serial;
- lwres_uint32_t opcode;
- lwres_uint32_t result;
- lwres_uint32_t recvlength;
- lwres_uint16_t authtype;
- lwres_uint16_t authlength;
-};
-</pre>
-<p>
- </p>
-
- <p>
- The elements of this structure are:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">length</code></span></dt>
-<dd>
- <p>
- the overall packet length, including the entire packet header.
- This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
- calls.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">version</code></span></dt>
-<dd>
- <p>
- the header format. There is currently only one format,
- <span class="type">LWRES_LWPACKETVERSION_0</span>.
-
- This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
- calls.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">pktflags</code></span></dt>
-<dd>
- <p>
- library-defined flags for this packet: for instance whether the
- packet
- is a request or a reply. Flag values can be set, but not defined
- by
- the caller.
- This field is filled in by the application wit the exception of
- the
- LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in
- the
- lwres_gabn_*() and lwres_gnba_*() calls.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">serial</code></span></dt>
-<dd>
- <p>
- is set by the requestor and is returned in all replies. If two
- or more
- packets from the same source have the same serial number and are
- from
- the same source, they are assumed to be duplicates and the
- latter ones
- may be dropped.
- This field must be set by the application.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">opcode</code></span></dt>
-<dd>
- <p>
- indicates the operation.
- Opcodes between 0x00000000 and 0x03ffffff are
- reserved for use by the lightweight resolver library. Opcodes
- between
- 0x04000000 and 0xffffffff are application defined.
- This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
- calls.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">result</code></span></dt>
-<dd>
- <p>
- is only valid for replies.
- Results between 0x04000000 and 0xffffffff are application
- defined.
- Results between 0x00000000 and 0x03ffffff are reserved for
- library use.
- This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
- calls.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">recvlength</code></span></dt>
-<dd>
- <p>
- is the maximum buffer size that the receiver can handle on
- requests
- and the size of the buffer needed to satisfy a request when the
- buffer
- is too large for replies.
- This field is supplied by the application.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">authtype</code></span></dt>
-<dd>
- <p>
- defines the packet level authentication that is used.
- Authorisation types between 0x1000 and 0xffff are application
- defined
- and types between 0x0000 and 0x0fff are reserved for library
- use.
- Currently these are not used and must be zero.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">authlen</code></span></dt>
-<dd>
- <p>
- gives the length of the authentication data.
- Since packet authentication is currently not used, this must be
- zero.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
- <p>
- The following opcodes are currently defined:
- </p>
-<div class="variablelist"><dl class="variablelist">
-<dt><span class="term"><code class="constant">NOOP</code></span></dt>
-<dd>
- <p>
- Success is always returned and the packet contents are echoed.
- The lwres_noop_*() functions should be used for this type.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">GETADDRSBYNAME</code></span></dt>
-<dd>
- <p>
- returns all known addresses for a given name.
- The lwres_gabn_*() functions should be used for this type.
- </p>
- </dd>
-<dt><span class="term"><code class="constant">GETNAMEBYADDR</code></span></dt>
-<dd>
- <p>
- return the hostname for the given address.
- The lwres_gnba_*() functions should be used for this type.
- </p>
- </dd>
-</dl></div>
-<p>
- </p>
-
- <p><code class="function">lwres_lwpacket_renderheader()</code>
- transfers the contents of lightweight resolver packet structure
- <span class="type">lwres_lwpacket_t</span> <em class="parameter"><code>*pkt</code></em> in
- network byte order to the lightweight resolver buffer,
- <em class="parameter"><code>*b</code></em>.
- </p>
-
- <p><code class="function">lwres_lwpacket_parseheader()</code>
- performs the converse operation. It transfers data in network
- byte order from buffer <em class="parameter"><code>*b</code></em> to resolver
- packet <em class="parameter"><code>*pkt</code></em>. The contents of the buffer
- <em class="parameter"><code>b</code></em> should correspond to a
- <span class="type">lwres_lwpacket_t</span>.
- </p>
-
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- Successful calls to
- <code class="function">lwres_lwpacket_renderheader()</code> and
- <code class="function">lwres_lwpacket_parseheader()</code> return
- <span class="errorcode">LWRES_R_SUCCESS</span>. If there is insufficient
- space to copy data between the buffer <em class="parameter"><code>*b</code></em> and
- lightweight resolver packet <em class="parameter"><code>*pkt</code></em> both
- functions
- return <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>.
- </p>
-
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_resutil.3 b/usr.sbin/bind/lib/lwres/man/lwres_resutil.3
deleted file mode 100644
index 7b219bb91e2..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_resutil.3
+++ /dev/null
@@ -1,193 +0,0 @@
-.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.\"
-.\" Permission to use, copy, modify, and/or distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-.\" PERFORMANCE OF THIS SOFTWARE.
-.\"
-.hy 0
-.ad l
-'\" t
-.\" Title: lwres_resutil
-.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 2007-06-18
-.\" Manual: BIND9
-.\" Source: ISC
-.\" Language: English
-.\"
-.TH "LWRES_RESUTIL" "3" "2007\-06\-18" "ISC" "BIND9"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr \- lightweight resolver utility functions
-.SH "SYNOPSIS"
-.sp
-.ft B
-.nf
-#include <lwres/lwres\&.h>
-.fi
-.ft
-.HP \w'lwres_result_t\ lwres_string_parse('u
-.BI "lwres_result_t lwres_string_parse(lwres_buffer_t\ *" "b" ", char\ **" "c" ", lwres_uint16_t\ *" "len" ");"
-.HP \w'lwres_result_t\ lwres_addr_parse('u
-.BI "lwres_result_t lwres_addr_parse(lwres_buffer_t\ *" "b" ", lwres_addr_t\ *" "addr" ");"
-.HP \w'lwres_result_t\ lwres_getaddrsbyname('u
-.BI "lwres_result_t lwres_getaddrsbyname(lwres_context_t\ *" "ctx" ", const\ char\ *" "name" ", lwres_uint32_t\ " "addrtypes" ", lwres_gabnresponse_t\ **" "structp" ");"
-.HP \w'lwres_result_t\ lwres_getnamebyaddr('u
-.BI "lwres_result_t lwres_getnamebyaddr(lwres_context_t\ *" "ctx" ", lwres_uint32_t\ " "addrtype" ", lwres_uint16_t\ " "addrlen" ", const\ unsigned\ char\ *" "addr" ", lwres_gnbaresponse_t\ **" "structp" ");"
-.SH "DESCRIPTION"
-.PP
-\fBlwres_string_parse()\fR
-retrieves a DNS\-encoded string starting the current pointer of lightweight resolver buffer
-\fIb\fR: i\&.e\&.
-\fBb\->current\fR\&. When the function returns, the address of the first byte of the encoded string is returned via
-\fI*c\fR
-and the length of that string is given by
-\fI*len\fR\&. The buffer\*(Aqs current pointer is advanced to point at the character following the string length, the encoded string, and the trailing
-\fBNULL\fR
-character\&.
-.PP
-\fBlwres_addr_parse()\fR
-extracts an address from the buffer
-\fIb\fR\&. The buffer\*(Aqs current pointer
-\fBb\->current\fR
-is presumed to point at an encoded address: the address preceded by a 32\-bit protocol family identifier and a 16\-bit length field\&. The encoded address is copied to
-\fBaddr\->address\fR
-and
-\fBaddr\->length\fR
-indicates the size in bytes of the address that was copied\&.
-\fBb\->current\fR
-is advanced to point at the next byte of available data in the buffer following the encoded address\&.
-.PP
-\fBlwres_getaddrsbyname()\fR
-and
-\fBlwres_getnamebyaddr()\fR
-use the
-\fBlwres_gnbaresponse_t\fR
-structure defined below:
-.PP
-.if n \{\
-.RS 4
-.\}
-.nf
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- lwres_addrlist_t addrs;
- void *base;
- size_t baselen;
-} lwres_gabnresponse_t;
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The contents of this structure are not manipulated directly but they are controlled through the
-\fBlwres_gabn\fR(3)
-functions\&.
-.PP
-The lightweight resolver uses
-\fBlwres_getaddrsbyname()\fR
-to perform forward lookups\&. Hostname
-\fIname\fR
-is looked up using the resolver context
-\fIctx\fR
-for memory allocation\&.
-\fIaddrtypes\fR
-is a bitmask indicating which type of addresses are to be looked up\&. Current values for this bitmask are
-\fBLWRES_ADDRTYPE_V4\fR
-for IPv4 addresses and
-\fBLWRES_ADDRTYPE_V6\fR
-for IPv6 addresses\&. Results of the lookup are returned in
-\fI*structp\fR\&.
-.PP
-\fBlwres_getnamebyaddr()\fR
-performs reverse lookups\&. Resolver context
-\fIctx\fR
-is used for memory allocation\&. The address type is indicated by
-\fIaddrtype\fR:
-\fBLWRES_ADDRTYPE_V4\fR
-or
-\fBLWRES_ADDRTYPE_V6\fR\&. The address to be looked up is given by
-\fIaddr\fR
-and its length is
-\fIaddrlen\fR
-bytes\&. The result of the function call is made available through
-\fI*structp\fR\&.
-.SH "RETURN VALUES"
-.PP
-Successful calls to
-\fBlwres_string_parse()\fR
-and
-\fBlwres_addr_parse()\fR
-return
-\fBLWRES_R_SUCCESS\&.\fR
-Both functions return
-\fBLWRES_R_FAILURE\fR
-if the buffer is corrupt or
-\fBLWRES_R_UNEXPECTEDEND\fR
-if the buffer has less space than expected for the components of the encoded string or address\&.
-.PP
-\fBlwres_getaddrsbyname()\fR
-returns
-\fBLWRES_R_SUCCESS\fR
-on success and it returns
-\fBLWRES_R_NOTFOUND\fR
-if the hostname
-\fIname\fR
-could not be found\&.
-.PP
-\fBLWRES_R_SUCCESS\fR
-is returned by a successful call to
-\fBlwres_getnamebyaddr()\fR\&.
-.PP
-Both
-\fBlwres_getaddrsbyname()\fR
-and
-\fBlwres_getnamebyaddr()\fR
-return
-\fBLWRES_R_NOMEMORY\fR
-when memory allocation requests fail and
-\fBLWRES_R_UNEXPECTEDEND\fR
-if the buffers used for sending queries and receiving replies are too small\&.
-.SH "SEE ALSO"
-.PP
-\fBlwres_buffer\fR(3),
-\fBlwres_gabn\fR(3)\&.
-.SH "AUTHOR"
-.PP
-\fBInternet Systems Consortium, Inc\&.\fR
-.SH "COPYRIGHT"
-.br
-Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
-.br
diff --git a/usr.sbin/bind/lib/lwres/man/lwres_resutil.html b/usr.sbin/bind/lib/lwres/man/lwres_resutil.html
deleted file mode 100644
index c0cdc4d41b2..00000000000
--- a/usr.sbin/bind/lib/lwres/man/lwres_resutil.html
+++ /dev/null
@@ -1,268 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC")
- -
- - Permission to use, copy, modify, and/or distribute this software for any
- - purpose with or without fee is hereby granted, provided that the above
- - copyright notice and this permission notice appear in all copies.
- -
- - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- - PERFORMANCE OF THIS SOFTWARE.
--->
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>lwres_resutil</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
-<a name="id-1"></a><div class="titlepage"></div>
-
-
-
-
-
-
-
- <div class="refnamediv">
-<h2>Name</h2>
-<p>
- lwres_string_parse,
- lwres_addr_parse,
- lwres_getaddrsbyname,
- lwres_getnamebyaddr
- &#8212; lightweight resolver utility functions
- </p>
-</div>
- <div class="refsynopsisdiv">
-<h2>Synopsis</h2>
- <div class="funcsynopsis">
-<pre class="funcsynopsisinfo">#include &lt;lwres/lwres.h&gt;</pre>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_string_parse</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>char **<var class="pdparam">c</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint16_t *<var class="pdparam">len</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_addr_parse</b>(</code></td>
-<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_addr_t *<var class="pdparam">addr</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_getaddrsbyname</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const char *<var class="pdparam">name</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint32_t <var class="pdparam">addrtypes</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gabnresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
-<tr>
-<td><code class="funcdef">
-lwres_result_t
-<b class="fsfunc">lwres_getnamebyaddr</b>(</code></td>
-<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint32_t <var class="pdparam">addrtype</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_uint16_t <var class="pdparam">addrlen</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>const unsigned char *<var class="pdparam">addr</var>, </td>
-</tr>
-<tr>
-<td> </td>
-<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
-</tr>
-</table>
-<div class="funcprototype-spacer"> </div>
-</div>
- </div>
-
- <div class="refsection">
-<a name="id-1.7"></a><h2>DESCRIPTION</h2>
-
-
- <p><code class="function">lwres_string_parse()</code>
- retrieves a DNS-encoded string starting the current pointer of
- lightweight resolver buffer <em class="parameter"><code>b</code></em>: i.e.
- <code class="constant">b-&gt;current</code>. When the function returns,
- the address of the first byte of the encoded string is returned
- via <em class="parameter"><code>*c</code></em> and the length of that string is
- given by <em class="parameter"><code>*len</code></em>. The buffer's current
- pointer is advanced to point at the character following the
- string length, the encoded string, and the trailing
- <span class="type">NULL</span> character.
- </p>
-
- <p><code class="function">lwres_addr_parse()</code>
- extracts an address from the buffer <em class="parameter"><code>b</code></em>.
- The buffer's current pointer <code class="constant">b-&gt;current</code>
- is presumed to point at an encoded address: the address preceded
- by a 32-bit protocol family identifier and a 16-bit length
- field. The encoded address is copied to
- <code class="constant">addr-&gt;address</code> and
- <code class="constant">addr-&gt;length</code> indicates the size in bytes
- of the address that was copied.
- <code class="constant">b-&gt;current</code> is advanced to point at the
- next byte of available data in the buffer following the encoded
- address.
- </p>
-
- <p><code class="function">lwres_getaddrsbyname()</code>
- and <code class="function">lwres_getnamebyaddr()</code> use the
- <span class="type">lwres_gnbaresponse_t</span> structure defined below:
- </p>
-
-<pre class="programlisting">
-typedef struct {
- lwres_uint32_t flags;
- lwres_uint16_t naliases;
- lwres_uint16_t naddrs;
- char *realname;
- char **aliases;
- lwres_uint16_t realnamelen;
- lwres_uint16_t *aliaslen;
- lwres_addrlist_t addrs;
- void *base;
- size_t baselen;
-} lwres_gabnresponse_t;
-</pre>
-
- <p>
- The contents of this structure are not manipulated directly but
- they are controlled through the
- <span class="citerefentry">
- <span class="refentrytitle">lwres_gabn</span>(3)
- </span>
- functions.
- </p>
-
- <p>
- The lightweight resolver uses
- <code class="function">lwres_getaddrsbyname()</code> to perform
- forward lookups.
- Hostname <em class="parameter"><code>name</code></em> is looked up using the
- resolver
- context <em class="parameter"><code>ctx</code></em> for memory allocation.
- <em class="parameter"><code>addrtypes</code></em> is a bitmask indicating
- which type of
- addresses are to be looked up. Current values for this bitmask are
- <span class="type">LWRES_ADDRTYPE_V4</span> for IPv4 addresses and
- <span class="type">LWRES_ADDRTYPE_V6</span> for IPv6 addresses. Results of the
- lookup are returned in <em class="parameter"><code>*structp</code></em>.
- </p>
-
- <p><code class="function">lwres_getnamebyaddr()</code>
- performs reverse lookups. Resolver context
- <em class="parameter"><code>ctx</code></em> is used for memory allocation. The
- address type is indicated by <em class="parameter"><code>addrtype</code></em>:
- <span class="type">LWRES_ADDRTYPE_V4</span> or
- <span class="type">LWRES_ADDRTYPE_V6</span>. The address to be looked up is
- given by <em class="parameter"><code>addr</code></em> and its length is
- <em class="parameter"><code>addrlen</code></em> bytes. The result of the
- function call is made available through
- <em class="parameter"><code>*structp</code></em>.
- </p>
- </div>
-
- <div class="refsection">
-<a name="id-1.8"></a><h2>RETURN VALUES</h2>
-
- <p>
- Successful calls to
- <code class="function">lwres_string_parse()</code>
- and
- <code class="function">lwres_addr_parse()</code>
- return
- <span class="errorcode">LWRES_R_SUCCESS.</span>
- Both functions return
- <span class="errorcode">LWRES_R_FAILURE</span>
- if the buffer is corrupt or
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- if the buffer has less space than expected for the components of the
- encoded string or address.
- </p>
-
- <p><code class="function">lwres_getaddrsbyname()</code>
- returns <span class="errorcode">LWRES_R_SUCCESS</span> on success and it
- returns <span class="errorcode">LWRES_R_NOTFOUND</span> if the hostname
- <em class="parameter"><code>name</code></em> could not be found.
- </p>
- <p><span class="errorcode">LWRES_R_SUCCESS</span>
- is returned by a successful call to
- <code class="function">lwres_getnamebyaddr()</code>.
- </p>
-
- <p>
- Both
- <code class="function">lwres_getaddrsbyname()</code>
- and
- <code class="function">lwres_getnamebyaddr()</code>
- return
- <span class="errorcode">LWRES_R_NOMEMORY</span>
- when memory allocation requests fail and
- <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
- if the buffers used for sending queries and receiving replies are too
- small.
- </p>
-
- </div>
- <div class="refsection">
-<a name="id-1.9"></a><h2>SEE ALSO</h2>
-
- <p><span class="citerefentry">
- <span class="refentrytitle">lwres_buffer</span>(3)
- </span>,
-
- <span class="citerefentry">
- <span class="refentrytitle">lwres_gabn</span>(3)
- </span>.
- </p>
-
- </div>
-</div></body>
-</html>
diff --git a/usr.sbin/bind/lib/lwres/print.c b/usr.sbin/bind/lib/lwres/print.c
deleted file mode 100644
index da0ff925698..00000000000
--- a/usr.sbin/bind/lib/lwres/print.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <config.h>
-
-#include <ctype.h>
-#include <stdio.h> /* for sprintf */
-#include <string.h>
-
-#define LWRES__PRINT_SOURCE /* Used to get the lwres_print_* prototypes. */
-
-#include <lwres/stdlib.h>
-#include <lwres/string.h>
-
-#include "assert_p.h"
-#include "print_p.h"
-
-#define LWRES_PRINT_QUADFORMAT LWRES_PLATFORM_QUADFORMAT
-
-int
-lwres__print_sprintf(char *str, const char *format, ...) {
- va_list ap;
-
- va_start(ap, format);
- vsprintf(str, format, ap);
- va_end(ap);
- return (strlen(str));
-}
-
-/*
- * Return length of string that would have been written if not truncated.
- */
-
-int
-lwres__print_snprintf(char *str, size_t size, const char *format, ...) {
- va_list ap;
- int ret;
-
- va_start(ap, format);
- ret = vsnprintf(str, size, format, ap);
- va_end(ap);
- return (ret);
-
-}
-
-/*
- * Return length of string that would have been written if not truncated.
- */
-
-int
-lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
- int h;
- int l;
- int q;
- int z;
- int alt;
- int zero;
- int left;
- int plus;
- int space;
- long long tmpi;
- unsigned long long tmpui;
- unsigned long width;
- unsigned long precision;
- unsigned int length;
- char buf[1024];
- char c;
- void *v;
- char *save = str;
- const char *cp;
- const char *head;
- int count = 0;
- int pad;
- int zeropad;
- int dot;
- double dbl;
-#ifdef HAVE_LONG_DOUBLE
- long double ldbl;
-#endif
- char fmt[32];
-
- INSIST(str != NULL);
- INSIST(format != NULL);
-
- while (*format != '\0') {
- if (*format != '%') {
- if (size > 1U) {
- *str++ = *format;
- size--;
- }
- count++;
- format++;
- continue;
- }
- format++;
-
- /*
- * Reset flags.
- */
- dot = space = plus = left = zero = alt = h = l = q = z = 0;
- width = precision = 0;
- head = "";
- length = pad = zeropad = 0;
- POST(length);
-
- do {
- if (*format == '#') {
- alt = 1;
- format++;
- } else if (*format == '-') {
- left = 1;
- zero = 0;
- format++;
- } else if (*format == ' ') {
- if (!plus)
- space = 1;
- format++;
- } else if (*format == '+') {
- plus = 1;
- space = 0;
- format++;
- } else if (*format == '0') {
- if (!left)
- zero = 1;
- format++;
- } else
- break;
- } while (1);
-
- /*
- * Width.
- */
- if (*format == '*') {
- width = va_arg(ap, int);
- format++;
- } else if (isdigit((unsigned char)*format)) {
- char *e;
- width = strtoul(format, &e, 10);
- format = e;
- }
-
- /*
- * Precision.
- */
- if (*format == '.') {
- format++;
- dot = 1;
- if (*format == '*') {
- precision = va_arg(ap, int);
- format++;
- } else if (isdigit((unsigned char)*format)) {
- char *e;
- precision = strtoul(format, &e, 10);
- format = e;
- }
- }
-
- switch (*format) {
- case '\0':
- continue;
- case '%':
- if (size > 1U) {
- *str++ = *format;
- size--;
- }
- count++;
- break;
- case 'q':
- q = 1;
- format++;
- goto doint;
- case 'h':
- h = 1;
- format++;
- goto doint;
- case 'l':
- l = 1;
- format++;
- if (*format == 'l') {
- q = 1;
- format++;
- }
- goto doint;
- case 'z':
- z = 1;
- format++;
- goto doint;
- case 'n':
- case 'i':
- case 'd':
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- doint:
- if (precision != 0U)
- zero = 0;
- switch (*format) {
- case 'n':
- if (h) {
- short int *p;
- p = va_arg(ap, short *);
- REQUIRE(p != NULL);
- *p = str - save;
- } else if (l) {
- long int *p;
- p = va_arg(ap, long *);
- REQUIRE(p != NULL);
- *p = str - save;
- } else if (z) {
- size_t *p;
- p = va_arg(ap, size_t *);
- REQUIRE(p != NULL);
- *p = str - save;
- } else {
- int *p;
- p = va_arg(ap, int *);
- REQUIRE(p != NULL);
- *p = str - save;
- }
- break;
- case 'i':
- case 'd':
- if (q)
- tmpi = va_arg(ap, long long int);
- else if (l)
- tmpi = va_arg(ap, long int);
- else if (z)
- tmpi = va_arg(ap, size_t);
- else
- tmpi = va_arg(ap, int);
- if (tmpi < 0) {
- head = "-";
- tmpui = -tmpi;
- } else {
- if (plus)
- head = "+";
- else if (space)
- head = " ";
- else
- head = "";
- tmpui = tmpi;
- }
- sprintf(buf, "%" LWRES_PRINT_QUADFORMAT "u",
- tmpui);
- goto printint;
- case 'o':
- if (q)
- tmpui = va_arg(ap,
- unsigned long long int);
- else if (l)
- tmpui = va_arg(ap, long int);
- else if (z)
- tmpui = va_arg(ap, size_t);
- else
- tmpui = va_arg(ap, int);
- sprintf(buf,
- alt ? "%#" LWRES_PRINT_QUADFORMAT "o"
- : "%" LWRES_PRINT_QUADFORMAT "o",
- tmpui);
- goto printint;
- case 'u':
- if (q)
- tmpui = va_arg(ap,
- unsigned long long int);
- else if (l)
- tmpui = va_arg(ap, unsigned long int);
- else if (z)
- tmpui = va_arg(ap, size_t);
- else
- tmpui = va_arg(ap, unsigned int);
- sprintf(buf, "%" LWRES_PRINT_QUADFORMAT "u",
- tmpui);
- goto printint;
- case 'x':
- if (q)
- tmpui = va_arg(ap,
- unsigned long long int);
- else if (l)
- tmpui = va_arg(ap, unsigned long int);
- else if (z)
- tmpui = va_arg(ap, size_t);
- else
- tmpui = va_arg(ap, unsigned int);
- if (alt) {
- head = "0x";
- if (precision > 2U)
- precision -= 2;
- }
- sprintf(buf, "%" LWRES_PRINT_QUADFORMAT "x",
- tmpui);
- goto printint;
- case 'X':
- if (q)
- tmpui = va_arg(ap,
- unsigned long long int);
- else if (l)
- tmpui = va_arg(ap, unsigned long int);
- else if (z)
- tmpui = va_arg(ap, size_t);
- else
- tmpui = va_arg(ap, unsigned int);
- if (alt) {
- head = "0X";
- if (precision > 2U)
- precision -= 2;
- }
- sprintf(buf, "%" LWRES_PRINT_QUADFORMAT "X",
- tmpui);
- goto printint;
- printint:
- if (precision != 0U || width != 0U) {
- length = strlen(buf);
- if (length < precision)
- zeropad = precision - length;
- else if (length < width && zero)
- zeropad = width - length;
- if (width != 0U) {
- pad = width - length -
- zeropad - strlen(head);
- if (pad < 0)
- pad = 0;
- }
- }
- count += strlen(head) + strlen(buf) + pad +
- zeropad;
- if (!left) {
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- }
- cp = head;
- while (*cp != '\0' && size > 1U) {
- *str++ = *cp++;
- size--;
- }
- while (zeropad > 0 && size > 1U) {
- *str++ = '0';
- size--;
- zeropad--;
- }
- cp = buf;
- while (*cp != '\0' && size > 1U) {
- *str++ = *cp++;
- size--;
- }
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- break;
- default:
- break;
- }
- break;
- case 's':
- cp = va_arg(ap, char *);
- REQUIRE(cp != NULL);
-
- if (precision != 0U) {
- /*
- * cp need not be NULL terminated.
- */
- const char *tp;
- unsigned long n;
-
- n = precision;
- tp = cp;
- while (n != 0U && *tp != '\0')
- n--, tp++;
- length = precision - n;
- } else {
- length = strlen(cp);
- }
- if (width != 0U) {
- pad = width - length;
- if (pad < 0)
- pad = 0;
- }
- count += pad + length;
- if (!left)
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- if (precision != 0U)
- while (precision > 0U && *cp != '\0' &&
- size > 1U) {
- *str++ = *cp++;
- size--;
- precision--;
- }
- else
- while (*cp != '\0' && size > 1U) {
- *str++ = *cp++;
- size--;
- }
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- break;
- case 'c':
- c = va_arg(ap, int);
- if (width > 0U) {
- count += width;
- width--;
- if (left) {
- *str++ = c;
- size--;
- }
- while (width-- > 0U && size > 1U) {
- *str++ = ' ';
- size--;
- }
- if (!left && size > 1U) {
- *str++ = c;
- size--;
- }
- } else {
- count++;
- if (size > 1U) {
- *str++ = c;
- size--;
- }
- }
- break;
- case 'p':
- v = va_arg(ap, void *);
- sprintf(buf, "%p", v);
- length = strlen(buf);
- if (precision > length)
- zeropad = precision - length;
- if (width > 0U) {
- pad = width - length - zeropad;
- if (pad < 0)
- pad = 0;
- }
- count += length + pad + zeropad;
- if (!left)
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- cp = buf;
- if (zeropad > 0 && buf[0] == '0' &&
- (buf[1] == 'x' || buf[1] == 'X')) {
- if (size > 1U) {
- *str++ = *cp++;
- size--;
- }
- if (size > 1U) {
- *str++ = *cp++;
- size--;
- }
- while (zeropad > 0 && size > 1U) {
- *str++ = '0';
- size--;
- zeropad--;
- }
- }
- while (*cp != '\0' && size > 1U) {
- *str++ = *cp++;
- size--;
- }
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- break;
-
- case 'D': /*deprecated*/
- INSIST("use %ld instead of %D" == NULL);
- break;
- case 'O': /*deprecated*/
- INSIST("use %lo instead of %O" == NULL);
- break;
- case 'U': /*deprecated*/
- INSIST("use %lu instead of %U" == NULL);
- break;
-
- case 'L':
-#ifdef HAVE_LONG_DOUBLE
- l = 1;
-#else
- INSIST("long doubles are not supported" == NULL);
-#endif
- /* FALLTHROUGH */
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- if (!dot)
- precision = 6;
- /*
- * IEEE floating point.
- * MIN 2.2250738585072014E-308
- * MAX 1.7976931348623157E+308
- * VAX floating point has a smaller range than IEEE.
- *
- * precisions > 324 don't make much sense.
- * if we cap the precision at 512 we will not
- * overflow buf.
- */
- if (precision > 512U)
- precision = 512;
- sprintf(fmt, "%%%s%s.%lu%s%c", alt ? "#" : "",
- plus ? "+" : space ? " " : "",
- precision, l ? "L" : "", *format);
- switch (*format) {
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
-#ifdef HAVE_LONG_DOUBLE
- if (l) {
- ldbl = va_arg(ap, long double);
- sprintf(buf, fmt, ldbl);
- } else
-#endif
- {
- dbl = va_arg(ap, double);
- sprintf(buf, fmt, dbl);
- }
- length = strlen(buf);
- if (width > 0U) {
- pad = width - length;
- if (pad < 0)
- pad = 0;
- }
- count += length + pad;
- if (!left)
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- cp = buf;
- while (*cp != ' ' && size > 1U) {
- *str++ = *cp++;
- size--;
- }
- while (pad > 0 && size > 1U) {
- *str++ = ' ';
- size--;
- pad--;
- }
- break;
- default:
- continue;
- }
- break;
- default:
- continue;
- }
- format++;
- }
- if (size > 0U)
- *str = '\0';
- return (count);
-}
diff --git a/usr.sbin/bind/lib/lwres/print_p.h b/usr.sbin/bind/lib/lwres/print_p.h
deleted file mode 100644
index ab97648dddb..00000000000
--- a/usr.sbin/bind/lib/lwres/print_p.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: print_p.h,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-#ifndef LWRES_PRINT_P_H
-#define LWRES_PRINT_P_H 1
-
-/***
- *** Imports
- ***/
-
-#include <lwres/lang.h>
-#include <lwres/platform.h>
-
-/*
- * This block allows lib/lwres/print.c to be cleanly compiled even if
- * the platform does not need it. The standard Makefile will still
- * not compile print.c or archive print.o, so this is just to make test
- * compilation ("make print.o") easier.
- */
-#if !defined(LWRES_PLATFORM_NEEDVSNPRINTF) && defined(LWRES__PRINT_SOURCE)
-#define LWRES_PLATFORM_NEEDVSNPRINTF
-#endif
-
-#if !defined(LWRES_PLATFORM_NEEDSPRINTF) && defined(LWRES__PRINT_SOURCE)
-#define LWRES_PLATFORM_NEEDSPRINTF
-#endif
-
-/***
- *** Macros.
- ***/
-
-#ifdef __GNUC__
-#define LWRES_FORMAT_PRINTF(fmt, args) \
- __attribute__((__format__(__printf__, fmt, args)))
-#else
-#define LWRES_FORMAT_PRINTF(fmt, args)
-#endif
-
-/***
- *** Functions
- ***/
-
-#ifdef LWRES_PLATFORM_NEEDVSNPRINTF
-#include <stdarg.h>
-#include <stddef.h>
-#endif
-
-LWRES_LANG_BEGINDECLS
-
-#ifdef LWRES_PLATFORM_NEEDVSNPRINTF
-int
-lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
- LWRES_FORMAT_PRINTF(3, 0);
-#ifdef vsnprintf
-#undef vsnprintf
-#endif
-#define vsnprintf lwres__print_vsnprintf
-
-int
-lwres__print_snprintf(char *str, size_t size, const char *format, ...)
- LWRES_FORMAT_PRINTF(3, 4);
-#ifdef snprintf
-#undef snprintf
-#endif
-#define snprintf lwres__print_snprintf
-#endif /* LWRES_PLATFORM_NEEDVSNPRINTF */
-
-#ifdef LWRES_PLATFORM_NEEDSPRINTF
-int
-lwres__print_sprintf(char *str, const char *format, ...) LWRES_FORMAT_PRINTF(2, 3);
-#ifdef sprintf
-#undef sprintf
-#endif
-#define sprintf lwres__print_sprintf
-#endif
-
-LWRES_LANG_ENDDECLS
-
-#endif /* LWRES_PRINT_P_H */
diff --git a/usr.sbin/bind/lib/lwres/unix/Makefile.in b/usr.sbin/bind/lib/lwres/unix/Makefile.in
deleted file mode 100644
index d849982a70c..00000000000
--- a/usr.sbin/bind/lib/lwres/unix/Makefile.in
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:39 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-SUBDIRS = include
-TARGETS =
-
-@BIND9_MAKE_RULES@
diff --git a/usr.sbin/bind/lib/lwres/unix/include/Makefile.in b/usr.sbin/bind/lib/lwres/unix/include/Makefile.in
deleted file mode 100644
index fb05d830873..00000000000
--- a/usr.sbin/bind/lib/lwres/unix/include/Makefile.in
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:39 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-SUBDIRS = lwres
-TARGETS =
-
-@BIND9_MAKE_RULES@
diff --git a/usr.sbin/bind/lib/lwres/unix/include/lwres/Makefile.in b/usr.sbin/bind/lib/lwres/unix/include/lwres/Makefile.in
deleted file mode 100644
index 39ba2db5cf4..00000000000
--- a/usr.sbin/bind/lib/lwres/unix/include/lwres/Makefile.in
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:39 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-HEADERS = net.h
-SUBDIRS =
-TARGETS =
-
-@BIND9_MAKE_RULES@
-
-installdirs:
- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/lwres
-
-install:: installdirs
- for i in ${HEADERS}; do \
- ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/lwres ; \
- done
-
-uninstall::
- for i in ${HEADERS}; do \
- rm -f ${DESTDIR}${includedir}/lwres/$$i ; \
- done
diff --git a/usr.sbin/bind/lib/lwres/unix/include/lwres/net.h b/usr.sbin/bind/lib/lwres/unix/include/lwres/net.h
deleted file mode 100644
index 58c382f50cc..00000000000
--- a/usr.sbin/bind/lib/lwres/unix/include/lwres/net.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: net.h,v 1.3 2019/12/17 01:46:39 sthen Exp $ */
-
-#ifndef LWRES_NET_H
-#define LWRES_NET_H 1
-
-/*****
- ***** Module Info
- *****/
-
-/*! \file net.h
- * This module is responsible for defining the following basic networking
- * types:
- *
- *\li struct in_addr
- *\li struct in6_addr
- *\li struct sockaddr
- *\li struct sockaddr_in
- *\li struct sockaddr_in6
- *
- * It ensures that the AF_ and PF_ macros are defined.
- *
- * It declares ntoh[sl]() and hton[sl]().
- *
- * It declares lwres_net_aton(), lwres_net_ntop(), and lwres_net_pton().
- *
- * It ensures that #INADDR_LOOPBACK, #INADDR_ANY and #IN6ADDR_ANY_INIT
- * are defined.
- */
-
-/***
- *** Imports.
- ***/
-
-#include <lwres/platform.h> /* Required for LWRES_PLATFORM_*. */
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h> /* Contractual promise. */
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/un.h>
-
-#include <netinet/in.h> /* Contractual promise. */
-#include <arpa/inet.h> /* Contractual promise. */
-#ifdef LWRES_PLATFORM_NEEDNETINETIN6H
-#include <netinet/in6.h> /* Required on UnixWare. */
-#endif
-#ifdef LWRES_PLATFORM_NEEDNETINET6IN6H
-#include <netinet6/in6.h> /* Required on BSD/OS for in6_pktinfo. */
-#endif
-#include <net/if.h>
-
-#include <lwres/lang.h>
-
-#ifndef LWRES_PLATFORM_HAVEIPV6
-#include <lwres/ipv6.h> /* Contractual promise. */
-#endif
-
-#ifdef LWRES_PLATFORM_HAVEINADDR6
-#define in6_addr in_addr6 /* Required for pre RFC2133 implementations. */
-#endif
-
-/*!
- * 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.
- */
-#ifndef IN6ADDR_ANY_INIT
-#ifdef s6_addr
-#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
-
-/*!
- * Initialize address loopback. See IN6ADDR_ANY_INIT
- */
-#ifndef IN6ADDR_LOOPBACK_INIT
-#ifdef s6_addr
-#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
-#else
-#define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } }
-#endif
-#endif
-
-/*% Used by AI_ALL */
-#ifndef AF_INET6
-#define AF_INET6 99
-#endif
-
-
-/*% Used to return IPV6 address types. */
-#ifndef PF_INET6
-#define PF_INET6 AF_INET6
-#endif
-
-/*% inaddr Loopback */
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK 0x7f000001UL
-#endif
-
-LWRES_LANG_BEGINDECLS
-
-const char *
-lwres_net_ntop(int af, const void *src, char *dst, size_t size);
-
-int
-lwres_net_pton(int af, const char *src, void *dst);
-
-int
-lwres_net_aton(const char *cp, struct in_addr *addr);
-
-LWRES_LANG_ENDDECLS
-
-#endif /* LWRES_NET_H */
diff --git a/usr.sbin/bind/lib/lwres/version.c b/usr.sbin/bind/lib/lwres/version.c
deleted file mode 100644
index 3ac906b8529..00000000000
--- a/usr.sbin/bind/lib/lwres/version.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: version.c,v 1.3 2019/12/17 01:46:38 sthen Exp $ */
-
-/*! \file */
-
-#include <lwres/version.h>
-
-const char lwres_version[] = VERSION;
-
-const unsigned int lwres_libinterface = LIBINTERFACE;
-const unsigned int lwres_librevision = LIBREVISION;
-const unsigned int lwres_libage = LIBAGE;