tailscale: fix preferred MagicDNS domain matching - #4400
Open
NagaseMinato wants to merge 220 commits into
Open
Conversation
`SecTrustEvaluateWithError` is serial
This reverts commit 62cb06c.
Recent Windows 11 builds remove TCP estats, which made writeAndWaitAck return without waiting for acknowledgment. sing now queries SIO_TCP_INFO on the socket instead, and falls back to estats on systems predating it (Windows 10 1703).
Batched darwin packet I/O now also covers connected sockets on iOS.
nekohasekai
force-pushed
the
testing
branch
4 times, most recently
from
August 9, 2026 06:58
9b20d01 to
426c5fa
Compare
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.
Background
A Tailscale endpoint may fail to match a MagicDNS FQDN in a route rule using
preferred_by.For example:
{ "endpoints": [ { "type": "tailscale", "tag": "ts-ep" } ], "inbounds": [ { "type": "mixed", "tag": "mixed-in", "listen": "127.0.0.1", "listen_port": 8080 } ], "route": { "rules": [ { "preferred_by": "ts-ep", "action": "route", "outbound": "ts-ep" } ] } }When accessing a MagicDNS host through the HTTP proxy:
the mixed inbound (also Socks, HTTP, Shadowsocks and etc.) passes the destination domain directly to route matching. No DNS resolution has occurred at this point, so the rule relies on
Endpoint.PreferredDomain.The existing implementation only checks
ExportMagicDNSHosts()whenMagicDNSHostsUnroutedis true. However, this flag indicates whether MagicDNS host records are covered by DNS routes, rather than whether a domain belongs to MagicDNS. It is false when MagicDNS domain routing is enabled, causing the valid host above to miss the route rule.The Tailscale DNS transport already handles this correctly. During DNS reconfiguration, it stores the result of
ExportMagicDNSHosts(). ItsPreferredDomainimplementation passes that registry tolookupHostswithout checkingMagicDNSHostsUnrouted.DNS rules using
preferred_bytherefore match the MagicDNS host, while route rules do not because they use the endpoint's separatePreferredDomainimplementation.