1336. [func] Nibble lookups under IP6.ARPA are now supported by

dns_byaddr_create().  dns_byaddr_createptrname() is
                        deprecated, use dns_byaddr_createptrname2() instead.
This commit is contained in:
Mark Andrews
2002-07-24 06:42:32 +00:00
parent 3ff40fd173
commit f0471ca4b7
3 changed files with 33 additions and 9 deletions
+4
View File
@@ -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.
+18 -6
View File
@@ -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 <config.h>
@@ -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;
+11 -3
View File
@@ -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:
*