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
Interface
No new interfaces are introduced.
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
Let me explore the repository structure to understand the codebase and find the relevant DNS-related code.
Assistant
Let me explore the repository structure first.
Assistant
Now let me look at the DNS manager to understand how OSConfig is built and how app connector domains are handled. The issue is that when there's an app connector but no global DNS fallback and MagicDNS is off, split DNS is not registered with the OS.
Let me look at the manager code that builds the OSConfig.
Assistant
Let me look at the
compileConfigfunction which was truncated.Assistant
Let me look at the Config type and its helper methods.
Assistant
Now let me understand how app connector domains get into the DNS config. Let me search for where the DNS config is built from the netmap.
Assistant
I can see the conn25 app connector routes use DoH resolvers. Let me check
peerAPIBaseandPickSplitDNSPeers.Assistant
Let me check what
dnstype.Resolver.IPPort()does for a DoH URL.Assistant
I've confirmed the bug. For conn25 app connector routes, the resolvers are DoH URLs like
http://100.x.x.x:port/dns-query. IncompileConfig, when all routes use the same resolver (single app connector), thesingleResolverSet()path is taken on Linux (systemd-resolved supports split DNS), buttoIPsOnly()returns an empty slice because DoH URLs aren't IP:53. This results in an OS config withMatchDomainsbut noNameservers— so no split DNS is registered.Let me look at the existing tests to understand conventions.
Assistant
Now I understand the bug clearly. Let me view the exact lines in
manager.goto make the fix.Assistant
Now let me look at the
config.gohelper section to add a shared helper.Assistant
Now I'll make the fix. First, add a shared helper in
config.goand refactorhasDefaultIPResolversOnlyto use it.Assistant
Now update the
compileConfigcondition inmanager.go:Assistant
Now let me verify the build compiles:
Assistant
Build succeeds. Now let me write a reproduction test to confirm the bug and the fix.
Assistant
Let me look at an existing test that uses compileConfig to understand how to set up a Manager for testing.
Assistant
Let me look at the test runner and the helper functions.
Assistant
Let me look at the test runner portion and the helper functions at the bottom of the file.
Assistant
Now I understand the test format. Let me create a temporary reproduction test to confirm the bug and verify my fix.
Assistant
The fix works. Now let me confirm that without the fix, the test would fail. Let me temporarily revert the manager.go change to verify the bug reproduces.
Assistant
Confirmed: without the fix, the OS config gets empty Nameservers (no split DNS registered), and the resolver has no routes. With the fix, it correctly routes through quad-100. Now let me remove the temp test file and run the existing test suite.
Assistant
All existing
TestManagertests pass. Let me run the full net/dns test suite to make sure nothing else broke.Assistant
Let me also run the ipnlocal DNS config tests since they relate to how the DNS config is built.
Assistant
All tests pass. Let me review the final diff to make sure it's clean.
Assistant
The diff looks clean. Let me run
go vetandgo buildto be thorough.Assistant
Let me also run the
appcpackage tests since app connectors are involved.Assistant
All tests pass. Let me do a final review of the changes and verify the temp test file is removed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.