Bugzilla – Bug 157
a valid NSID EDNS0 option generates FORMERR on nsd-3.0.5
Last modified: 2008-01-15 13:37:00 CET
Created attachment 32 [details]
This patch will fix the FORMERR generation and accepts the NSID query.
Function edns_parse_record() in edns.c of nsd-3.0.5
always returns 1 as the return code with
edns->status = EDNS_ERROR (which generates FORMERR answer)
when it parses an EDNS0 OPT pseudo-RR other than
opt_version == 0 AND opt_rdlen == 0.
This part of if statement blocks the following if statement
of obtaining opt_nsid and edns->nsid when opt_rdlen >0,
even when the proper NSID data is set to the OPT pseudo-RR
RDATA part with the OPTION-CODE, OPTION-LENGTH and OPTION-DATA.
The attached patch fixes the blocking of opt_rdlen >0 if statement
by only returning EDNS_ERROR when opt_version != 0.
(opt_rdlen ins an unsigned integer so if it's not 0 it is always
I tested this patch on nsd-3.05 running on FreeBSD 6.2-RELEASE-p5,
with an i386 machine.
Thank you for the patch!
I have applied the patch to the upcoming release 3.0.8