* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.238 2001/11/30 01:58:39 gson Exp $ */
+/* $Id: dighost.c,v 1.239 2002/02/12 02:10:30 marka Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
debug("before parse starts");
parseflags = DNS_MESSAGEPARSE_PRESERVEORDER;
- if (l->besteffort)
+ if (l->besteffort) {
parseflags |= DNS_MESSAGEPARSE_BESTEFFORT;
+ parseflags |= DNS_MESSAGEPARSE_IGNORETRUNCATION;
+ }
result = dns_message_parse(msg, b, parseflags);
if (result == DNS_R_RECOVERABLE) {
printf(";; Warning: Message parser reports malformed "
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.h,v 1.106 2002/01/22 09:07:26 bwelling Exp $ */
+/* $Id: message.h,v 1.107 2002/02/12 02:10:33 marka Exp $ */
#ifndef DNS_MESSAGE_H
#define DNS_MESSAGE_H 1
occurs */
#define DNS_MESSAGEPARSE_CLONEBUFFER 0x0004 /* save a copy of the
source buffer */
+#define DNS_MESSAGEPARSE_IGNORETRUNCATION 0x0008 /* trucation errors are
+ * not fatal. */
/*
* Control behavior of rendering
* not be considered FORMERRs. If the entire message can be parsed, it
* will be returned and DNS_R_RECOVERABLE will be returned.
*
+ * If DNS_MESSAGEPARSE_IGNORETRUNCATION is set then return as many complete
+ * RR's as possible, DNS_R_RECOVERABLE will be returned.
+ *
* OPT and TSIG records are always handled specially, regardless of the
* 'preserve_order' setting.
*
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.c,v 1.206 2002/02/11 02:03:23 marka Exp $ */
+/* $Id: message.c,v 1.207 2002/02/12 02:10:32 marka Exp $ */
/***
*** Imports
isc_boolean_t free_name;
isc_boolean_t best_effort;
isc_boolean_t seen_problem;
- isc_buffer_t save = *source;
section = &msg->sections[DNS_SECTION_QUESTION];
rdatalist = NULL;
for (count = 0; count < msg->counts[DNS_SECTION_QUESTION]; count++) {
- save = *source;
name = isc_mempool_get(msg->namepool);
if (name == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
cleanup:
- if (result == ISC_R_UNEXPECTEDEND && best_effort) {
- *source = save;
- result = DNS_R_RECOVERABLE;
- }
if (rdataset != NULL) {
INSIST(!dns_rdataset_isassociated(rdataset));
isc_mempool_put(msg->rdspool, rdataset);
isc_boolean_t free_name, free_rdataset;
isc_boolean_t preserve_order, best_effort, seen_problem;
isc_boolean_t issigzero;
- isc_buffer_t save = *source;
preserve_order = ISC_TF(options & DNS_MESSAGEPARSE_PRESERVEORDER);
best_effort = ISC_TF(options & DNS_MESSAGEPARSE_BESTEFFORT);
skip_type_search = ISC_FALSE;
free_name = ISC_FALSE;
free_rdataset = ISC_FALSE;
- save = *source;
name = isc_mempool_get(msg->namepool);
if (name == NULL)
return (ISC_R_SUCCESS);
cleanup:
- if (result == ISC_R_UNEXPECTEDEND && best_effort) {
- *source = save;
- result = DNS_R_RECOVERABLE;
- }
if (free_name)
isc_mempool_put(msg->namepool, name);
if (free_rdataset)
isc_uint16_t tmpflags;
isc_buffer_t origsource;
isc_boolean_t seen_problem;
+ isc_boolean_t ignore_tc;
REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(source != NULL);
REQUIRE(msg->from_to_wire == DNS_MESSAGE_INTENTPARSE);
seen_problem = ISC_FALSE;
+ ignore_tc = ISC_TF(options & DNS_MESSAGEPARSE_IGNORETRUNCATION);
origsource = *source;
dns_decompress_setmethods(&dctx, DNS_COMPRESS_GLOBAL14);
ret = getquestions(source, msg, &dctx, options);
+ if (ret == ISC_R_UNEXPECTEDEND && ignore_tc)
+ goto truncated;
if (ret == DNS_R_RECOVERABLE) {
seen_problem = ISC_TRUE;
ret = ISC_R_SUCCESS;
msg->question_ok = 1;
ret = getsection(source, msg, &dctx, DNS_SECTION_ANSWER, options);
+ if (ret == ISC_R_UNEXPECTEDEND && ignore_tc)
+ goto truncated;
if (ret == DNS_R_RECOVERABLE) {
seen_problem = ISC_TRUE;
ret = ISC_R_SUCCESS;
return (ret);
ret = getsection(source, msg, &dctx, DNS_SECTION_AUTHORITY, options);
+ if (ret == ISC_R_UNEXPECTEDEND && ignore_tc)
+ goto truncated;
if (ret == DNS_R_RECOVERABLE) {
seen_problem = ISC_TRUE;
ret = ISC_R_SUCCESS;
return (ret);
ret = getsection(source, msg, &dctx, DNS_SECTION_ADDITIONAL, options);
+ if (ret == ISC_R_UNEXPECTEDEND && ignore_tc)
+ goto truncated;
if (ret == DNS_R_RECOVERABLE) {
seen_problem = ISC_TRUE;
ret = ISC_R_SUCCESS;
r.length);
}
+ truncated:
if ((options & DNS_MESSAGEPARSE_CLONEBUFFER) == 0)
isc_buffer_usedregion(&origsource, &msg->saved);
else {
msg->free_saved = 1;
}
+ if (ret == ISC_R_UNEXPECTEDEND && ignore_tc)
+ return (DNS_R_RECOVERABLE);
if (seen_problem == ISC_TRUE)
return (DNS_R_RECOVERABLE);
return (ISC_R_SUCCESS);