Bug 157 - a valid NSID EDNS0 option generates FORMERR on nsd-3.0.5
a valid NSID EDNS0 option generates FORMERR on nsd-3.0.5
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
3.0.x
i386 FreeBSD
: P2 normal
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-27 09:48 CEST by Kenji Rikitake
Modified: 2008-01-15 13:37 CET (History)
2 users (show)

See Also:


Attachments
This patch will fix the FORMERR generation and accepts the NSID query. (1.09 KB, patch)
2007-07-27 09:48 CEST, Kenji Rikitake
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenji Rikitake 2007-07-27 09:48:03 CEST
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
positive.)

I tested this patch on nsd-3.05 running on FreeBSD 6.2-RELEASE-p5,
with an i386 machine.
Comment 1 Matthijs Mekking 2008-01-10 14:12:02 CET
Thank you for the patch!
Comment 2 Matthijs Mekking 2008-01-15 13:37:00 CET
I have applied the patch to the upcoming release 3.0.8