Repository navigation
Resolv: continue the search list on NODATA replies - #162
Open
TheRealAlexxx wants to merge 1 commit into
Open
TheRealAlexxx wants to merge 1 commit into
TheRealAlexxx wants to merge 1 commit into
Conversation
Fixes [Bug #18842]. When a name is resolved through the search list, `Resolv::DNS#fetch_resource` stops at the first candidate whose reply has rcode NoError, even when the answer section is empty (a NODATA reply: the name exists, but has no records of the requested type). The remaining search domains, and the name as given, are never tried, so `getaddress`/`getresources` report no information even though a later search domain holds the record. NXDomain replies already continue to the next candidate via `Config#resolv`. This change treats NODATA the same way: a NoError reply with an empty answer section raises a new `Config::NODATA`, which `Config#resolv` rescues alongside `NXDomain` before moving on to the next candidate. A NODATA reply for the final candidate is swallowed as before, so the all-NODATA outcome is unchanged. The new test runs a stub DNS server that answers NODATA for the first two search-list candidates and an A record for the third; `getaddress` now returns the third candidate's address instead of raising `ResolvError`.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolv: continue the search list on NODATA replies
Fixes [Bug #18842].
When a name is resolved through the search list,
Resolv::DNS#fetch_resourcestops at the first candidate whose reply has rcode NoError, even when the answer section is empty (a NODATA reply: the name exists, but has no records of the requested type). The remaining search domains, and the name as given, are never tried, sogetaddress/getresourcesreport no information even though a later search domain holds the record.NXDomain replies already continue to the next candidate via
Config#resolv. This change treats NODATA the same way: a NoError reply with an empty answer section raises a newConfig::NODATA, whichConfig#resolvrescues alongsideNXDomainbefore moving on to the next candidate. A NODATA reply for the final candidate is swallowed as before, so the all-NODATA outcome is unchanged.The new test runs a stub DNS server that answers NODATA for the first two search-list candidates and an A record for the third;
getaddressnow returns the third candidate's address instead of raisingResolvError.