Commit c4a9ce44 authored by Mark Andrews's avatar Mark Andrews
Browse files

1274. [func] preferred-glue option from BIND 8.3.

parent a04a323f
1274. [func] preferred-glue option from BIND 8.3.
1273. [bug] The dnssec system test failed to remove the correct
files.
......
......@@ -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 <config.h>
......@@ -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:
......
......@@ -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 <config.h>
......@@ -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:
......
......@@ -2,7 +2,7 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
<!-- File: $Id: Bv9ARM-book.xml,v 1.197 2002/04/22 03:56:33 marka Exp $ -->
<!-- File: $Id: Bv9ARM-book.xml,v 1.198 2002/04/26 00:40:26 marka Exp $ -->
<book>
<title>BIND 9 Administrator Reference Manual</title>
......@@ -2901,6 +2901,7 @@ statement in the <filename>named.conf</filename> file:</para>
<optional> random-device <replaceable>path_name</replaceable> ; </optional>
<optional> max-cache-size <replaceable>size_spec</replaceable> ; </optional>
<optional> match-mapped-addresses <replaceable>yes_or_no</replaceable>; </optional>
<optional> preferred-glue ( <replaceable>A</replaceable> | <replaceable>AAAA</replaceable> | <replaceable>NONE</replaceable> ); </optional>
};
</programlisting>
</sect2>
......@@ -3017,6 +3018,14 @@ the initial configuration load at server startup time and
is ignored on subsequent reloads.</para>
</listitem></varlistentry>
<varlistentry><term><command>preferred-glue</command></term>
<listitem><para>
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).
</para>
</listitem></varlistentry>
</variablelist>
......
......@@ -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 <config.h>
......@@ -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);
}
......
......@@ -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;
......
......@@ -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,
......
......@@ -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);
......
......@@ -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 <config.h>
......@@ -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)
......
......@@ -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 <config.h>
......@@ -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 }
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment