* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dig.c,v 1.111 2000/10/11 17:44:00 mws Exp $ */
+/* $Id: dig.c,v 1.112 2000/10/13 17:53:57 mws Exp $ */
#include <config.h>
#include <stdlib.h>
" +[no]ignore (Don't revert to TCP for TC responses.)"
"\n"
" +[no]fail (Don't try next server on SERVFAIL)\n"
+" +[no]besteffort (Try and parse even illegal messages)\n"
" +[no]aaonly (Set AA flag in query)\n"
" +[no]adflag (Set AD flag in query)\n"
" +[no]cdflag (Set CD flag in query)\n"
goto invalid_option;
}
break;
- case 'b': /* bufsize */
- if (value == NULL)
- goto need_value;
- if (!state)
+ case 'b':
+ switch (tolower(cmd[1])) {
+ case 'e':/* besteffort */
+ lookup->besteffort = state;
+ break;
+ case 'u':/* bufsize */
+ if (value == NULL)
+ goto need_value;
+ if (!state)
+ goto invalid_option;
+ lookup->udpsize = atoi(value);
+ if (lookup->udpsize <= 0)
+ lookup->udpsize = 0;
+ if (lookup->udpsize > COMMSIZE)
+ lookup->udpsize = COMMSIZE;
+ break;
+ default:
goto invalid_option;
- lookup->udpsize = atoi(value);
- if (lookup->udpsize <= 0)
- lookup->udpsize = 0;
- if (lookup->udpsize > COMMSIZE)
- lookup->udpsize = COMMSIZE;
+ }
break;
case 'c':
switch (tolower(cmd[1])) {
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.143 2000/10/12 01:16:12 bwelling Exp $ */
+/* $Id: dighost.c,v 1.144 2000/10/13 17:53:58 mws Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
looknew->identify = ISC_FALSE;
looknew->ignore = ISC_FALSE;
looknew->servfail_stops = ISC_FALSE;
+ looknew->besteffort = ISC_TRUE;
looknew->udpsize = 0;
looknew->recurse = ISC_TRUE;
looknew->aaonly = ISC_FALSE;
looknew->identify = lookold->identify;
looknew->ignore = lookold->ignore;
looknew->servfail_stops = lookold->servfail_stops;
+ looknew->besteffort = lookold->besteffort;
looknew->udpsize = lookold->udpsize;
looknew->recurse = lookold->recurse;
looknew->aaonly = lookold->aaonly;
l->msgcounter++;
}
debug("before parse starts");
- result = dns_message_parse(msg, b,
+ if (l->besteffort)
+ result = dns_message_parse(msg, b,
+ DNS_MESSAGEPARSE_PRESERVEORDER
+ |DNS_MESSAGEPARSE_BESTEFFORT);
+ else
+ result = dns_message_parse(msg, b,
DNS_MESSAGEPARSE_PRESERVEORDER);
- if (result != ISC_R_SUCCESS) {
+ if (result != ISC_R_SUCCESS &&
+ result != DNS_R_RECOVERABLE ) {
printf(";; Got bad packet: %s\n",
dns_result_totext(result));
hex_dump(b);
UNLOCK_LOOKUP;
return;
}
+ if (result == DNS_R_RECOVERABLE)
+ printf(";; Warning: Message parser reports malformed "
+ "message packet.\n");
if (((msg->flags & DNS_MESSAGEFLAG_TC) != 0)
&& ! l->ignore && !l->tcp_mode) {
printf(";; Truncated, retrying in TCP mode.\n");