From ec3984e9df6fd9b7811daa0dacb1b3dd1423ebf3 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 25 Jul 2002 05:46:07 +0000 Subject: [PATCH] 1339. [func] dig, host and nslookup now use IP6.ARPA for nibble lookups. Bit string lookups are no longer attempted. --- CHANGES | 3 +++ bin/dig/dig.c | 15 +++++++++------ bin/dig/dig.docbook | 9 +++++---- bin/dig/dighost.c | 12 ++++++++---- bin/dig/host.c | 15 +++++++++------ bin/dig/host.docbook | 8 ++++---- bin/dig/include/dig/dig.h | 6 +++--- bin/dig/nslookup.c | 4 ++-- 8 files changed, 43 insertions(+), 29 deletions(-) diff --git a/CHANGES b/CHANGES index 40fa68005a..6d6aae9771 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1339. [func] dig, host and nslookup now use IP6.ARPA for nibble + lookups. Bit string lookups are no longer attempted. + 1338. [func] IPv6 synthesis is now performed for IP6.ARPA bit string queries. diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 736bae6213..b5a798d507 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.178 2002/05/29 05:30:59 marka Exp $ */ +/* $Id: dig.c,v 1.179 2002/07/25 05:46:07 marka Exp $ */ #include #include @@ -84,7 +84,7 @@ static char *argv0; static char domainopt[DNS_NAME_MAXTEXT]; static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE, - nibble = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, + ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE; static const char *opcodetext[] = { @@ -159,7 +159,7 @@ help(void) { " (Use ixfr=version for type ixfr)\n" " q-opt is one of:\n" " -x dot-notation (shortcut for in-addr lookups)\n" -" -n (nibble form for reverse IPv6 lookups)\n" +" -i (IP6.INT reverse IPv6 lookups)\n" " -f filename (batch mode)\n" " -b address (bind to source address)\n" " -p port (specify port number)\n" @@ -1013,11 +1013,14 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, help(); exit(0); break; + case 'i': + ip6_int = ISC_TRUE; + return (ISC_FALSE); case 'm': /* memdebug */ /* memdebug is handled in preparse_args() */ return (ISC_FALSE); case 'n': - nibble = ISC_TRUE; + /* deprecated */ return (ISC_FALSE); case 'v': version(); @@ -1121,7 +1124,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, return (value_from_next); case 'x': *lookup = clone_lookup(default_lookup, ISC_TRUE); - if (get_reverse(textname, value, nibble, ISC_FALSE) + if (get_reverse(textname, value, ip6_int, ISC_FALSE) == ISC_R_SUCCESS) { strncpy((*lookup)->textname, textname, @@ -1129,7 +1132,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, debug("looking up %s", (*lookup)->textname); (*lookup)->trace_root = ISC_TF((*lookup)->trace || (*lookup)->ns_search_only); - (*lookup)->nibble = nibble; + (*lookup)->ip6_int = ip6_int; if (!(*lookup)->rdtypeset) (*lookup)->rdtype = dns_rdatatype_ptr; if (!(*lookup)->rdclassset) diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook index 087b41aa42..fda583f7a0 100644 --- a/bin/dig/dig.docbook +++ b/bin/dig/dig.docbook @@ -16,7 +16,7 @@ - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --> - + @@ -203,9 +203,10 @@ When this option is used, there is no need to provide the automatically performs a lookup for a name like 11.12.13.10.in-addr.arpa and sets the query type and class to PTR and IN respectively. By default, IPv6 addresses are -looked up using the IP6.ARPA domain and binary labels as defined in -RFC2874. To use the older RFC1886 method using the IP6.INT domain and -"nibble" labels, specify the (nibble) option. +looked up using nibble format under the IP6.ARPA domain. +To use the older RFC1886 method using the IP6.INT domain +specify the option. Bit string labels (RFC2874) +are now experimental and are not attempted. diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index ea1a29b635..348110c34f 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.245 2002/07/10 01:03:14 marka Exp $ */ +/* $Id: dighost.c,v 1.246 2002/07/25 05:46:07 marka Exp $ */ /* * Notice to programmers: Do not use this code as an example of how to @@ -220,7 +220,7 @@ reverse_octets(const char *in, char **p, char *end) { } isc_result_t -get_reverse(char *reverse, char *value, isc_boolean_t nibble, +get_reverse(char *reverse, char *value, isc_boolean_t ip6_int, isc_boolean_t strict) { int r; @@ -233,9 +233,13 @@ get_reverse(char *reverse, char *value, isc_boolean_t nibble, /* This is a valid IPv6 address. */ dns_fixedname_t fname; dns_name_t *name; + unsigned int options = DNS_BYADDROPT_IPV6NIBBLE; + + if (ip6_int) + options |= DNS_BYADDROPT_IPV6INT; dns_fixedname_init(&fname); name = dns_fixedname_name(&fname); - result = dns_byaddr_createptrname(&addr, nibble, name); + result = dns_byaddr_createptrname2(&addr, options, name); if (result != ISC_R_SUCCESS) return (result); dns_name_format(name, reverse, MXNAME); @@ -401,7 +405,7 @@ make_empty_lookup(void) { looknew->retries = tries; looknew->nsfound = 0; looknew->tcp_mode = ISC_FALSE; - looknew->nibble = ISC_FALSE; + looknew->ip6_int = ISC_FALSE; looknew->comments = ISC_TRUE; looknew->stats = ISC_TRUE; looknew->section_question = ISC_TRUE; diff --git a/bin/dig/host.c b/bin/dig/host.c index 097f0e40f1..e84fc7456f 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: host.c,v 1.83 2001/12/19 12:16:40 marka Exp $ */ +/* $Id: host.c,v 1.84 2002/07/25 05:46:07 marka Exp $ */ #include #include @@ -120,14 +120,14 @@ struct rtype rtypes[] = { static void show_usage(void) { fputs( -"Usage: host [-aCdlrTwv] [-c class] [-n] [-N ndots] [-t type] [-W time]\n" +"Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]\n" " [-R number] hostname [server]\n" " -a is equivalent to -v -t *\n" " -c specifies query class for non-IN data\n" " -C compares SOA records on authoritative nameservers\n" " -d is equivalent to -v\n" " -l lists all hosts in a domain, using AXFR\n" -" -n Use the nibble form of IPv6 reverse lookup\n" +" -i IP6.INT reverse lookups\n" " -N changes the number of dots allowed before root lookup is done\n" " -r disables recursive processing\n" " -R specifies number of retries for UDP packets\n" @@ -485,7 +485,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { lookup = make_empty_lookup(); - while ((c = isc_commandline_parse(argc, argv, "lvwrdt:c:aTCN:R:W:Dn")) + while ((c = isc_commandline_parse(argc, argv, "lvwrdt:c:aTCN:R:W:Dni")) != EOF) { switch (c) { case 'l': @@ -533,8 +533,11 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { lookup->rdtypeset = ISC_TRUE; short_form = ISC_FALSE; break; + case 'i': + lookup->ip6_int = ISC_TRUE; + break; case 'n': - lookup->nibble = ISC_TRUE; + /* deprecated */ break; case 'w': /* @@ -590,7 +593,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { } lookup->pending = ISC_FALSE; - if (get_reverse(store, hostname, lookup->nibble, ISC_TRUE) + if (get_reverse(store, hostname, lookup->ip6_int, ISC_TRUE) == ISC_R_SUCCESS) { strncpy(lookup->textname, store, sizeof(lookup->textname)); diff --git a/bin/dig/host.docbook b/bin/dig/host.docbook index 666a7649da..85d562b902 100644 --- a/bin/dig/host.docbook +++ b/bin/dig/host.docbook @@ -16,7 +16,7 @@ - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --> - + @@ -109,10 +109,10 @@ to making a query of type AXFR. -The +The option specifies that reverse lookups of IPv6 addresses should -use the IP6.INT domain and "nibble" labels as defined in RFC1886. -The default is to use IP6.ARPA and binary labels as defined in RFC2874. +use the IP6.INT domain as defined in RFC1886. +The default is to use IP6.ARPA. diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index 12da249187..4348abef22 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.77 2002/05/29 05:31:05 marka Exp $ */ +/* $Id: dig.h,v 1.78 2002/07/25 05:46:07 marka Exp $ */ #ifndef DIG_H #define DIG_H @@ -99,7 +99,7 @@ struct dig_lookup { trace, /* dig +trace */ trace_root, /* initial query for either +trace or +nssearch */ tcp_mode, - nibble, + ip6_int, comments, stats, section_question, @@ -190,7 +190,7 @@ void get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr); isc_result_t -get_reverse(char *reverse, char *value, isc_boolean_t nibble, +get_reverse(char *reverse, char *value, isc_boolean_t ip6_int, isc_boolean_t strict); void diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index 0aa96ef7fa..a9bd5c9b78 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nslookup.c,v 1.96 2002/03/20 18:20:03 marka Exp $ */ +/* $Id: nslookup.c,v 1.97 2002/07/25 05:46:07 marka Exp $ */ #include @@ -662,7 +662,7 @@ addlookup(char *opt) { rdclass = dns_rdataclass_in; } lookup = make_empty_lookup(); - if (get_reverse(store, opt, lookup->nibble, ISC_TRUE) + if (get_reverse(store, opt, lookup->ip6_int, ISC_TRUE) == ISC_R_SUCCESS) { safecpy(lookup->textname, store, sizeof(lookup->textname));