From: Mark Andrews Date: Wed, 24 Jul 2002 06:42:32 +0000 (+0000) Subject: 1336. [func] Nibble lookups under IP6.ARPA are now supported by X-Git-Tag: v9.2.3rc1~104^2~459 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f0471ca4b7bca6e907130ec84e36cf69f2b79a5a;p=thirdparty%2Fbind9.git 1336. [func] Nibble lookups under IP6.ARPA are now supported by dns_byaddr_create(). dns_byaddr_createptrname() is deprecated, use dns_byaddr_createptrname2() instead. --- diff --git a/CHANGES b/CHANGES index 5ef5597cec8..448d11ebe91 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1336. [func] Nibble lookups under IP6.ARPA are now supported by + dns_byaddr_create(). dns_byaddr_createptrname() is + deprecated, use dns_byaddr_createptrname2() instead. + 1335. [bug] When performing a nonexistence proof, the validator should discard parent NXTs from higher in the DNS. diff --git a/lib/dns/byaddr.c b/lib/dns/byaddr.c index efba7f94d78..030cf42ab8c 100644 --- a/lib/dns/byaddr.c +++ b/lib/dns/byaddr.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: byaddr.c,v 1.30 2001/11/12 19:05:12 gson Exp $ */ +/* $Id: byaddr.c,v 1.31 2002/07/24 06:42:32 marka Exp $ */ #include @@ -67,6 +67,16 @@ static char hex_digits[] = { isc_result_t dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, dns_name_t *name) +{ + unsigned int options; + + options = nibble ? (DNS_BYADDROPT_IPV6NIBBLE|DNS_BYADDROPT_IPV6INT) : 0; + return (dns_byaddr_createptrname2(address, options, name)); +} + +isc_result_t +dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options, + dns_name_t *name) { char textname[128]; unsigned char *bytes; @@ -91,7 +101,7 @@ dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, (bytes[1] & 0xff), (bytes[0] & 0xff)); } else if (address->family == AF_INET6) { - if (nibble) { + if ((options & DNS_BYADDROPT_IPV6NIBBLE) != 0) { cp = textname; for (i = 15; i >= 0; i--) { *cp++ = hex_digits[bytes[i] & 0x0f]; @@ -99,7 +109,10 @@ dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, *cp++ = hex_digits[(bytes[i] >> 4) & 0x0f]; *cp++ = '.'; } - strcpy(cp, "ip6.int."); + if ((options & DNS_BYADDROPT_IPV6INT) != 0) + strcpy(cp, "ip6.int."); + else + strcpy(cp, "ip6.arpa."); } else { cp = textname; *cp++ = '\\'; @@ -241,9 +254,8 @@ dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view, dns_fixedname_init(&byaddr->name); - result = dns_byaddr_createptrname(address, - ISC_TF(byaddr->options & DNS_BYADDROPT_IPV6NIBBLE), - dns_fixedname_name(&byaddr->name)); + result = dns_byaddr_createptrname2(address, options, + dns_fixedname_name(&byaddr->name)); if (result != ISC_R_SUCCESS) goto cleanup_lock; diff --git a/lib/dns/include/dns/byaddr.h b/lib/dns/include/dns/byaddr.h index 3c21164345b..44ea6a515e8 100644 --- a/lib/dns/include/dns/byaddr.h +++ b/lib/dns/include/dns/byaddr.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: byaddr.h,v 1.12 2001/01/09 21:52:18 bwelling Exp $ */ +/* $Id: byaddr.h,v 1.13 2002/07/24 06:42:32 marka Exp $ */ #ifndef DNS_BYADDR_H #define DNS_BYADDR_H 1 @@ -69,6 +69,7 @@ typedef struct dns_byaddrevent { } dns_byaddrevent_t; #define DNS_BYADDROPT_IPV6NIBBLE 0x0001 +#define DNS_BYADDROPT_IPV6INT 0x0002 isc_result_t dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view, @@ -86,10 +87,12 @@ dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view, * * The 'nibble' format for that address is * - * 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.int. + * 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. * * The 'bitstring' format will be used unless the DNS_BYADDROPT_IPV6NIBBLE * option has been set. + * DNS_BYADDROPT_IPV6INT can be combined with DNS_BYADDROPT_IPV6NIBBLE + * to get nibble lookups under ip6.int. * * Requires: * @@ -147,10 +150,15 @@ dns_byaddr_destroy(dns_byaddr_t **byaddrp); isc_result_t dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, dns_name_t *name); + +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. + * address is provided, instead of the 'bitstring' format. 'options' are + * the same as for dns_byaddr_create(). * * Requires: *