]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1338. [func] IPv6 synthesis is now performed for IP6.ARPA bit
authorMark Andrews <marka@isc.org>
Wed, 24 Jul 2002 11:53:52 +0000 (11:53 +0000)
committerMark Andrews <marka@isc.org>
Wed, 24 Jul 2002 11:53:52 +0000 (11:53 +0000)
                        string queries.

CHANGES
bin/named/query.c

diff --git a/CHANGES b/CHANGES
index 1e874d80cef8d7be4995c7779e90cefa4e954848..40fa68005a2ace9409d16072da3527f29abbb2ae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+1338.  [func]          IPv6 synthesis is now performed for IP6.ARPA bit
+                       string queries.
+
 1337.  [func]          IPv6 synthesis is now performed for both IP6.ARPA
                        and IP6.INT nibble queries.
 
index 07ce47f37b868b60be6769161189ede975b05fa1..1c83087033bac885ae30bd8e78cccbdf681b4ef7 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.228 2002/07/24 07:02:50 marka Exp $ */
+/* $Id: query.c,v 1.229 2002/07/24 11:53:52 marka Exp $ */
 
 #include <config.h>
 
@@ -155,6 +155,12 @@ synth_rev_byaddrdone_bitstring(isc_task_t *task, isc_event_t *event);
 static void
 synth_rev_respond(ns_client_t *client, dns_byaddrevent_t *bevent);
 
+static isc_result_t
+nibbles2netaddr(dns_name_t *name, isc_netaddr_t *na);
+
+static isc_result_t
+bitstring2netaddr(dns_name_t *name, isc_netaddr_t *na);
+
 /*
  * Increment query statistics counters.
  */
@@ -3566,6 +3572,17 @@ ns_query_start(ns_client_t *client) {
                                synth_rev_start(qclient);
                                return;
                        }
+                       /* bitstring label + "ip6" + "arpa" + root */
+                       if (dns_name_countlabels(client->query.qname) == 4 &&
+                            dns_name_issubdomain(client->query.qname,
+                                                 &ip6arpa_name) &&
+                           bitstring2netaddr(client->query.qname,
+                                  &client->query.synth.na) == ISC_R_SUCCESS) {
+                               qclient= NULL;
+                               ns_client_attach(client, &qclient);
+                               synth_rev_start(qclient);
+                               return;
+                       }
                }
        }
 
@@ -3862,6 +3879,21 @@ nibbles2netaddr(dns_name_t *name, isc_netaddr_t *na) {
        return (ISC_R_SUCCESS);
 }
 
+static isc_result_t
+bitstring2netaddr(dns_name_t *name, isc_netaddr_t *na) {
+       struct in6_addr ina6;
+       isc_region_t label;
+
+       dns_name_getlabel(name, 0, &label);
+       if (label.length != 18 ||
+           label.base[0] != DNS_LABELTYPE_BITSTRING ||
+           label.base[1] != 128)
+               return (ISC_R_FAILURE);
+       memcpy(ina6.s6_addr, &label.base[2], 16);
+       isc_netaddr_fromin6(na, &ina6);
+       return (ISC_R_NOTIMPLEMENTED);
+}
+
 /*
  * Generate a synthetic IPv6 reverse mapping response for the current
  * query of 'client'.