Bind bootstrap DNS lookups to -S source address (#1) #202
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.
Motivation:
PR #196 added the
-Sflag to bind HTTPS connections to a source address, enabling policy-based routing. However, bootstrap DNS queries (used to resolve DoH server hostnames like "dns.google") were not bound to the source address.This caused two issues:
Implementation:
ares_set_local_ip4()andares_set_local_ip6()from c-ares-4/-6), warn on mismatchExample Usage:
With PBR rules routing traffic from source 192.168.12.1 via VPN:
Both rules now match because
-Sbinds both HTTPS and bootstrap DNS to the same source address.Verification:
Bootstrap DNS bound to source address:
Warning on address family mismatch:
Warning on invalid address:
Files Modified:
src/dns_poller.c: Addedset_bootstrap_source_addr()functionsrc/dns_poller.h: Added source_addr parameter to poller initsrc/main.c: Pass source_addr to dns_pollersrc/options.c: Fix format string typetests/robot/functional_tests.robot: Source binding and validation teststests/docker/Dockerfile: Test image with valgrind and ctest integrationtests/docker/run_all_tests.sh: Simplified test runner using Dockerfile CMDCMakeLists.txt: Fix robot test WORKING_DIRECTORY, add distclean targetREADME.md: Update Docker test documentation.gitignore: Add build/ directory