diff options
Diffstat (limited to 'usr.bin/dig/lib')
| -rw-r--r-- | usr.bin/dig/lib/dns/Makefile.inc | 4 | ||||
| -rw-r--r-- | usr.bin/dig/lib/dns/byaddr.c | 89 | ||||
| -rw-r--r-- | usr.bin/dig/lib/dns/include/dns/byaddr.h | 112 |
3 files changed, 2 insertions, 203 deletions
diff --git a/usr.bin/dig/lib/dns/Makefile.inc b/usr.bin/dig/lib/dns/Makefile.inc index f0dd7be87d5..d8e024896fc 100644 --- a/usr.bin/dig/lib/dns/Makefile.inc +++ b/usr.bin/dig/lib/dns/Makefile.inc @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile.inc,v 1.3 2020/02/23 08:51:12 florian Exp $ +# $OpenBSD: Makefile.inc,v 1.4 2020/09/15 08:15:17 florian Exp $ .PATH: ${.CURDIR}/lib/dns -SRCS+= byaddr.c compress.c dns_log.c dns_result.c dns_time.c +SRCS+= compress.c dns_log.c dns_result.c dns_time.c SRCS+= dst_api.c dst_result.c masterdump.c SRCS+= hmac_link.c key.c name.c openssl_link.c message.c SRCS+= rcode.c rdata.c rdatalist.c diff --git a/usr.bin/dig/lib/dns/byaddr.c b/usr.bin/dig/lib/dns/byaddr.c deleted file mode 100644 index d9b1acd1802..00000000000 --- a/usr.bin/dig/lib/dns/byaddr.c +++ /dev/null @@ -1,89 +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: byaddr.c,v 1.2 2020/02/11 23:26:11 jsg Exp $ */ - -/*! \file */ - -#include <string.h> - -#include <isc/buffer.h> -#include <isc/netaddr.h> -#include <isc/util.h> - -#include <dns/byaddr.h> -#include <dns/name.h> - -/* - * XXXRTH We could use a static event... - */ - -static char hex_digits[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' -}; - -isc_result_t -dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options, - dns_name_t *name) -{ - char textname[128]; - unsigned char *bytes; - int i; - char *cp; - isc_buffer_t buffer; - unsigned int len; - - REQUIRE(address != NULL); - - /* - * We create the text representation and then convert to a - * dns_name_t. This is not maximally efficient, but it keeps all - * of the knowledge of wire format in the dns_name_ routines. - */ - - bytes = (unsigned char *)(&address->type); - if (address->family == AF_INET) { - (void)snprintf(textname, sizeof(textname), - "%u.%u.%u.%u.in-addr.arpa.", - (bytes[3] & 0xffU), - (bytes[2] & 0xffU), - (bytes[1] & 0xffU), - (bytes[0] & 0xffU)); - } else if (address->family == AF_INET6) { - size_t remaining; - - cp = textname; - for (i = 15; i >= 0; i--) { - *cp++ = hex_digits[bytes[i] & 0x0f]; - *cp++ = '.'; - *cp++ = hex_digits[(bytes[i] >> 4) & 0x0f]; - *cp++ = '.'; - } - remaining = sizeof(textname) - (cp - textname); - if ((options & DNS_BYADDROPT_IPV6INT) != 0) { - strlcpy(cp, "ip6.int.", remaining); - } else { - strlcpy(cp, "ip6.arpa.", remaining); - } - } else - return (ISC_R_NOTIMPLEMENTED); - - len = (unsigned int)strlen(textname); - isc_buffer_init(&buffer, textname, len); - isc_buffer_add(&buffer, len); - return (dns_name_fromtext(name, &buffer, dns_rootname, 0, NULL)); -} diff --git a/usr.bin/dig/lib/dns/include/dns/byaddr.h b/usr.bin/dig/lib/dns/include/dns/byaddr.h deleted file mode 100644 index 0c409d69858..00000000000 --- a/usr.bin/dig/lib/dns/include/dns/byaddr.h +++ /dev/null @@ -1,112 +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: byaddr.h,v 1.2 2020/02/13 13:53:00 jsg Exp $ */ - -#ifndef DNS_BYADDR_H -#define DNS_BYADDR_H 1 - -/***** - ***** Module Info - *****/ - -/*! \file dns/byaddr.h - * \brief - * The byaddr module provides reverse lookup services for IPv4 and IPv6 - * addresses. - * - * MP: - *\li The module ensures appropriate synchronization of data structures it - * creates and manipulates. - * - * Reliability: - *\li No anticipated impact. - * - * Resources: - *\li TBS - * - * Security: - *\li No anticipated impact. - * - * Standards: - *\li RFCs: 1034, 1035, 2181, TBS - *\li Drafts: TBS - */ - -#include <isc/event.h> - -#include <dns/types.h> - -/* - * This option is deprecated since we now only consider nibbles. -#define DNS_BYADDROPT_IPV6NIBBLE 0x0001 - */ -/*% Note DNS_BYADDROPT_IPV6NIBBLE is now deprecated. */ -#define DNS_BYADDROPT_IPV6INT 0x0002 - -/*%< - * Find the domain name of 'address'. - * - * Notes: - * - *\li There is a reverse lookup format for IPv6 addresses, 'nibble' - * - *\li The 'nibble' format for that address is - * - * \code - * 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. - * \endcode - * - *\li #DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int. - * - * Requires: - * - *\li 'mctx' is a valid mctx. - * - *\li 'address' is a valid IPv4 or IPv6 address. - * - *\li 'view' is a valid view which has a resolver. - * - *\li 'task' is a valid task. - * - *\li byaddrp != NULL && *byaddrp == NULL - * - * Returns: - * - *\li #ISC_R_SUCCESS - *\li #ISC_R_NOMEMORY - * - *\li Any resolver-related error (e.g. #ISC_R_SHUTTINGDOWN) may also be - * returned. - */ - -isc_result_t -dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options, - dns_name_t *name); -/*%< - * Creates a name that would be used in a PTR query for this address. The - * nibble flag indicates that the 'nibble' format is to be used if an IPv6 - * address is provided, instead of the 'bitstring' format. Since we dropped - * the support of the bitstring labels, it is expected that the flag is always - * set. 'options' are the same as for dns_byaddr_create(). - * - * Requires: - * - * \li 'address' is a valid address. - * \li 'name' is a valid name with a dedicated buffer. - */ - -#endif /* DNS_BYADDR_H */ |
