diff options
-rw-r--r-- | usr.bin/dig/lib/dns/include/dns/message.h | 1 | ||||
-rw-r--r-- | usr.bin/dig/lib/dns/include/dns/rdataset.h | 29 | ||||
-rw-r--r-- | usr.bin/dig/lib/dns/message.c | 75 | ||||
-rw-r--r-- | usr.bin/dig/lib/dns/rdataset.c | 23 |
4 files changed, 20 insertions, 108 deletions
diff --git a/usr.bin/dig/lib/dns/include/dns/message.h b/usr.bin/dig/lib/dns/include/dns/message.h index 834c97a3b7d..f0ae27ff6b2 100644 --- a/usr.bin/dig/lib/dns/include/dns/message.h +++ b/usr.bin/dig/lib/dns/include/dns/message.h @@ -168,7 +168,6 @@ typedef int dns_messagetextflag_t; * Control behavior of rendering */ #define DNS_MESSAGERENDER_ORDERED 0x0001 /*%< don't change order */ -#define DNS_MESSAGERENDER_PARTIAL 0x0002 /*%< allow a partial rdataset */ #define DNS_MESSAGERENDER_PREFER_A 0x0008 /*%< prefer A records in additional section. */ #define DNS_MESSAGERENDER_PREFER_AAAA 0x0010 /*%< prefer AAAA records in diff --git a/usr.bin/dig/lib/dns/include/dns/rdataset.h b/usr.bin/dig/lib/dns/include/dns/rdataset.h index 74f65209970..3461a3e33a8 100644 --- a/usr.bin/dig/lib/dns/include/dns/rdataset.h +++ b/usr.bin/dig/lib/dns/include/dns/rdataset.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataset.h,v 1.6 2020/02/22 19:50:05 jung Exp $ */ +/* $Id: rdataset.h,v 1.7 2020/02/23 08:54:33 florian Exp $ */ #ifndef DNS_RDATASET_H #define DNS_RDATASET_H 1 @@ -404,31 +404,4 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset, * that order_arg is NULL if and only if order is NULL. */ -isc_result_t -dns_rdataset_towirepartial(dns_rdataset_t *rdataset, - const dns_name_t *owner_name, - dns_compress_t *cctx, - isc_buffer_t *target, - dns_rdatasetorderfunc_t order, - const void *order_arg, - unsigned int *countp, - void **state); -/*%< - * Like dns_rdataset_towiresorted() except that a partial rdataset - * may be written. - * - * Requires: - *\li All the requirements of dns_rdataset_towiresorted(). - * If 'state' is non NULL then the current position in the - * rdataset will be remembered if the rdataset in not - * completely written and should be passed on on subsequent - * calls (NOT CURRENTLY IMPLEMENTED). - * - * Returns: - *\li #ISC_R_SUCCESS if all of the records were written. - *\li #ISC_R_NOSPACE if unable to fit in all of the records. *countp - * will be updated to reflect the number of records - * written. - */ - #endif /* DNS_RDATASET_H */ diff --git a/usr.bin/dig/lib/dns/message.c b/usr.bin/dig/lib/dns/message.c index fa7744678cd..240f7e1aeb4 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.8 2020/02/22 19:50:05 jung Exp $ */ +/* $Id: message.c,v 1.9 2020/02/23 08:54:33 florian Exp $ */ /*! \file */ @@ -1776,7 +1776,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, isc_result_t result; isc_buffer_t st; /* for rollbacks */ int pass; - isc_boolean_t partial = ISC_FALSE; dns_rdatatype_t preferred_glue = 0; REQUIRE(msg->buffer != NULL); @@ -1805,8 +1804,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, msg->buffer->length -= msg->reserved; total = 0; - if (msg->reserved == 0 && (options & DNS_MESSAGERENDER_PARTIAL) != 0) - partial = ISC_TRUE; /* * Render required glue first. Set TC if it won't fit. @@ -1820,30 +1817,14 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, const void *order_arg = msg->order_arg; st = *(msg->buffer); count = 0; - if (partial) - result = dns_rdataset_towirepartial(rdataset, - name, - msg->cctx, - msg->buffer, - msg->order, - order_arg, - &count, - NULL); - else - result = dns_rdataset_towiresorted(rdataset, - name, - msg->cctx, - msg->buffer, - msg->order, - order_arg, - &count); + result = dns_rdataset_towiresorted(rdataset, + name, + msg->cctx, + msg->buffer, + msg->order, + order_arg, + &count); total += count; - if (partial && result == ISC_R_NOSPACE) { - msg->flags |= DNS_MESSAGEFLAG_TC; - msg->buffer->length += msg->reserved; - msg->counts[sectionid] += total; - return (result); - } if (result == ISC_R_NOSPACE) msg->flags |= DNS_MESSAGEFLAG_TC; if (result != ISC_R_SUCCESS) { @@ -1888,25 +1869,14 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, st = *(msg->buffer); count = 0; - if (partial) - result = dns_rdataset_towirepartial( - rdataset, - name, - msg->cctx, - msg->buffer, - msg->order, - msg->order_arg, - &count, - NULL); - else - result = dns_rdataset_towiresorted( - rdataset, - name, - msg->cctx, - msg->buffer, - msg->order, - msg->order_arg, - &count); + result = dns_rdataset_towiresorted( + rdataset, + name, + msg->cctx, + msg->buffer, + msg->order, + msg->order_arg, + &count); total += count; @@ -1914,20 +1884,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, * If out of space, record stats on what we * rendered so far, and return that status. * - * XXXMLG Need to change this when - * dns_rdataset_towire() can render partial - * sets starting at some arbitrary point in the - * set. This will include setting a bit in the - * rdataset to indicate that a partial - * rendering was done, and some state saved - * somewhere (probably in the message struct) - * to indicate where to continue from. */ - if (partial && result == ISC_R_NOSPACE) { - msg->buffer->length += msg->reserved; - msg->counts[sectionid] += total; - return (result); - } if (result != ISC_R_SUCCESS) { INSIST(st.used < 65536); dns_compress_rollback(msg->cctx, diff --git a/usr.bin/dig/lib/dns/rdataset.c b/usr.bin/dig/lib/dns/rdataset.c index fdb1fc24d15..a59b35028e2 100644 --- a/usr.bin/dig/lib/dns/rdataset.c +++ b/usr.bin/dig/lib/dns/rdataset.c @@ -240,7 +240,7 @@ static isc_result_t towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, const void *order_arg, - isc_boolean_t partial, unsigned int *countp, void **state) + isc_boolean_t partial, unsigned int *countp) { dns_rdata_t rdata = DNS_RDATA_INIT; isc_region_t r; @@ -253,8 +253,6 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_rdata_t *in = NULL, in_fixed[MAX_SHUFFLE]; struct towire_sort *out = NULL, out_fixed[MAX_SHUFFLE]; - UNUSED(state); - /* * Convert 'rdataset' to wire format, compressing names as specified * in cctx, and storing the result in 'target'. @@ -476,22 +474,7 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset, unsigned int *countp) { return (towiresorted(rdataset, owner_name, cctx, target, - order, order_arg, ISC_FALSE, countp, NULL)); -} - -isc_result_t -dns_rdataset_towirepartial(dns_rdataset_t *rdataset, - const dns_name_t *owner_name, - dns_compress_t *cctx, - isc_buffer_t *target, - dns_rdatasetorderfunc_t order, - const void *order_arg, - unsigned int *countp, - void **state) -{ - REQUIRE(state == NULL); /* XXX remove when implemented */ - return (towiresorted(rdataset, owner_name, cctx, target, - order, order_arg, ISC_TRUE, countp, state)); + order, order_arg, ISC_FALSE, countp)); } isc_result_t @@ -502,5 +485,5 @@ dns_rdataset_towire(dns_rdataset_t *rdataset, unsigned int *countp) { return (towiresorted(rdataset, owner_name, cctx, target, - NULL, NULL, ISC_FALSE, countp, NULL)); + NULL, NULL, ISC_FALSE, countp)); } |