]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1336. [func] Nibble lookups under IP6.ARPA are now supported by
authorMark Andrews <marka@isc.org>
Wed, 24 Jul 2002 06:42:32 +0000 (06:42 +0000)
committerMark Andrews <marka@isc.org>
Wed, 24 Jul 2002 06:42:32 +0000 (06:42 +0000)
                        dns_byaddr_create().  dns_byaddr_createptrname() is
                        deprecated, use dns_byaddr_createptrname2() instead.

CHANGES
lib/dns/byaddr.c
lib/dns/include/dns/byaddr.h

diff --git a/CHANGES b/CHANGES
index 5ef5597cec8e3bf729d007ebce32fae81169d0d7..448d11ebe91520fae3d234162d3cae649394b90b 100644 (file)
--- 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.
 
index efba7f94d78e6fbf3b1687daf8a4b37890b9b62d..030cf42ab8c52242ba3754713c8ffead4024946e 100644 (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;
 
index 3c21164345bbf74eb3b9b6da5db9ec62c7188d47..44ea6a515e8b6e0656d440741bb8b70cd31665e7 100644 (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:
  *