Fall back to non-EDNS queries on FORMERR - #618
Conversation
Retry ordinary UDP and TCP queries without EDNS when a server returns FORMERR without an OPT record. Preserve EDNS when it is required by DNSSEC or explicit options. Fixes zmap#617
|
Not a maintainer. I was looking at how DNS measurement tools handle EDNS-intolerant servers and ended up reading this, so two notes that may save review time. The condition still reproduces, and it is wider than the one name in #617. Every Same for Two things in the diff I had to convince myself of:
The fallback spends a second rate-limiter token against that nameserver, which the tests assert. Only servers that answer FORMERR-without-OPT pay it, which for a scanner seems the right place for the cost to land. |
What
ZDNS always adds an EDNS OPT record to queries. Some authoritative servers return
FORMERRwhen EDNS is present but answer the same query normally without it.If we get
FORMERRwithout an OPT record in the response, retry the same nameserver without EDNS.There are a few guardrails:
FORMERRresponse contains OPT—the server understood EDNS in that case.This applies to UDP, TCP, DoT, and DoH, and leaves the existing UDP-to-TCP truncation behavior alone.
Testing
Added coverage for:
FORMERRresponses with and without OPT.FORMERRfollowed by a delayed successful response throughExternalLookup, verifying that both wire operations get a fullNetworkTimeout.Also ran:
go test ./...golangci-lint run ./...Fixes #617