mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
developer: jinmei
reviewer: marka 1368. [func] remove support for bitstring labels.
This commit is contained in:
parent
ce76952df3
commit
b6309ed962
21 changed files with 250 additions and 1897 deletions
2
CHANGES
2
CHANGES
|
|
@ -1,3 +1,5 @@
|
|||
1368. [func] remove support for bitstring labels.
|
||||
|
||||
1367. [func] Use response times to select forwarders.
|
||||
|
||||
1366. [contrib] queryperf usage was incomplete. Add '-h' for help.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dighost.c,v 1.250 2002/08/12 19:57:13 mayer Exp $ */
|
||||
/* $Id: dighost.c,v 1.251 2002/08/27 04:53:38 marka Exp $ */
|
||||
|
||||
/*
|
||||
* Notice to programmers: Do not use this code as an example of how to
|
||||
|
|
@ -250,8 +250,8 @@ get_reverse(char *reverse, char *value, isc_boolean_t ip6_int,
|
|||
/* This is a valid IPv6 address. */
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
unsigned int options = DNS_BYADDROPT_IPV6NIBBLE;
|
||||
|
||||
unsigned int options = 0;
|
||||
|
||||
if (ip6_int)
|
||||
options |= DNS_BYADDROPT_IPV6INT;
|
||||
dns_fixedname_init(&fname);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lwdgnba.c,v 1.14 2001/11/27 00:55:35 gson Exp $ */
|
||||
/* $Id: lwdgnba.c,v 1.15 2002/08/27 04:53:38 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -66,7 +66,8 @@ byaddr_done(isc_task_t *task, isc_event_t *event) {
|
|||
isc_event_free(&event);
|
||||
bevent = NULL;
|
||||
|
||||
if ((client->options & DNS_BYADDROPT_IPV6NIBBLE) != 0) {
|
||||
if (client->na.family != AF_INET6 ||
|
||||
(client->options & DNS_BYADDROPT_IPV6INT) != 0) {
|
||||
if (result == DNS_R_NCACHENXDOMAIN ||
|
||||
result == DNS_R_NCACHENXRRSET ||
|
||||
result == DNS_R_NXDOMAIN ||
|
||||
|
|
@ -79,10 +80,10 @@ byaddr_done(isc_task_t *task, isc_event_t *event) {
|
|||
}
|
||||
|
||||
/*
|
||||
* Fall back to nibble reverse if the default of bitstrings
|
||||
* Fall back to ip6.int reverse if the default ip6.arpa
|
||||
* fails.
|
||||
*/
|
||||
client->options |= DNS_BYADDROPT_IPV6NIBBLE;
|
||||
client->options |= DNS_BYADDROPT_IPV6INT;
|
||||
|
||||
start_byaddr(client);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: query.c,v 1.233 2002/08/19 21:32:56 marka Exp $ */
|
||||
/* $Id: query.c,v 1.234 2002/08/27 04:53:38 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -149,18 +149,12 @@ 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);
|
||||
|
||||
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.
|
||||
*/
|
||||
|
|
@ -3594,18 +3588,7 @@ ns_query_start(ns_client_t *client) {
|
|||
&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;
|
||||
}
|
||||
/* 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;
|
||||
qclient = NULL;
|
||||
ns_client_attach(client, &qclient);
|
||||
synth_rev_start(qclient);
|
||||
return;
|
||||
|
|
@ -3906,21 +3889,6 @@ 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'.
|
||||
|
|
@ -3933,11 +3901,10 @@ 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");
|
||||
|
||||
/* Try IP6.ARPA nibble style first. */
|
||||
/* Try IP6.ARPA first. */
|
||||
result = dns_byaddr_create(client->mctx,
|
||||
&client->query.synth.na,
|
||||
client->view,
|
||||
DNS_BYADDROPT_IPV6NIBBLE, client->task,
|
||||
client->view, 0, client->task,
|
||||
synth_rev_byaddrdone_arpa,
|
||||
client, &byaddr_dummy);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
|
|
@ -3958,11 +3925,10 @@ 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 nibble next. */
|
||||
/* Try IP6.INT next. */
|
||||
result = dns_byaddr_create(client->mctx,
|
||||
&client->query.synth.na,
|
||||
client->view,
|
||||
DNS_BYADDROPT_IPV6NIBBLE|
|
||||
DNS_BYADDROPT_IPV6INT,
|
||||
client->task,
|
||||
synth_rev_byaddrdone_int,
|
||||
|
|
@ -3976,59 +3942,21 @@ 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) {
|
||||
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);
|
||||
}
|
||||
else
|
||||
synth_finish(client, bevent->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;
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
if (bevent->result == ISC_R_SUCCESS) {
|
||||
synth_rev_respond(client, bevent);
|
||||
} else if (bevent->result == DNS_R_NCACHENXDOMAIN ||
|
||||
bevent->result == DNS_R_NCACHENXRRSET ||
|
||||
bevent->result == DNS_R_NXDOMAIN ||
|
||||
bevent->result == DNS_R_NXRRSET) {
|
||||
/*
|
||||
* We could give a NOERROR/NODATA response instead
|
||||
* in some cases, but since there may be any combination
|
||||
* of NXDOMAIN and NXRRSET results from the IP6.INT
|
||||
* and IP6.ARPA lookups, it could still be wrong with
|
||||
* respect to one or the other.
|
||||
*/
|
||||
synth_finish(client, DNS_R_NXDOMAIN);
|
||||
} else {
|
||||
synth_finish(client, bevent->result);
|
||||
}
|
||||
isc_event_free(&event);
|
||||
dns_byaddr_destroy(&byaddr);
|
||||
}
|
||||
|
||||
static void
|
||||
synth_rev_respond(ns_client_t *client, dns_byaddrevent_t *bevent) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: byaddr_test.c,v 1.22 2001/01/09 21:40:54 bwelling Exp $ */
|
||||
/* $Id: byaddr_test.c,v 1.23 2002/08/27 04:53:39 marka Exp $ */
|
||||
|
||||
/*
|
||||
* Principal Author: Bob Halley
|
||||
|
|
@ -101,7 +101,9 @@ main(int argc, char *argv[]) {
|
|||
while ((ch = isc_commandline_parse(argc, argv, "nvw:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'n':
|
||||
options |= DNS_BYADDROPT_IPV6NIBBLE;
|
||||
/*
|
||||
* We only try nibbles, so do nothing for this option.
|
||||
*/
|
||||
break;
|
||||
case 'v':
|
||||
verbose = ISC_TRUE;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: t_names.c,v 1.33 2002/05/23 04:32:22 marka Exp $ */
|
||||
/* $Id: t_names.c,v 1.34 2002/08/27 04:53:39 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -36,10 +36,6 @@
|
|||
#define BUFLEN 256
|
||||
#define BIGBUFLEN 4096
|
||||
|
||||
static const char *a1 =
|
||||
"dns_label_countbits returns the number of "
|
||||
"bits in a bitstring label";
|
||||
|
||||
static char *Tokens[MAXTOKS + 1];
|
||||
|
||||
/*
|
||||
|
|
@ -356,167 +352,6 @@ dname_from_tname(char *name, dns_name_t *dns_name) {
|
|||
return (result);
|
||||
}
|
||||
|
||||
static int
|
||||
test_dns_label_countbits(char *test_name, int pos, int expected_bits) {
|
||||
dns_label_t label;
|
||||
dns_name_t dns_name;
|
||||
int bits;
|
||||
int rval;
|
||||
isc_result_t result;
|
||||
|
||||
rval = T_UNRESOLVED;
|
||||
t_info("testing name %s, label %d\n", test_name, pos);
|
||||
|
||||
result = dname_from_tname(test_name, &dns_name);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
dns_name_getlabel(&dns_name, pos, &label);
|
||||
bits = dns_label_countbits(&label);
|
||||
if (bits == expected_bits)
|
||||
rval = T_PASS;
|
||||
else {
|
||||
t_info("got %d, expected %d\n", bits, expected_bits);
|
||||
rval = T_FAIL;
|
||||
}
|
||||
} else {
|
||||
t_info("dname_from_tname %s failed, result = %s\n",
|
||||
test_name, dns_result_totext(result));
|
||||
rval = T_UNRESOLVED;
|
||||
}
|
||||
return (rval);
|
||||
}
|
||||
|
||||
static void
|
||||
t_dns_label_countbits(void) {
|
||||
FILE *fp;
|
||||
char *p;
|
||||
int line;
|
||||
int cnt;
|
||||
int result;
|
||||
|
||||
result = T_UNRESOLVED;
|
||||
t_assert("dns_label_countbits", 1, T_REQUIRED, a1);
|
||||
|
||||
fp = fopen("dns_label_countbits_data", "r");
|
||||
if (fp != NULL) {
|
||||
line = 0;
|
||||
while ((p = t_fgetbs(fp)) != NULL) {
|
||||
|
||||
++line;
|
||||
|
||||
/*
|
||||
* Skip comment lines.
|
||||
*/
|
||||
if ((isspace((unsigned char)*p)) || (*p == '#'))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* testname, labelpos, bitpos, expected val.
|
||||
*/
|
||||
cnt = bustline(p, Tokens);
|
||||
if (cnt == 3) {
|
||||
result = test_dns_label_countbits(Tokens[0],
|
||||
atoi(Tokens[1]),
|
||||
atoi(Tokens[2]));
|
||||
} else {
|
||||
t_info("bad datafile format at line %d\n",
|
||||
line);
|
||||
}
|
||||
|
||||
(void)free(p);
|
||||
t_result(result);
|
||||
}
|
||||
(void)fclose(fp);
|
||||
} else {
|
||||
t_info("Missing datafile dns_label_countbits_data\n");
|
||||
t_result(result);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *a2 = "dns_label_getbit returns the n'th most significant "
|
||||
"bit of a bitstring label";
|
||||
|
||||
static int
|
||||
test_dns_label_getbit(char *test_name, int label_pos, int bit_pos,
|
||||
int expected_bitval)
|
||||
{
|
||||
dns_label_t label;
|
||||
dns_name_t dns_name;
|
||||
int bitval;
|
||||
int rval;
|
||||
isc_result_t result;
|
||||
|
||||
rval = T_UNRESOLVED;
|
||||
|
||||
t_info("testing name %s, label %d, bit %d\n",
|
||||
test_name, label_pos, bit_pos);
|
||||
|
||||
result = dname_from_tname(test_name, &dns_name);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
dns_name_getlabel(&dns_name, label_pos, &label);
|
||||
bitval = dns_label_getbit(&label, bit_pos);
|
||||
if (bitval == expected_bitval)
|
||||
rval = T_PASS;
|
||||
else {
|
||||
t_info("got %d, expected %d\n", bitval,
|
||||
expected_bitval);
|
||||
rval = T_FAIL;
|
||||
}
|
||||
} else {
|
||||
t_info("dname_from_tname %s failed, result = %s\n",
|
||||
test_name, dns_result_totext(result));
|
||||
rval = T_UNRESOLVED;
|
||||
}
|
||||
return (rval);
|
||||
}
|
||||
|
||||
static void
|
||||
t_dns_label_getbit(void) {
|
||||
int line;
|
||||
int cnt;
|
||||
int result;
|
||||
char *p;
|
||||
FILE *fp;
|
||||
|
||||
t_assert("dns_label_getbit", 1, T_REQUIRED, a2);
|
||||
|
||||
result = T_UNRESOLVED;
|
||||
fp = fopen("dns_label_getbit_data", "r");
|
||||
if (fp != NULL) {
|
||||
line = 0;
|
||||
while ((p = t_fgetbs(fp)) != NULL) {
|
||||
|
||||
++line;
|
||||
|
||||
/*
|
||||
* Skip comment lines.
|
||||
*/
|
||||
if ((isspace((unsigned char)*p)) || (*p == '#'))
|
||||
continue;
|
||||
|
||||
cnt = bustline(p, Tokens);
|
||||
if (cnt == 4) {
|
||||
/*
|
||||
* label, bitpos, expected value.
|
||||
*/
|
||||
result = test_dns_label_getbit(Tokens[0],
|
||||
atoi(Tokens[1]),
|
||||
atoi(Tokens[2]),
|
||||
atoi(Tokens[3]));
|
||||
} else {
|
||||
t_info("bad datafile format at line %d\n",
|
||||
line);
|
||||
}
|
||||
|
||||
(void)free(p);
|
||||
t_result(result);
|
||||
}
|
||||
(void)fclose(fp);
|
||||
} else {
|
||||
t_info("Missing datafile dns_label_getbit_data\n");
|
||||
t_result(result);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *a3 = "dns_name_init initializes 'name' to the empty name";
|
||||
|
||||
static void
|
||||
|
|
@ -2468,8 +2303,6 @@ t_dns_name_concatenate(void) {
|
|||
#endif
|
||||
|
||||
testspec_t T_testlist[] = {
|
||||
{ t_dns_label_countbits, "dns_label_countbits" },
|
||||
{ t_dns_label_getbit, "dns_label_getbit" },
|
||||
{ t_dns_name_init, "dns_name_init" },
|
||||
{ t_dns_name_invalidate, "dns_name_invalidate" },
|
||||
{ t_dns_name_setbuffer, "dns_name_setbuffer" },
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lwtest.c,v 1.23 2002/05/23 04:32:24 marka Exp $ */
|
||||
/* $Id: lwtest.c,v 1.24 2002/08/27 04:53:39 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -695,11 +695,11 @@ main(void) {
|
|||
test_gnba("10.10.10.17", LWRES_ADDRTYPE_V4, LWRES_R_NOTFOUND,
|
||||
NULL);
|
||||
test_gnba("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
LWRES_ADDRTYPE_V6, LWRES_R_SUCCESS, "nibble.example");
|
||||
LWRES_ADDRTYPE_V6, LWRES_R_SUCCESS, "ip6.int.example");
|
||||
test_gnba("0123:4567:89ab:cdef:0123:4567:89ab:cde0",
|
||||
LWRES_ADDRTYPE_V6, LWRES_R_NOTFOUND, NULL);
|
||||
test_gnba("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
LWRES_ADDRTYPE_V6, LWRES_R_SUCCESS, "bitstring.example");
|
||||
LWRES_ADDRTYPE_V6, LWRES_R_SUCCESS, "ip6.arpa.example");
|
||||
test_gnba("1123:4567:89ab:cdef:0123:4567:89ab:cde0",
|
||||
LWRES_ADDRTYPE_V6, LWRES_R_NOTFOUND, NULL);
|
||||
|
||||
|
|
@ -728,16 +728,16 @@ main(void) {
|
|||
test_gethostbyaddr("10.10.10.1", AF_INET, "ipv4.example");
|
||||
test_gethostbyaddr("10.10.10.17", AF_INET, NULL);
|
||||
test_gethostbyaddr("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
AF_INET6, "nibble.example");
|
||||
AF_INET6, "ip6.int.example");
|
||||
test_gethostbyaddr("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
AF_INET6, "bitstring.example");
|
||||
AF_INET6, "ip6.arpa.example");
|
||||
|
||||
test_getipnodebyaddr("10.10.10.1", AF_INET, "ipv4.example");
|
||||
test_getipnodebyaddr("10.10.10.17", AF_INET, NULL);
|
||||
test_getipnodebyaddr("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
AF_INET6, "nibble.example");
|
||||
AF_INET6, "ip6.int.example");
|
||||
test_getipnodebyaddr("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
AF_INET6, "bitstring.example");
|
||||
AF_INET6, "ip6.arpa.example");
|
||||
|
||||
test_getaddrinfo("a.example1.", AF_INET, 1, 1, "10.0.1.1");
|
||||
test_getaddrinfo("a.example1.", AF_INET, 1, 0, "10.0.1.1");
|
||||
|
|
@ -751,9 +751,9 @@ main(void) {
|
|||
test_getnameinfo("10.10.10.1", AF_INET, "ipv4.example");
|
||||
test_getnameinfo("10.10.10.17", AF_INET, NULL);
|
||||
test_getnameinfo("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
AF_INET6, "nibble.example");
|
||||
AF_INET6, "ip6.int.example");
|
||||
test_getnameinfo("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
|
||||
AF_INET6, "bitstring.example");
|
||||
AF_INET6, "ip6.arpa.example");
|
||||
test_getnameinfo("1122:3344:5566:7788:99aa:bbcc:ddee:ff00",
|
||||
AF_INET6, "dname.example1");
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
; WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
; $Id: example1.db,v 1.10 2001/01/09 21:43:41 bwelling Exp $
|
||||
; $Id: example1.db,v 1.11 2002/08/27 04:53:39 marka Exp $
|
||||
|
||||
$TTL 300 ; 5 minutes
|
||||
@ IN SOA mname1. . (
|
||||
2000062101 ; serial
|
||||
2002082210 ; serial
|
||||
20 ; refresh (20 seconds)
|
||||
20 ; retry (20 seconds)
|
||||
1814400 ; expire (3 weeks)
|
||||
|
|
@ -32,8 +32,8 @@ a3 CNAME nowhere
|
|||
b A6 64 ::ffff:ffff:ffff:ffff c
|
||||
c A6 0 eeee:eeee:eeee:eeee::
|
||||
d A6 64 ::ffff:ffff:ffff:ffff e
|
||||
\[x7788/16] DNAME net
|
||||
\[x99aabbccddeeff00/64].net PTR dname
|
||||
8.8.7.7 DNAME net
|
||||
0.0.f.f.e.e.d.d.c.c.b.b.a.a.9.9.net PTR dname
|
||||
e A 10.0.1.1
|
||||
SIG A 1 1 300 20001202003412 (
|
||||
20001102003412 1 example. abcd )
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
; WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
; $Id: ip6.arpa.db,v 1.7 2001/01/09 21:43:43 bwelling Exp $
|
||||
; $Id: ip6.arpa.db,v 1.8 2002/08/27 04:53:40 marka Exp $
|
||||
|
||||
$TTL 300 ; 5 minutes
|
||||
@ IN SOA mname1. . (
|
||||
2000062101 ; serial
|
||||
2002082300 ; serial
|
||||
20 ; refresh (20 seconds)
|
||||
20 ; retry (20 seconds)
|
||||
1814400 ; expire (3 weeks)
|
||||
|
|
@ -26,5 +26,5 @@ $TTL 300 ; 5 minutes
|
|||
NS ns
|
||||
ns A 10.53.0.1
|
||||
|
||||
\[x1123456789abcdef0123456789abcdef/128] PTR bitstring.example.
|
||||
\[x112233445566/48] DNAME example1.
|
||||
f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.1 PTR ip6.arpa.example.
|
||||
6.6.5.5.4.4.3.3.2.2.1.1 DNAME example1.
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
; WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
; $Id: ip6.int.db,v 1.7 2001/01/09 21:43:44 bwelling Exp $
|
||||
; $Id: ip6.int.db,v 1.8 2002/08/27 04:53:40 marka Exp $
|
||||
|
||||
$TTL 300 ; 5 minutes
|
||||
@ IN SOA mname1. . (
|
||||
2000062001 ; serial
|
||||
2002082300 ; serial
|
||||
20 ; refresh (20 seconds)
|
||||
20 ; retry (20 seconds)
|
||||
1814400 ; expire (3 weeks)
|
||||
|
|
@ -26,4 +26,4 @@ $TTL 300 ; 5 minutes
|
|||
NS ns
|
||||
ns A 10.53.0.1
|
||||
|
||||
f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0 PTR nibble.example.
|
||||
f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0 PTR ip6.int.example.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
; WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
; $Id: ip6.arpa.db,v 1.1 2001/01/10 01:18:28 gson Exp $
|
||||
; $Id: ip6.arpa.db,v 1.2 2002/08/27 04:53:42 marka Exp $
|
||||
|
||||
$TTL 86400
|
||||
@ IN SOA ns2 hostmaster (
|
||||
|
|
@ -21,8 +21,4 @@ $TTL 86400
|
|||
NS ns2.example.
|
||||
ns2.example. A 10.53.0.2
|
||||
|
||||
\[x123456000000000000000000000001ff] PTR foo.
|
||||
|
||||
|
||||
|
||||
|
||||
f.f.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.6.5.4.3.2.1 PTR foo.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: byaddr.c,v 1.31 2002/07/24 06:42:32 marka Exp $ */
|
||||
/* $Id: byaddr.c,v 1.32 2002/08/27 04:53:42 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -68,10 +68,13 @@ isc_result_t
|
|||
dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
|
||||
dns_name_t *name)
|
||||
{
|
||||
unsigned int options;
|
||||
/*
|
||||
* We dropped bitstring labels, so all lookups will use nibbles.
|
||||
*/
|
||||
UNUSED(nibble);
|
||||
|
||||
options = nibble ? (DNS_BYADDROPT_IPV6NIBBLE|DNS_BYADDROPT_IPV6INT) : 0;
|
||||
return (dns_byaddr_createptrname2(address, options, name));
|
||||
return (dns_byaddr_createptrname2(address,
|
||||
DNS_BYADDROPT_IPV6INT, name));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -101,31 +104,17 @@ dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
|
|||
(bytes[1] & 0xff),
|
||||
(bytes[0] & 0xff));
|
||||
} else if (address->family == AF_INET6) {
|
||||
if ((options & DNS_BYADDROPT_IPV6NIBBLE) != 0) {
|
||||
cp = textname;
|
||||
for (i = 15; i >= 0; i--) {
|
||||
*cp++ = hex_digits[bytes[i] & 0x0f];
|
||||
*cp++ = '.';
|
||||
*cp++ = hex_digits[(bytes[i] >> 4) & 0x0f];
|
||||
*cp++ = '.';
|
||||
}
|
||||
if ((options & DNS_BYADDROPT_IPV6INT) != 0)
|
||||
strcpy(cp, "ip6.int.");
|
||||
else
|
||||
strcpy(cp, "ip6.arpa.");
|
||||
} else {
|
||||
cp = textname;
|
||||
*cp++ = '\\';
|
||||
*cp++ = '[';
|
||||
*cp++ = 'x';
|
||||
for (i = 0; i < 16; i += 2) {
|
||||
*cp++ = hex_digits[(bytes[i] >> 4) & 0x0f];
|
||||
*cp++ = hex_digits[bytes[i] & 0x0f];
|
||||
*cp++ = hex_digits[(bytes[i+1] >> 4) & 0x0f];
|
||||
*cp++ = hex_digits[bytes[i+1] & 0x0f];
|
||||
}
|
||||
strcpy(cp, "].ip6.arpa.");
|
||||
cp = textname;
|
||||
for (i = 15; i >= 0; i--) {
|
||||
*cp++ = hex_digits[bytes[i] & 0x0f];
|
||||
*cp++ = '.';
|
||||
*cp++ = hex_digits[(bytes[i] >> 4) & 0x0f];
|
||||
*cp++ = '.';
|
||||
}
|
||||
if ((options & DNS_BYADDROPT_IPV6INT) != 0)
|
||||
strcpy(cp, "ip6.int.");
|
||||
else
|
||||
strcpy(cp, "ip6.arpa.");
|
||||
} else
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: byaddr.h,v 1.13 2002/07/24 06:42:32 marka Exp $ */
|
||||
/* $Id: byaddr.h,v 1.14 2002/08/27 04:53:43 marka Exp $ */
|
||||
|
||||
#ifndef DNS_BYADDR_H
|
||||
#define DNS_BYADDR_H 1
|
||||
|
|
@ -68,7 +68,10 @@ typedef struct dns_byaddrevent {
|
|||
dns_namelist_t names;
|
||||
} dns_byaddrevent_t;
|
||||
|
||||
/*
|
||||
* This option is deprecated since we now only consider nibbles.
|
||||
#define DNS_BYADDROPT_IPV6NIBBLE 0x0001
|
||||
*/
|
||||
#define DNS_BYADDROPT_IPV6INT 0x0002
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -80,19 +83,13 @@ dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view,
|
|||
*
|
||||
* Notes:
|
||||
*
|
||||
* There are two reverse lookup formats for IPv6 addresses, 'bitstring'
|
||||
* and 'nibble'. The newer 'bitstring' format for the address fe80::1 is
|
||||
*
|
||||
* \[xfe800000000000000000000000000001].ip6.int.
|
||||
* There is a reverse lookup format for IPv6 addresses, 'nibble'
|
||||
*
|
||||
* 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.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.
|
||||
* DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
|
|
@ -157,8 +154,9 @@ dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
|
|||
/*
|
||||
* 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. 'options' are
|
||||
* the same as for dns_byaddr_create().
|
||||
* address is provided, instead of the 'bitstring' format. Since we dropped
|
||||
* the support of the bitstring labels, it is expected that the flag is always
|
||||
* set. 'options' are the same as for dns_byaddr_create().
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: name.h,v 1.101 2002/08/06 01:50:28 marka Exp $ */
|
||||
/* $Id: name.h,v 1.102 2002/08/27 04:53:43 marka Exp $ */
|
||||
|
||||
#ifndef DNS_NAME_H
|
||||
#define DNS_NAME_H 1
|
||||
|
|
@ -87,86 +87,16 @@ ISC_LANG_BEGINDECLS
|
|||
***** Labels
|
||||
*****
|
||||
***** A 'label' is basically a region. It contains one DNS wire format
|
||||
***** label of either type 00 (ordinary) or type 01000001 (bitstring).
|
||||
***** label of type 00 (ordinary).
|
||||
*****/
|
||||
|
||||
/***
|
||||
*** Extended Label Types
|
||||
***/
|
||||
|
||||
#define DNS_LABELTYPE_BITSTRING 0x41
|
||||
|
||||
/***
|
||||
*** Properties
|
||||
***/
|
||||
|
||||
dns_labeltype_t
|
||||
dns_label_type(dns_label_t *label);
|
||||
/*
|
||||
* Get the type of 'label'.
|
||||
*
|
||||
* Requires:
|
||||
* 'label' is a valid label (i.e. not NULL, points to a
|
||||
* struct dns_label)
|
||||
* 'label' is a type 00 or type 01000001 label (i.e. not compressed).
|
||||
*
|
||||
* Returns:
|
||||
* dns_labeltype_ordinary type 00 label
|
||||
* dns_labeltype_bitstring type 01000001 label
|
||||
*/
|
||||
|
||||
/***
|
||||
*** Bitstring Labels
|
||||
***/
|
||||
|
||||
unsigned int
|
||||
dns_label_countbits(dns_label_t *label);
|
||||
/*
|
||||
* The number of bits in a bitstring label.
|
||||
*
|
||||
* Requires:
|
||||
* 'label' is a valid label
|
||||
*
|
||||
* dns_label_type(label) == dns_labeltype_bitstring
|
||||
*
|
||||
* Ensures:
|
||||
* Result is <= 256.
|
||||
*
|
||||
* Returns:
|
||||
* The number of bits in the bitstring label.
|
||||
*/
|
||||
|
||||
dns_bitlabel_t
|
||||
dns_label_getbit(dns_label_t *label, unsigned int n);
|
||||
/*
|
||||
* The 'n'th most significant bit of 'label'.
|
||||
*
|
||||
* Notes:
|
||||
* Numbering starts at 0.
|
||||
*
|
||||
* Require:
|
||||
* n < dns_label_countbits(label)
|
||||
*
|
||||
* Returns:
|
||||
* dns_bitlabel_0 The bit was 0.
|
||||
* dns_bitlabel_1 The bit was 1.
|
||||
*/
|
||||
|
||||
/***
|
||||
*** Note
|
||||
***
|
||||
*** Some provision still needs to be made for splitting bitstring labels.
|
||||
***/
|
||||
|
||||
|
||||
|
||||
/*****
|
||||
***** Names
|
||||
*****
|
||||
***** A 'name' is a handle to a binary region. It contains a sequence of one
|
||||
***** or more DNS wire format labels of either type 00 (ordinary) or type
|
||||
***** 01000001 (bitstring). Note that all names are not required to end
|
||||
***** with the root label, as they are in the actual DNS wire protocol.
|
||||
***** or more DNS wire format labels of type 00 (ordinary).
|
||||
***** Note that all names are not required to end with the root label,
|
||||
***** as they are in the actual DNS wire protocol.
|
||||
*****/
|
||||
|
||||
/***
|
||||
|
|
@ -445,9 +375,8 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
|
|||
*
|
||||
* *nlabelsp is the number of common significant labels.
|
||||
*
|
||||
* If *nbitsp is non-zero, then the least-signficant of the
|
||||
* common significant labels is a bitstring label, and the
|
||||
* two names have *nbitsp significant bits in common.
|
||||
* Since we dropped the support of bitstring labels, *nbitsp is always
|
||||
* set to 0.
|
||||
*
|
||||
* Returns:
|
||||
* dns_namereln_none There's no hierarchical relationship
|
||||
|
|
@ -600,8 +529,7 @@ dns_name_depth(const dns_name_t *name);
|
|||
* Notes:
|
||||
* The "depth" of a name represents how far down the DNS tree of trees
|
||||
* the name is. For each wire-encoding label in name, the depth is
|
||||
* increased by 1 for an ordinary label, and by the number of bits in
|
||||
* a bitstring label.
|
||||
* increased by 1 for an ordinary label.
|
||||
*
|
||||
* Depth is used when creating or validating DNSSEC signatures.
|
||||
*
|
||||
|
|
@ -622,9 +550,7 @@ dns_name_countlabels(const dns_name_t *name);
|
|||
* How many labels does 'name' have?
|
||||
*
|
||||
* Notes:
|
||||
* In this case, as in other places, a 'label' is an ordinary label
|
||||
* or a bitstring label. The term is not meant to refer to individual
|
||||
* bit labels. For that purpose, use dns_name_depth().
|
||||
* In this case, as in other places, a 'label' is an ordinary label.
|
||||
*
|
||||
* Requires:
|
||||
* 'name' is a valid name
|
||||
|
|
@ -775,9 +701,6 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
|
|||
* Uppercase letters are downcased in the copy iff. 'downcase' is
|
||||
* true.
|
||||
*
|
||||
* Any bitstring labels in source are canonicalized.
|
||||
* (i.e. maximally packed and any padding bits zeroed.)
|
||||
*
|
||||
* The current location in source is advanced, and the used space
|
||||
* in target is updated.
|
||||
*
|
||||
|
|
@ -856,8 +779,6 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
|
|||
* If result is success:
|
||||
* If 'target' is not NULL, 'name' is attached to it.
|
||||
*
|
||||
* Any bitstring labels in source are canonicalized.
|
||||
*
|
||||
* Uppercase letters are downcased in the copy iff. 'downcase' is
|
||||
* true.
|
||||
*
|
||||
|
|
@ -869,8 +790,8 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
|
|||
* DNS_R_EMPTYLABEL
|
||||
* DNS_R_LABELTOOLONG
|
||||
* DNS_R_BADESCAPE
|
||||
* DNS_R_BADBITSTRING
|
||||
* DNS_R_BITSTRINGTOOLONG
|
||||
* (DNS_R_BADBITSTRING: should not be returned)
|
||||
* (DNS_R_BITSTRINGTOOLONG: should not be returned)
|
||||
* DNS_R_BADDOTTEDQUAD
|
||||
* ISC_R_NOSPACE
|
||||
* ISC_R_UNEXPECTEDEND
|
||||
|
|
@ -1015,8 +936,6 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix,
|
|||
* If 'target' is not NULL and 'name' is not NULL, then 'name'
|
||||
* is attached to it.
|
||||
*
|
||||
* Any bitstring labels are in canonical form.
|
||||
*
|
||||
* The used space in target is updated.
|
||||
*
|
||||
* Returns:
|
||||
|
|
@ -1035,34 +954,25 @@ dns_name_split(dns_name_t *name,
|
|||
*
|
||||
* Notes:
|
||||
* 'name' is split such that 'suffix' holds the most significant
|
||||
* 'suffixlabels' labels, except that if the least significant
|
||||
* suffix label is a bitstring label, then only the 'nbits' most
|
||||
* significant bits of that label are included in 'suffix'. All
|
||||
* other labels and bits are stored in 'prefix'.
|
||||
* 'suffixlabels' labels. All other labels and bits are stored
|
||||
* in 'prefix'.
|
||||
*
|
||||
* Copying name data is avoided as much as possible, so 'prefix'
|
||||
* and 'suffix' will usually end up pointing at the data for 'name',
|
||||
* except when 'nbits' > 0. The name data is copied to the
|
||||
* the dedicated buffers when splitting on bitlabel boundaries
|
||||
* because of the bit fiddling that must be done.
|
||||
* and 'suffix' will end up pointing at the data for 'name'.
|
||||
*
|
||||
* It is legitimate to pass a 'prefix' or 'suffix' that has
|
||||
* its name data stored someplace other than the dedicated buffer.
|
||||
* This is useful to avoid name copying in the calling function.
|
||||
*
|
||||
* It is also legitimate to pass a 'prefix' or 'suffix' that is
|
||||
* the same dns_name_t as 'name', but note well the requirement
|
||||
* below if splitting on a bitlabel boundary.
|
||||
* the same dns_name_t as 'name'.
|
||||
*
|
||||
* Requires:
|
||||
* 'name' is a valid name.
|
||||
*
|
||||
* 'suffixlabels' cannot exceed the number of labels in 'name'.
|
||||
*
|
||||
* 'nbits' can be greater than zero only when the least significant
|
||||
* label of 'suffix' is a bitstring label.
|
||||
*
|
||||
* 'nbits' cannot exceed the number of bits in the bitstring label.
|
||||
* 'nbits' must be 0, since we dropped the support of bitstring labels.
|
||||
*
|
||||
* 'prefix' is a valid name or NULL, and cannot be read-only.
|
||||
*
|
||||
|
|
@ -1072,28 +982,22 @@ dns_name_split(dns_name_t *name,
|
|||
*
|
||||
* 'prefix' and 'suffix' cannot point to the same buffer.
|
||||
*
|
||||
* If 'nbits' > 0 and 'prefix' and 'suffix' are both non-NULL,
|
||||
* the buffer for 'prefix' cannot be storing the labels for 'name'.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
* On success:
|
||||
* If 'prefix' is not NULL it will contain the least significant
|
||||
* labels and bits.
|
||||
* labels.
|
||||
*
|
||||
* If 'suffix' is not NULL it will contain the most significant
|
||||
* labels and bits. dns_name_countlabels(suffix) will be
|
||||
* equal to suffixlabels.
|
||||
* labels. dns_name_countlabels(suffix) will be equal to
|
||||
* suffixlabels.
|
||||
*
|
||||
* On failure:
|
||||
* Either 'prefix' or 'suffix' is invalidated (depending
|
||||
* on which one the problem was encountered with).
|
||||
*
|
||||
* Returns:
|
||||
* ISC_R_SUCCESS No worries.
|
||||
* ISC_R_NOSPACE An attempt was made to split a name on a bitlabel
|
||||
* boundary but either 'prefix' or 'suffix' did not
|
||||
* have enough room to receive the split name.
|
||||
* ISC_R_SUCCESS No worries. (This function should always success).
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -1115,11 +1019,11 @@ dns_name_splitatdepth(dns_name_t *name, unsigned int depth,
|
|||
*
|
||||
* On success:
|
||||
* If 'prefix' is not NULL it will contain the least significant
|
||||
* labels and bits.
|
||||
* labels.
|
||||
*
|
||||
* If 'suffix' is not NULL it will contain the most significant
|
||||
* labels and bits. dns_name_countlabels(suffix) will be
|
||||
* equal to suffixlabels.
|
||||
* labels. dns_name_countlabels(suffix) will be equal to
|
||||
* suffixlabels.
|
||||
*
|
||||
* On failure:
|
||||
* Either 'prefix' or 'suffix' is invalidated (depending
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: result.h,v 1.93 2002/08/09 06:12:50 marka Exp $ */
|
||||
/* $Id: result.h,v 1.94 2002/08/27 04:53:43 marka Exp $ */
|
||||
|
||||
#ifndef DNS_RESULT_H
|
||||
#define DNS_RESULT_H 1
|
||||
|
|
@ -38,8 +38,13 @@
|
|||
*/
|
||||
#define DNS_R_LABELTOOLONG (ISC_RESULTCLASS_DNS + 0)
|
||||
#define DNS_R_BADESCAPE (ISC_RESULTCLASS_DNS + 1)
|
||||
/*
|
||||
* Since we dropped the support of bitstring labels, deprecate the related
|
||||
* result codes too.
|
||||
|
||||
#define DNS_R_BADBITSTRING (ISC_RESULTCLASS_DNS + 2)
|
||||
#define DNS_R_BITSTRINGTOOLONG (ISC_RESULTCLASS_DNS + 3)
|
||||
*/
|
||||
#define DNS_R_EMPTYLABEL (ISC_RESULTCLASS_DNS + 4)
|
||||
#define DNS_R_BADDOTTEDQUAD (ISC_RESULTCLASS_DNS + 5)
|
||||
#define DNS_R_INVALIDNS (ISC_RESULTCLASS_DNS + 6)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: types.h,v 1.105 2002/03/07 07:48:48 bwelling Exp $ */
|
||||
/* $Id: types.h,v 1.106 2002/08/27 04:53:43 marka Exp $ */
|
||||
|
||||
#ifndef DNS_TYPES_H
|
||||
#define DNS_TYPES_H 1
|
||||
|
|
@ -111,22 +111,12 @@ typedef ISC_LIST(dns_zone_t) dns_zonelist_t;
|
|||
typedef struct dns_zonemgr dns_zonemgr_t;
|
||||
typedef struct dns_zt dns_zt_t;
|
||||
|
||||
typedef enum {
|
||||
dns_bitlabel_0 = 0,
|
||||
dns_bitlabel_1 = 1
|
||||
} dns_bitlabel_t;
|
||||
|
||||
typedef enum {
|
||||
dns_fwdpolicy_none = 0,
|
||||
dns_fwdpolicy_first = 1,
|
||||
dns_fwdpolicy_only = 2
|
||||
} dns_fwdpolicy_t;
|
||||
|
||||
typedef enum {
|
||||
dns_labeltype_ordinary = 0,
|
||||
dns_labeltype_bitstring = 1
|
||||
} dns_labeltype_t;
|
||||
|
||||
typedef enum {
|
||||
dns_namereln_none = 0,
|
||||
dns_namereln_contains = 1,
|
||||
|
|
|
|||
1413
lib/dns/name.c
1413
lib/dns/name.c
File diff suppressed because it is too large
Load diff
155
lib/dns/rbt.c
155
lib/dns/rbt.c
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rbt.c,v 1.122 2001/12/04 01:32:43 bwelling Exp $ */
|
||||
/* $Id: rbt.c,v 1.123 2002/08/27 04:53:42 marka Exp $ */
|
||||
|
||||
/* Principal Authors: DCL */
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||
dns_namereln_t compared;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
dns_rbtnodechain_t chain;
|
||||
unsigned int common_labels, common_bits, add_bits;
|
||||
unsigned int common_labels, common_bits;
|
||||
int order;
|
||||
|
||||
REQUIRE(VALID_RBT(rbt));
|
||||
|
|
@ -361,8 +361,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||
|
||||
/*
|
||||
* Create a copy of the name so the original name structure is
|
||||
* not modified. The name data needs to be modifiable when
|
||||
* a node is split on a bitstring label.
|
||||
* not modified.
|
||||
*/
|
||||
dns_fixedname_init(&fixedcopy);
|
||||
add_name = dns_fixedname_name(&fixedcopy);
|
||||
|
|
@ -401,6 +400,11 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||
compared = dns_name_fullcompare(add_name, ¤t_name,
|
||||
&order,
|
||||
&common_labels, &common_bits);
|
||||
/*
|
||||
* since we dropped the support of bitstring labels,
|
||||
* common_bits should always be set to 0.
|
||||
*/
|
||||
INSIST(common_bits == 0);
|
||||
|
||||
if (compared == dns_namereln_equal) {
|
||||
*nodep = current;
|
||||
|
|
@ -541,89 +545,6 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||
if (*root == current)
|
||||
*root = new_current;
|
||||
|
||||
/*
|
||||
* Now make the new root of the subtree
|
||||
* as the not-in-common labels of the current
|
||||
* node, keeping the same memory location so
|
||||
* as not to break any external references to
|
||||
* the node. The down pointer and name data
|
||||
* are preserved, while left and right
|
||||
* pointers are nullified when the node is
|
||||
* established as the start of the next level.
|
||||
*
|
||||
* The name stored at the node is effectively
|
||||
* truncated in place by setting the shorter
|
||||
* name length, moving the offsets to the
|
||||
* end of the truncated name, and then
|
||||
* updating PADBYTES to reflect the truncation.
|
||||
*
|
||||
* When bitstring labels are involved, things
|
||||
* are just a tad more complicated (aren't
|
||||
* they always?) because the splitting
|
||||
* has shifted the bits that this name needs
|
||||
* from the end of the label they were in
|
||||
* to either the beginning of the label or
|
||||
* even to the previous (lesser significance)
|
||||
* label if the split was done in a maximally
|
||||
* sized bitstring label. The bit count has
|
||||
* been adjusted too, so there are convolutions
|
||||
* to deal with all the bit movement. Yay,
|
||||
* I *love* bit labels. Grumble grumble.
|
||||
*/
|
||||
if (common_bits > 0) {
|
||||
unsigned char *p;
|
||||
unsigned int skip_width;
|
||||
unsigned int start_label =
|
||||
dns_name_countlabels(¤t_name)
|
||||
- common_labels;
|
||||
|
||||
/*
|
||||
* If it is not the first label which
|
||||
* was split, also copy the label
|
||||
* before it -- which will essentially
|
||||
* be a NO-OP unless the preceding
|
||||
* label is a bitstring and the split
|
||||
* label was 256 bits. Testing for
|
||||
* that case is probably roughly
|
||||
* as expensive as just unconditionally
|
||||
* copying the preceding label.
|
||||
*/
|
||||
if (start_label > 0)
|
||||
start_label--;
|
||||
|
||||
skip_width =
|
||||
prefix->offsets[start_label];
|
||||
|
||||
memcpy(NAME(current) + skip_width,
|
||||
prefix->ndata + skip_width,
|
||||
prefix->length - skip_width);
|
||||
|
||||
/*
|
||||
* Now add_bits is set to the total
|
||||
* number of bits in the split label of
|
||||
* the name being added, and used later
|
||||
* to determine if the job was
|
||||
* completed by pushing the
|
||||
* not-in-common bits down one level.
|
||||
*/
|
||||
start_label =
|
||||
dns_name_countlabels(add_name)
|
||||
- common_labels;
|
||||
|
||||
p = add_name->ndata +
|
||||
add_name->offsets[start_label];
|
||||
INSIST(*p == DNS_LABELTYPE_BITSTRING);
|
||||
|
||||
add_bits = *(p + 1);
|
||||
|
||||
/*
|
||||
* A bitstring that was split would not
|
||||
* result in a part of maximal length.
|
||||
*/
|
||||
INSIST(add_bits != 0);
|
||||
} else
|
||||
add_bits = 0;
|
||||
|
||||
NAMELEN(current) = prefix->length;
|
||||
OFFSETLEN(current) = prefix->labels;
|
||||
memcpy(OFFSETS(current), prefix->offsets,
|
||||
|
|
@ -656,8 +577,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||
break;
|
||||
|
||||
if (common_labels ==
|
||||
dns_name_countlabels(add_name) &&
|
||||
common_bits == add_bits) {
|
||||
dns_name_countlabels(add_name)) {
|
||||
/*
|
||||
* The name has been added by pushing
|
||||
* the not-in-common parts down to
|
||||
|
|
@ -793,7 +713,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
|
|||
else {
|
||||
/*
|
||||
* Appease GCC about variables it incorrectly thinks are
|
||||
* possibly used unitialized.
|
||||
* possibly used uninitialized.
|
||||
*/
|
||||
compared = dns_namereln_none;
|
||||
last_compared = NULL;
|
||||
|
|
@ -806,8 +726,10 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
|
|||
* search_name is the name segment being sought in each tree level.
|
||||
* By using a fixedname, the search_name will definitely have offsets
|
||||
* and a buffer for use by any splitting that happens in the middle
|
||||
* of a bitstring label. By using dns_name_clone, no name data is
|
||||
* copied unless a bitstring split occurs.
|
||||
* of a bitstring label. (XXXJT: this can be skipped since we dropped
|
||||
* bitstring labels).
|
||||
* By using dns_name_clone, no name data should be copied thanks to
|
||||
* the lack of bitstring labels.
|
||||
*/
|
||||
dns_fixedname_init(&fixedsearchname);
|
||||
search_name = dns_fixedname_name(&fixedsearchname);
|
||||
|
|
@ -837,20 +759,22 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
|
|||
unsigned int nlabels;
|
||||
unsigned int tlabels = 1;
|
||||
unsigned int hash;
|
||||
isc_boolean_t has_bitstring = ISC_FALSE;
|
||||
|
||||
/*
|
||||
* If there is no hash table, hashing can't be done.
|
||||
* Similarly, when current != current_root, that
|
||||
* means a left or right pointer was followed, which
|
||||
*/
|
||||
if (rbt->hashtable == NULL)
|
||||
goto nohash;
|
||||
|
||||
/*
|
||||
* The case of current != current_root, that
|
||||
* means a left or right pointer was followed,
|
||||
* only happens when the algorithm fell through to
|
||||
* the traditional binary search because of a
|
||||
* bitstring label, so that traditional search
|
||||
* should be continued.
|
||||
* bitstring label. Since we dropped the bitstring
|
||||
* support, this should not happen.
|
||||
*/
|
||||
if (rbt->hashtable == NULL ||
|
||||
current != current_root)
|
||||
goto nohash;
|
||||
INSIST(current == current_root);
|
||||
|
||||
nlabels = dns_name_countlabels(search_name);
|
||||
|
||||
|
|
@ -907,40 +831,17 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* XXXDCL Bitstring labels complicate things, as usual.
|
||||
* Checking for the situation could be done up by the
|
||||
* dns_name_getlabelsequence so that they could still
|
||||
* use the hashing code, but it would be messy to
|
||||
* repeatedly try various bitstring lengths. Instead
|
||||
* just notice when a bitstring label is involved and
|
||||
* then punt to the traditional binary search if no
|
||||
* hash node is found after all of the labels are
|
||||
* tried.
|
||||
*/
|
||||
if (has_bitstring == ISC_FALSE &&
|
||||
hash_name.ndata[0] ==
|
||||
DNS_LABELTYPE_BITSTRING)
|
||||
has_bitstring = ISC_TRUE;
|
||||
|
||||
if (tlabels++ < nlabels)
|
||||
goto hashagain;
|
||||
|
||||
/*
|
||||
* All of the labels have been tried against the hash
|
||||
* table. If there wasn't a bitstring label involved,
|
||||
* the name isn't in the table. If there was, fall
|
||||
* through to the traditional search algorithm.
|
||||
* table. Since we dropped the support of bitstring
|
||||
* labels, the name isn't in the table.
|
||||
*/
|
||||
if (! has_bitstring) {
|
||||
/*
|
||||
* Done with the search.
|
||||
*/
|
||||
current = NULL;
|
||||
continue;
|
||||
}
|
||||
current = NULL;
|
||||
continue;
|
||||
|
||||
/* FALLTHROUGH */
|
||||
nohash:
|
||||
#endif /* DNS_RBT_USEHASH */
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: resolver.c,v 1.247 2002/08/23 00:27:10 marka Exp $ */
|
||||
/* $Id: resolver.c,v 1.248 2002/08/27 04:53:42 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -2225,10 +2225,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
|
|||
fctx->pending = 0;
|
||||
fctx->restarts = 0;
|
||||
fctx->timeouts = 0;
|
||||
if (dns_name_requiresedns(name))
|
||||
fctx->attributes = FCTX_ATTR_NEEDEDNS0;
|
||||
else
|
||||
fctx->attributes = 0;
|
||||
fctx->attributes = 0;
|
||||
|
||||
if (domain == NULL) {
|
||||
dns_forwarders_t *forwarders = NULL;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: result.c,v 1.103 2002/08/09 06:12:50 marka Exp $ */
|
||||
/* $Id: result.c,v 1.104 2002/08/27 04:53:43 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -28,6 +28,10 @@
|
|||
static const char *text[DNS_R_NRESULTS] = {
|
||||
"label too long", /* 0 DNS_R_LABELTOOLONG */
|
||||
"bad escape", /* 1 DNS_R_BADESCAPE */
|
||||
/*
|
||||
* Note that DNS_R_BADBITSTRING and DNS_R_BITSTRINGTOOLONG are
|
||||
* deprecated.
|
||||
*/
|
||||
"bad bitstring", /* 2 DNS_R_BADBITSTRING */
|
||||
"bitstring too long", /* 3 DNS_R_BITSTRINGTOOLONG */
|
||||
"empty label", /* 4 DNS_R_EMPTYLABEL */
|
||||
|
|
@ -221,14 +225,14 @@ dns_result_torcode(isc_result_t result) {
|
|||
case ISC_R_RANGE:
|
||||
case ISC_R_UNEXPECTEDEND:
|
||||
case DNS_R_BADAAAA:
|
||||
case DNS_R_BADBITSTRING:
|
||||
/* case DNS_R_BADBITSTRING: deprecated */
|
||||
case DNS_R_BADCKSUM:
|
||||
case DNS_R_BADCLASS:
|
||||
case DNS_R_BADLABELTYPE:
|
||||
case DNS_R_BADPOINTER:
|
||||
case DNS_R_BADTTL:
|
||||
case DNS_R_BADZONE:
|
||||
case DNS_R_BITSTRINGTOOLONG:
|
||||
/* case DNS_R_BITSTRINGTOOLONG: deprecated */
|
||||
case DNS_R_EXTRADATA:
|
||||
case DNS_R_LABELTOOLONG:
|
||||
case DNS_R_NOREDATA:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: t_api.c,v 1.48 2001/07/11 18:51:22 bwelling Exp $ */
|
||||
/* $Id: t_api.c,v 1.49 2002/08/27 04:53:43 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -588,8 +588,8 @@ struct dns_errormap {
|
|||
{ ISC_R_RANGE, "ISC_R_RANGE" },
|
||||
{ DNS_R_LABELTOOLONG, "DNS_R_LABELTOOLONG" },
|
||||
{ DNS_R_BADESCAPE, "DNS_R_BADESCAPE" },
|
||||
{ DNS_R_BADBITSTRING, "DNS_R_BADBITSTRING" },
|
||||
{ DNS_R_BITSTRINGTOOLONG, "DNS_R_BITSTRINGTOOLONG"},
|
||||
/* { DNS_R_BADBITSTRING, "DNS_R_BADBITSTRING" }, */
|
||||
/* { DNS_R_BITSTRINGTOOLONG, "DNS_R_BITSTRINGTOOLONG"}, */
|
||||
{ DNS_R_EMPTYLABEL, "DNS_R_EMPTYLABEL" },
|
||||
{ DNS_R_BADDOTTEDQUAD, "DNS_R_BADDOTTEDQUAD" },
|
||||
{ DNS_R_UNKNOWN, "DNS_R_UNKNOWN" },
|
||||
|
|
|
|||
Loading…
Reference in a new issue