8 November 2010: Wouter
- release tag 1.4.7.
- trunk is version 1.4.8.
+ - Be lenient and accept imgw.pl malformed packet (like BIND).
5 November 2010: Wouter
- do not synthesize a CNAME message from cache for qtype DS.
/** verbose message parse unit test */
static int vbmp = 0;
+/** do not accept formerr */
+static int check_formerr_gone = 0;
/** if matching within a section should disregard the order of RRs. */
static int matches_nolocation = 0;
/** see if RRSIGs are properly matched to RRsets. */
if(ret != 0) {
if(vbmp) printf("parse code %d: %s\n", ret,
ldns_lookup_by_id(ldns_rcodes, ret)->name);
- if(ret == LDNS_RCODE_FORMERR)
+ if(ret == LDNS_RCODE_FORMERR) {
+ unit_assert(!check_formerr_gone);
checkformerr(pkt);
+ }
unit_assert(ret != LDNS_RCODE_SERVFAIL);
- } else {
+ } else if(!check_formerr_gone) {
const size_t lim = 512;
ret = reply_info_encode(&qi, rep, id, flags, out, timenow,
region, 65535, (int)(edns.bits & EDNS_DO) );
check_rrsigs = 0;
matches_nolocation = 0;
+ check_formerr_gone = 1;
+ testfromdrillfile(pkt, &alloc, out, "testdata/test_packets.8");
+ check_formerr_gone = 0;
+
/* cleanup */
alloc_clear(&alloc);
alloc_clear(&super_a);
--- /dev/null
+; Test that FORMERR no longer happens.
+;-- next packet --
+; bad packet, had arcount=1 but EDNS record is missing.
+; from imgw.pl. BIND accepts it (but dig notes 'it is malformed').
+; therefore we leniently accept this.
+; header
+75D684100001000200000001
+; qd section
+04696D677702706C0000010001
+; answer section
+04696D677702706C000001000100000E100004C3BB560E
+04696D677702706C000001000100000E100004C3BB560D
+
if((ret = parse_section(pkt, msg, region, LDNS_SECTION_AUTHORITY,
msg->nscount, &msg->ns_rrsets)) != 0)
return ret;
- if((ret = parse_section(pkt, msg, region, LDNS_SECTION_ADDITIONAL,
- msg->arcount, &msg->ar_rrsets)) != 0)
+ if(ldns_buffer_remaining(pkt) == 0 && msg->arcount == 1) {
+ /* BIND accepts leniently that an EDNS record is missing.
+ * so, we do too. */
+ } else if((ret = parse_section(pkt, msg, region,
+ LDNS_SECTION_ADDITIONAL, msg->arcount, &msg->ar_rrsets)) != 0)
return ret;
/* if(ldns_buffer_remaining(pkt) > 0) { */
/* there is spurious data at end of packet. ignore */