fix(gateway): keep DoH-confirmed Telegram IPs that match system DNS (salvage #17043)#20175
Merged
Conversation
…14520) discover_fallback_ips() filtered out any DoH-resolved IP that also appeared in the system resolver's answer set, on the assumption that the system IP was unreachable. When DoH and system DNS agreed (a common case), the function returned the hardcoded _SEED_FALLBACK_IPS list instead — and on networks where those seed addresses are not routable, the Telegram fallback transport had nothing usable to retry against and polling failed. Drop the system_ips exclusion so DoH-confirmed IPs are preserved regardless of system DNS overlap. The TelegramFallbackTransport already tries the primary path first via system DNS, then falls through to the IP-rewrite path on connect failure; including the same IP in both lanes lets a transient primary failure recover via the explicit IP route instead of escalating to seed addresses. Update the two tests that codified the old exclusion to reflect the new, inclusion-by-default behaviour. Fixes #14520
1 task
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.
Salvages @0xsir0000's PR #17043 onto current main. Fixes #14520.
What it does
discover_fallback_ips()excluded any DoH-resolved IP that also appeared in the system resolver's answer set, on the assumption that the system IP was unreachable. When DoH and system DNS agreed (common case), the function returned the hardcoded_SEED_FALLBACK_IPSinstead — and on networks where those seeds aren't routable, the Telegram fallback transport had nothing usable.Changes
gateway/platforms/telegram_network.py— drop thesystem_ipsexclusion. DoH-confirmed IPs are preserved regardless of system-DNS overlap; a transient primary-path failure now retries against the same IP via the rewrite path before escalating to seeds.tests/gateway/test_telegram_network.py— updated two tests that codified the old exclusion.Validation
tests/gateway/test_telegram_network.py— 46 passed locally.Closes #17043 via salvage.