mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
1337. [func] IPv6 synthesis is now performed for both IP6.ARPA
and IP6.INT nibble queries.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
||||
1337. [func] IPv6 synthesis is now performed for both IP6.ARPA
|
||||
and IP6.INT nibble queries.
|
||||
|
||||
1336. [func] Nibble lookups under IP6.ARPA are now supported by
|
||||
dns_byaddr_create(). dns_byaddr_createptrname() is
|
||||
deprecated, use dns_byaddr_createptrname2() instead.
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: query.c,v 1.227 2002/07/23 03:40:19 marka Exp $ */
|
||||
/* $Id: query.c,v 1.228 2002/07/24 07:02:50 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -101,6 +101,18 @@ static dns_name_t ip6int_name = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static unsigned char ip6arpa_ndata[] = "\003ip6\004arpa";
|
||||
static unsigned char ip6arpa_offsets[] = { 0, 4, 9 };
|
||||
|
||||
static dns_name_t ip6arpa_name = {
|
||||
DNS_NAME_MAGIC,
|
||||
ip6arpa_ndata, 10, 3,
|
||||
DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE,
|
||||
ip6arpa_offsets, NULL,
|
||||
{(void *)-1, (void *)-1},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static isc_result_t
|
||||
query_simplefind(void *arg, dns_name_t *name, dns_rdatatype_t type,
|
||||
isc_stdtime_t now,
|
||||
@@ -137,6 +149,9 @@ synth_rev_byaddrdone_arpa(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
synth_rev_byaddrdone_int(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
static void
|
||||
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);
|
||||
|
||||
@@ -3539,9 +3554,14 @@ ns_query_start(ns_client_t *client) {
|
||||
} else {
|
||||
INSIST(qtype == dns_rdatatype_ptr);
|
||||
/* Must be 32 nibbles + "ip6" + "int" + root */
|
||||
if (dns_name_countlabels(client->query.qname) == 32 + 3 &&
|
||||
dns_name_issubdomain(client->query.qname, &ip6int_name)) {
|
||||
qclient = NULL;
|
||||
if (dns_name_countlabels(client->query.qname) == 35 &&
|
||||
(dns_name_issubdomain(client->query.qname,
|
||||
&ip6int_name) ||
|
||||
dns_name_issubdomain(client->query.qname,
|
||||
&ip6arpa_name)) &&
|
||||
nibbles2netaddr(client->query.qname,
|
||||
&client->query.synth.na) == ISC_R_SUCCESS) {
|
||||
qclient= NULL;
|
||||
ns_client_attach(client, &qclient);
|
||||
synth_rev_start(qclient);
|
||||
return;
|
||||
@@ -3854,17 +3874,11 @@ synth_rev_start(ns_client_t *client) {
|
||||
ns_client_log(client, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY,
|
||||
ISC_LOG_DEBUG(5), "generating synthetic PTR response");
|
||||
|
||||
result = nibbles2netaddr(client->query.qname, &client->query.synth.na);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = DNS_R_NXDOMAIN;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Try IP6.ARPA first. */
|
||||
/* Try IP6.ARPA nibble style first. */
|
||||
result = dns_byaddr_create(client->mctx,
|
||||
&client->query.synth.na,
|
||||
client->view,
|
||||
0, client->task,
|
||||
DNS_BYADDROPT_IPV6NIBBLE, client->task,
|
||||
synth_rev_byaddrdone_arpa,
|
||||
client, &byaddr_dummy);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
@@ -3886,11 +3900,12 @@ synth_rev_byaddrdone_arpa(isc_task_t *task, isc_event_t *event) {
|
||||
if (bevent->result == ISC_R_SUCCESS) {
|
||||
synth_rev_respond(client, bevent);
|
||||
} else {
|
||||
/* Try IP6.INT next. */
|
||||
/* Try IP6.INT nibble next. */
|
||||
result = dns_byaddr_create(client->mctx,
|
||||
&client->query.synth.na,
|
||||
client->view,
|
||||
DNS_BYADDROPT_IPV6NIBBLE,
|
||||
DNS_BYADDROPT_IPV6NIBBLE|
|
||||
DNS_BYADDROPT_IPV6INT,
|
||||
client->task,
|
||||
synth_rev_byaddrdone_int,
|
||||
client, &byaddr_dummy);
|
||||
@@ -3903,6 +3918,32 @@ synth_rev_byaddrdone_arpa(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
static void
|
||||
synth_rev_byaddrdone_int(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
dns_byaddrevent_t *bevent = (dns_byaddrevent_t *)event;
|
||||
ns_client_t *client = event->ev_arg;
|
||||
dns_byaddr_t *byaddr = event->ev_sender;
|
||||
dns_byaddr_t *byaddr_dummy = NULL;
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
if (bevent->result == ISC_R_SUCCESS) {
|
||||
synth_rev_respond(client, bevent);
|
||||
} else {
|
||||
/* Try IP6.ARPA bitstring next. */
|
||||
result = dns_byaddr_create(client->mctx,
|
||||
&client->query.synth.na,
|
||||
client->view, 0, client->task,
|
||||
synth_rev_byaddrdone_bitstring,
|
||||
client, &byaddr_dummy);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
synth_finish(client, result);
|
||||
}
|
||||
dns_byaddr_destroy(&byaddr);
|
||||
isc_event_free(&event);
|
||||
}
|
||||
|
||||
static void
|
||||
synth_rev_byaddrdone_bitstring(isc_task_t *task, isc_event_t *event) {
|
||||
dns_byaddrevent_t *bevent = (dns_byaddrevent_t *)event;
|
||||
ns_client_t *client = event->ev_arg;
|
||||
dns_byaddr_t *byaddr = event->ev_sender;
|
||||
|
Reference in New Issue
Block a user