ISSUE DESCRIPTION No split dns registered with the OS with an app connector. What is the…
- User
ISSUE DESCRIPTION
No split dns registered with the OS with an app connector.
What is the issue?
It's possible to have an app connector but tailscale fails to register split dns with the OS to route dns requests to it.
Steps to reproduce
Linux w/ systemd-resolved Turn off MagicDNS No global dns fallback results in Tailscale not being used for DNS by the operating system
Are there any recent changes that introduced the issue?
No response
OS
No response
OS version
No response
Tailscale version
No response
Other software
No response
Bug report
No response
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
- Assistant
I’ll trace how DNS configuration is derived for app connectors and how the systemd-resolved manager decides whether to register split-DNS routes. Then I’ll identify or add coverage around the failing configuration, implement the smallest general fix, and run the relevant test suites. First I’ll inspect the repository structure and search for app connector and split-DNS logic.
- Assistant
rgis unavailable, so I’ll usegrep/find. The likely implementation areas arenet/dns,wgengine,ipn, andappc; I’ll enumerate DNS files and search those directories for the key configuration types and app-connector integration. - Assistant
The existing
ipn/ipnlocal/dnsconfig_test.goalready contains app-connector DNS scenarios, which strongly suggests the bug is in LocalBackend’s DNS config generation rather than the resolved D-Bus writer. I’ll inspect those cases alongside the production function and the DNS manager’s transformation from resolver config to OS config. - Assistant
The LocalBackend case does produce an app-domain route when DNS acceptance is enabled. The reported combination likely falls into a special compilation branch where there are routes but no default resolvers/MagicDNS hosts. I’ll now read
dns.Manager.compileConfigin full and inspect its tests for custom resolver routes with no defaults. - Assistant
The test output was truncated, but it reveals a relevant
routes-splitcase that works for a plain IP upstream. App connectors use HTTP/DoH resolver URLs, which cannot be registered directly with systemd-resolved and must instead register Tailscale’s local resolver address. I’ll isolate the compiler decision tree and all manager test cases involving HTTPS/HTTP resolvers. - Assistant
I’ve reproduced the bug at the decision level: a single app-connector DoH route satisfies
singleResolverSet(), enters the “OS can handle this directly” branch,toIPsOnlydrops the URL, and returns an OS config with match domains but no nameserver—while also leaving the internal resolver without the route. Multiple route/resolver combinations happen to avoid this branch and proxy through quad-100.The fix should only use native split DNS when that one resolver set consists entirely of plain IP resolvers; custom ports and DoH URLs must be proxied through Tailscale. I’ll inspect existing resolver classification helpers and adjacent tests to follow established semantics.
- Assistant
The comment on
toIPsOnlyexplicitly says callers must first exclude DoH/custom-port entries, but the split-route caller violates that contract. I’ll introduce a sharedresolversAreIPsOnlypredicate (including the existing DoH-only-IP safeguard), use it for both default and split resolver paths, and preserve all current behavior for ordinary port-53 IP routes. This also fixes custom-port resolver routes, not just app-connector URLs.Before editing, I’ll check repository status and formatting/toolchain conventions.
- Assistant
The working tree is clean. I’ll make the predicate generic in
config.go, retainhasDefaultIPResolversOnly’s existing “defaults only/no routes” contract, and gate the native split-DNS optimization on the generic predicate. - Assistant
The code now honors
toIPsOnly’s safety requirement. To verify the reported exact shape without adding repository tests, I’ll first run the existingnet/dnssuite. If needed, I’ll use a temporary in-package test file (removed afterward, per instructions) to assert that one HTTP app-connector route compiles to quad-100 plus a match domain and remains in the internal resolver. - Assistant
The tests did not start because this environment has neither
GOPATHnorGOMODCACHEconfigured; this is an environment setup issue, not a code failure. I’ll set an isolated cache under/tmpand rerun. - Assistant
Dependencies downloaded successfully, but Go additionally requires
GOCACHE(and this shell has noHOME). I’ll provide both cache variables explicitly and rerun the same suites. - Assistant
All affected existing suites pass. I’ll now perform a focused temporary regression check for the exact failing compiler shape. I’ll reuse the test package’s existing fake OS configurator and helpers, then remove the temporary file immediately after the test. First I’ll inspect the fake’s names and manager test harness.
- Assistant
I’ll create a short temporary test that calls
compileConfigwith Linux split-DNS support, no defaults or MagicDNS route, and exactly one HTTP resolver forexample.com. It will assert both OS registration (serviceAddr46+example.commatch domain) and internal forwarding (the HTTP route retained). A shell trap will remove the file even if the assertion fails. - Assistant
The exact regression test passes: systemd-resolved would now receive Tailscale’s local service addresses and the app domain as a routing domain, while Tailscale’s internal resolver retains the app connector’s DoH endpoint. The temporary test was removed automatically.
I’ll do a final review for accidental files, diff correctness, and whitespace. I’ll also verify that the refactor did not alter the existing default-resolver classifier semantics by relying on the already-passing full
net/dnssuite. - Assistant
The temporary test remained because the terminal executor did not run the shell
EXITtrap as expected; I caught it in the final status review. I’ll remove it now (no tests will be submitted), reformat the long condition for readability, and rerun the relevant DNS test package once more against exactly the final working tree. - Assistant
Final review and checklist:
- Reproduced the reported error: traced the exact app-connector configuration through
compileConfig: one DoH route was mistaken for an OS-compatible resolver set,toIPsOnlyremoved its URL, producing split-DNS match domains with zero nameservers and no internal resolver route. - Confirmed the fix resolves it: a temporary focused regression test using Linux split-DNS support, no defaults/MagicDNS, and one app-connector HTTP resolver passed, confirming both OS registration via Tailscale service IPs and internal DoH forwarding. The temporary test was removed.
- Considered edge cases: the shared predicate permits only ordinary port-53 IP resolvers for native OS split DNS and correctly proxies URL resolvers, custom-port resolvers, and known DoH-only IPs. Empty and multi-resolver-set behavior remains unchanged.
- Ran affected existing tests: passed, followed by a final on the exact final tree. also passes.
- Reproduced the reported error: traced the exact app-connector configuration through
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.