Repository navigation
Conversation
… are set projectdiscovery#1541 meant to disable the syscall lookup fallback only when -r is given, but it also dropped the default `EnableFallback = true`. Without it, a lookup that only hits unreachable built-in resolvers (e.g. a VPN kill switch only allowing DNS to the system nameserver) fails with "no address found for host", randomly across runs. Move the fastdialer options into newFastdialerOptions and add a regression test for both the default and the -r behaviour. Fixes projectdiscovery#2558
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.
Proposed changes
Fixes #2558
httpx resolves through fastdialer with the system nameservers plus the built-in public resolvers (
1.1.1.1,1.0.0.1,8.8.8.8,8.8.4.4). When some of them are unreachable, for example a VPN kill switch that only allows DNS to the system nameserver (thewrite: operation not permittedin the issue), a lookup can spend all of its retries on blocked resolvers and fail withno address found for host. Retries round-robin over a counter shared by all concurrent lookups, so different hosts fail on every run.fastdialer has a system resolver fallback (
EnableFallback) for exactly this. httpx enabled it in 028b046, but #1541, which was meant to disable it only when-ris given, also removed the defaultEnableFallback = true. It has been off for everyone since v1.3.8.This PR:
EnableFallback = truewhen no custom resolvers are set (-rbehaviour is unchanged: custom resolvers only, no system resolvers, no fallback)newFastdialerOptionsso it can be unit testedTestNewFastdialerOptionscovering both cases, so this can't silently regress againNote: the bug only shows with explicit
https:///http://inputs. With bare hosts the scheme fallback retries the dial, which hides most DNS failures.Proof
Built the httpx binary with fastdialer's default
1.0.0.1,8.8.8.8and8.8.4.4replaced by closed local ports, which simulates the VPN blocking them (2 of 5 resolvers reachable, as in the issue). 30https://URLs, 5 runs each:no address found for host)dev-rbehaviour (same before and after):-r 127.0.0.1:1(dead resolver): 10/10 fail, no fallback to the system resolver-r 1.1.1.1: 10/10 probedCost: for input made only of non-existent hosts, the fallback adds one system lookup per host. Over 300 random NXDOMAIN subdomains it took ~15.9s vs ~14.1s on
dev. This is the same behaviour httpx had before v1.3.8.TestNewFastdialerOptionsfails ondevand passes with this change.go test ./..., integration tests,go build -raceandgolangci-lintall pass locally.Checklist
Summary by CodeRabbit