diff options
| author | Nick Khyl <nickk@tailscale.com> | 2024-05-02 18:33:13 -0500 |
|---|---|---|
| committer | Nick Khyl <1761190+nickkhyl@users.noreply.github.com> | 2024-05-06 17:29:24 -0500 |
| commit | f62e678df8e1d4a3fd3a41f8c847c6b0a3605ac8 (patch) | |
| tree | 3750d7068f3f85a3142b82e29eae0c5142b115c3 /control/controlknobs/controlknobs.go | |
| parent | c28f5767bfbc2ef037a41ee7cc13e9bff6a81713 (diff) | |
| download | tailscale-f62e678df8e1d4a3fd3a41f8c847c6b0a3605ac8.tar.xz tailscale-f62e678df8e1d4a3fd3a41f8c847c6b0a3605ac8.zip | |
net/dns/resolver, control/controlknobs, tailcfg: use UserDial instead of SystemDial to dial DNS servers
Now that tsdial.Dialer.UserDial has been updated to honor the configured routes
and dial external network addresses without going through Tailscale, while also being
able to dial a node/subnet router on the tailnet, we can start using UserDial to forward
DNS requests. This is primarily needed for DNS over TCP when forwarding requests
to internal DNS servers, but we also update getKnownDoHClientForProvider to use it.
Updates tailscale/corp#18725
Signed-off-by: Nick Khyl <nickk@tailscale.com>
Diffstat (limited to 'control/controlknobs/controlknobs.go')
| -rw-r--r-- | control/controlknobs/controlknobs.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/control/controlknobs/controlknobs.go b/control/controlknobs/controlknobs.go index 2f80ba38c..0b86c2d3b 100644 --- a/control/controlknobs/controlknobs.go +++ b/control/controlknobs/controlknobs.go @@ -76,6 +76,11 @@ type Knobs struct { // AppCStoreRoutes is whether the node should store RouteInfo to StateStore // if it's an app connector. AppCStoreRoutes atomic.Bool + + // UserDialUseRoutes is whether tsdial.Dialer.UserDial should use routes to determine + // how to dial the destination address. When true, it also makes the DNS forwarder + // use UserDial instead of SystemDial when dialing resolvers. + UserDialUseRoutes atomic.Bool } // UpdateFromNodeAttributes updates k (if non-nil) based on the provided self @@ -101,6 +106,7 @@ func (k *Knobs) UpdateFromNodeAttributes(capMap tailcfg.NodeCapMap) { seamlessKeyRenewal = has(tailcfg.NodeAttrSeamlessKeyRenewal) probeUDPLifetime = has(tailcfg.NodeAttrProbeUDPLifetime) appCStoreRoutes = has(tailcfg.NodeAttrStoreAppCRoutes) + userDialUseRoutes = has(tailcfg.NodeAttrUserDialUseRoutes) ) if has(tailcfg.NodeAttrOneCGNATEnable) { @@ -124,6 +130,7 @@ func (k *Knobs) UpdateFromNodeAttributes(capMap tailcfg.NodeCapMap) { k.SeamlessKeyRenewal.Store(seamlessKeyRenewal) k.ProbeUDPLifetime.Store(probeUDPLifetime) k.AppCStoreRoutes.Store(appCStoreRoutes) + k.UserDialUseRoutes.Store(userDialUseRoutes) } // AsDebugJSON returns k as something that can be marshalled with json.Marshal @@ -148,5 +155,6 @@ func (k *Knobs) AsDebugJSON() map[string]any { "SeamlessKeyRenewal": k.SeamlessKeyRenewal.Load(), "ProbeUDPLifetime": k.ProbeUDPLifetime.Load(), "AppCStoreRoutes": k.AppCStoreRoutes.Load(), + "UserDialUseRoutes": k.UserDialUseRoutes.Load(), } } |
