diff --git a/CHANGES b/CHANGES index 378798cec6..a11dde4e00 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1274. [func] preferred-glue option from BIND 8.3. + 1273. [bug] The dnssec system test failed to remove the correct files. diff --git a/bin/named/client.c b/bin/named/client.c index d567ae38f9..aa30c55cf4 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.c,v 1.206 2002/04/03 05:30:01 marka Exp $ */ +/* $Id: client.c,v 1.207 2002/04/26 00:40:22 marka Exp $ */ #include @@ -843,6 +843,7 @@ ns_client_send(ns_client_t *client) { isc_boolean_t cleanup_cctx = ISC_FALSE; unsigned char sendbuf[SEND_BUFFER_SIZE]; unsigned int dnssec_opts; + unsigned int preferred_glue; REQUIRE(NS_CLIENT_VALID(client)); @@ -856,6 +857,13 @@ ns_client_send(ns_client_t *client) { else dnssec_opts = DNS_MESSAGERENDER_OMITDNSSEC; + if (client->view->preferred_glue == dns_rdatatype_a) + preferred_glue = DNS_MESSAGERENDER_PREFER_A; + else if (client->view->preferred_glue == dns_rdatatype_aaaa) + preferred_glue = DNS_MESSAGERENDER_PREFER_AAAA; + else + preferred_glue = 0; + /* * XXXRTH The following doesn't deal with TCP buffer resizing. */ @@ -911,7 +919,7 @@ ns_client_send(ns_client_t *client) { goto done; result = dns_message_rendersection(client->message, DNS_SECTION_ADDITIONAL, - dnssec_opts); + preferred_glue | dnssec_opts); if (result != ISC_R_SUCCESS && result != ISC_R_NOSPACE) goto done; renderend: diff --git a/bin/named/server.c b/bin/named/server.c index 36f7d5f3f6..5580ef7d86 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.373 2002/03/29 01:10:22 marka Exp $ */ +/* $Id: server.c,v 1.374 2002/04/26 00:40:24 marka Exp $ */ #include @@ -935,6 +935,19 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, if (view->maxncachettl > 7 * 24 * 3600) view->maxncachettl = 7 * 24 * 3600; + obj = NULL; + result = ns_config_get(maps, "preferred-glue", &obj); + if (result == ISC_R_SUCCESS) { + str = cfg_obj_asstring(obj); + if (strcasecmp(str, "a") == 0) + view->preferred_glue = dns_rdatatype_a; + else if (strcasecmp(str, "aaaa") == 0) + view->preferred_glue = dns_rdatatype_aaaa; + else + view->preferred_glue = 0; + } else + view->preferred_glue = 0; + result = ISC_R_SUCCESS; cleanup: diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index eaf2a47d74..456e318901 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -2,7 +2,7 @@ - + BIND 9 Administrator Reference Manual @@ -2901,6 +2901,7 @@ statement in the named.conf file: random-device path_name ; max-cache-size size_spec ; match-mapped-addresses yes_or_no; + preferred-glue ( A | AAAA | NONE ); }; @@ -3017,6 +3018,14 @@ the initial configuration load at server startup time and is ignored on subsequent reloads. +preferred-glue + +If specified the listed type (A or AAAA) will be emitted before other glue +in the additional section of a query response. +The default is not to preference any type (NONE). + + + diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 5bc5f4058e..2fa2c78c42 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check.c,v 1.32 2002/04/17 01:23:15 marka Exp $ */ +/* $Id: check.c,v 1.33 2002/04/26 00:40:28 marka Exp $ */ #include @@ -207,6 +207,18 @@ check_options(cfg_obj_t *options, isc_log_t *logctx) { result = ISC_R_RANGE; } } + obj = NULL; + (void)cfg_map_get(options, "preferred-glue", &obj); + if (obj != NULL) { + const char *str; + str = cfg_obj_asstring(obj); + if (strcasecmp(str, "a") != 0 && + strcasecmp(str, "aaaa") != 0 && + strcasecmp(str, "none") != 0) + cfg_obj_log(obj, logctx, ISC_LOG_ERROR, + "preferred-glue unexpected value '%s'", + str); + } return (result); } diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index 0b26f642fe..706d8dcb2f 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.h,v 1.109 2002/03/11 01:59:16 marka Exp $ */ +/* $Id: message.h,v 1.110 2002/04/26 00:40:34 marka Exp $ */ #ifndef DNS_MESSAGE_H #define DNS_MESSAGE_H 1 @@ -162,6 +162,10 @@ typedef int dns_messagetextflag_t; #define DNS_MESSAGERENDER_ORDERED 0x0001 /* don't change order */ #define DNS_MESSAGERENDER_PARTIAL 0x0002 /* allow a partial rdataset */ #define DNS_MESSAGERENDER_OMITDNSSEC 0x0004 /* omit DNSSEC records */ +#define DNS_MESSAGERENDER_PREFER_A 0x0008 /* prefer A records in + * additional section. */ +#define DNS_MESSAGERENDER_PREFER_AAAA 0x0010 /* prefer AAAA records in + * additional section. */ typedef struct dns_msgblock dns_msgblock_t; diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index 9b92440d11..e5d1e6b91e 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: view.h,v 1.77 2002/03/07 13:46:34 marka Exp $ */ +/* $Id: view.h,v 1.78 2002/04/26 00:40:35 marka Exp $ */ #ifndef DNS_VIEW_H #define DNS_VIEW_H 1 @@ -118,6 +118,7 @@ struct dns_view { dns_ttl_t maxncachettl; in_port_t dstport; dns_aclenv_t aclenv; + dns_rdatatype_t preferred_glue; /* * Configurable data for server use only, diff --git a/lib/dns/message.c b/lib/dns/message.c index 5878928af4..e208a8c2ab 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.211 2002/03/11 01:59:15 marka Exp $ */ +/* $Id: message.c,v 1.212 2002/04/26 00:40:30 marka Exp $ */ /*** *** Imports @@ -1697,7 +1697,7 @@ dns_message_renderreserve(dns_message_t *msg, unsigned int space) { } static inline isc_boolean_t -wrong_priority(dns_rdataset_t *rds, int pass) { +wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { int pass_needed; /* @@ -1710,7 +1710,10 @@ wrong_priority(dns_rdataset_t *rds, int pass) { case dns_rdatatype_a: case dns_rdatatype_aaaa: case dns_rdatatype_a6: - pass_needed = 3; + if (preferred_glue == rds->type) + pass_needed = 4; + else + pass_needed = 3; break; case dns_rdatatype_sig: case dns_rdatatype_key: @@ -1739,6 +1742,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, int pass; isc_boolean_t partial = ISC_FALSE; unsigned int rd_options; + dns_rdatatype_t preferred_glue = 0; REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(msg->buffer != NULL); @@ -1747,9 +1751,16 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, section = &msg->sections[sectionid]; if ((sectionid == DNS_SECTION_ADDITIONAL) - && (options & DNS_MESSAGERENDER_ORDERED) == 0) - pass = 3; - else + && (options & DNS_MESSAGERENDER_ORDERED) == 0) { + if ((options & DNS_MESSAGERENDER_PREFER_A) != 0) { + preferred_glue = dns_rdatatype_a; + pass = 4; + } else if ((options & DNS_MESSAGERENDER_PREFER_AAAA) != 0) { + preferred_glue = dns_rdatatype_aaaa; + pass = 4; + } else + pass = 3; + } else pass = 1; if ((options & DNS_MESSAGERENDER_OMITDNSSEC) == 0) @@ -1788,7 +1799,8 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, if (((options & DNS_MESSAGERENDER_ORDERED) == 0) && (sectionid == DNS_SECTION_ADDITIONAL) - && wrong_priority(rdataset, pass)) + && wrong_priority(rdataset, pass, + preferred_glue)) goto next; st = *(msg->buffer); diff --git a/lib/dns/view.c b/lib/dns/view.c index 7545b26bc7..4f2392f9d7 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: view.c,v 1.110 2002/03/07 13:46:33 marka Exp $ */ +/* $Id: view.c,v 1.111 2002/04/26 00:40:32 marka Exp $ */ #include @@ -160,6 +160,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->maxcachettl = 7 * 24 * 3600; view->maxncachettl = 3 * 3600; view->dstport = 53; + view->preferred_glue = 0; result = dns_order_create(view->mctx, &view->order); if (result != ISC_R_SUCCESS) diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 2a881dcbe9..4dcf7d6cdb 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: namedconf.c,v 1.5 2002/03/07 13:48:02 marka Exp $ */ +/* $Id: namedconf.c,v 1.6 2002/04/26 00:40:37 marka Exp $ */ #include @@ -553,6 +553,7 @@ view_clauses[] = { CFG_CLAUSEFLAG_MULTI | CFG_CLAUSEFLAG_NOTIMP }, { "cache-file", &cfg_type_qstring, 0 }, { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI }, + { "preferred-glue", &cfg_type_astring, 0 }, { NULL, NULL, 0 } };