diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-02-23 08:55:44 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-02-23 08:55:44 +0000 |
commit | a9fc29a953200ab9afa1cb2fb0ba130fd3c48543 (patch) | |
tree | 03b6ca85dc8e659821e07273425c6c439ea78c58 /usr.bin/dig/lib | |
parent | 248e6ff9e6e667b383c2bbb6c58c9a52fd954a9e (diff) |
We are not passing options to the message renderer.
OK millert
Diffstat (limited to 'usr.bin/dig/lib')
-rw-r--r-- | usr.bin/dig/lib/dns/include/dns/message.h | 12 | ||||
-rw-r--r-- | usr.bin/dig/lib/dns/message.c | 37 |
2 files changed, 11 insertions, 38 deletions
diff --git a/usr.bin/dig/lib/dns/include/dns/message.h b/usr.bin/dig/lib/dns/include/dns/message.h index f0ae27ff6b2..8625a865daa 100644 --- a/usr.bin/dig/lib/dns/include/dns/message.h +++ b/usr.bin/dig/lib/dns/include/dns/message.h @@ -164,15 +164,6 @@ typedef int dns_messagetextflag_t; #define DNS_MESSAGEPARSE_IGNORETRUNCATION 0x0008 /*%< truncation errors are * not fatal. */ -/* - * Control behavior of rendering - */ -#define DNS_MESSAGERENDER_ORDERED 0x0001 /*%< don't change order */ -#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; struct dns_message { @@ -449,8 +440,7 @@ dns_message_renderrelease(dns_message_t *msg, unsigned int space); */ isc_result_t -dns_message_rendersection(dns_message_t *msg, dns_section_t section, - unsigned int options); +dns_message_rendersection(dns_message_t *msg, dns_section_t section); /*%< * Render all names, rdatalists, etc from the given section at the * specified priority or higher. diff --git a/usr.bin/dig/lib/dns/message.c b/usr.bin/dig/lib/dns/message.c index 240f7e1aeb4..d766c712d36 100644 --- a/usr.bin/dig/lib/dns/message.c +++ b/usr.bin/dig/lib/dns/message.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.9 2020/02/23 08:54:33 florian Exp $ */ +/* $Id: message.c,v 1.10 2020/02/23 08:55:43 florian Exp $ */ /*! \file */ @@ -1704,7 +1704,7 @@ dns_message_renderreserve(dns_message_t *msg, unsigned int space) { } static inline isc_boolean_t -wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { +wrong_priority(dns_rdataset_t *rds, int pass) { int pass_needed; /* @@ -1716,10 +1716,7 @@ wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { switch (rds->type) { case dns_rdatatype_a: case dns_rdatatype_aaaa: - if (preferred_glue == rds->type) - pass_needed = 4; - else - pass_needed = 3; + pass_needed = 3; break; case dns_rdatatype_rrsig: case dns_rdatatype_dnskey: @@ -1766,8 +1763,7 @@ maybe_clear_ad(dns_message_t *msg, dns_section_t sectionid) { } isc_result_t -dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, - unsigned int options) +dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid) { dns_namelist_t *section; dns_name_t *name, *next_name; @@ -1776,24 +1772,15 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, isc_result_t result; isc_buffer_t st; /* for rollbacks */ int pass; - dns_rdatatype_t preferred_glue = 0; REQUIRE(msg->buffer != NULL); REQUIRE(VALID_NAMED_SECTION(sectionid)); section = &msg->sections[sectionid]; - if ((sectionid == DNS_SECTION_ADDITIONAL) - && (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 + if (sectionid == DNS_SECTION_ADDITIONAL) + pass = 3; + else pass = 1; /* @@ -1859,11 +1846,8 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, DNS_RDATASETATTR_RENDERED) != 0) goto next; - if (((options & DNS_MESSAGERENDER_ORDERED) - == 0) - && (sectionid == DNS_SECTION_ADDITIONAL) - && wrong_priority(rdataset, pass, - preferred_glue)) + if ((sectionid == DNS_SECTION_ADDITIONAL) + && wrong_priority(rdataset, pass)) goto next; st = *(msg->buffer); @@ -1991,8 +1975,7 @@ dns_message_renderend(dns_message_t *msg) { isc_buffer_clear(msg->buffer); isc_buffer_add(msg->buffer, DNS_MESSAGE_HEADERLEN); dns_compress_rollback(msg->cctx, 0); - result = dns_message_rendersection(msg, DNS_SECTION_QUESTION, - 0); + result = dns_message_rendersection(msg, DNS_SECTION_QUESTION); if (result != ISC_R_SUCCESS && result != ISC_R_NOSPACE) return (result); } |