diff options
| author | Andrew Dunham <andrew@du.nham.ca> | 2023-09-07 16:27:50 -0400 |
|---|---|---|
| committer | Andrew Dunham <andrew@du.nham.ca> | 2023-09-25 16:42:07 -0400 |
| commit | 530aaa52f1ff8942467768a67711e222e7911680 (patch) | |
| tree | 2c10c664510f3adb0f1b4efbe8b85b01323914f8 /control/controlknobs | |
| parent | 098d1107462f04d1047d590a82a4c0c00e9b5526 (diff) | |
| download | tailscale-530aaa52f1ff8942467768a67711e222e7911680.tar.xz tailscale-530aaa52f1ff8942467768a67711e222e7911680.zip | |
net/dns: retry forwarder requests over TCP
We weren't correctly retrying truncated requests to an upstream DNS
server with TCP. Instead, we'd return a truncated request to the user,
even if the user was querying us over TCP and thus able to handle a
large response.
Also, add an envknob and controlknob to allow users/us to disable this
behaviour if it turns out to be buggy (✨ DNS ✨).
Updates #9264
Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ifb04b563839a9614c0ba03e9c564e8924c1a2bfd
Diffstat (limited to 'control/controlknobs')
| -rw-r--r-- | control/controlknobs/controlknobs.go | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/control/controlknobs/controlknobs.go b/control/controlknobs/controlknobs.go index 3ea0575a5..e64bc8011 100644 --- a/control/controlknobs/controlknobs.go +++ b/control/controlknobs/controlknobs.go @@ -48,6 +48,10 @@ type Knobs struct { // PeerMTUEnable is whether the node should do peer path MTU discovery. PeerMTUEnable atomic.Bool + + // DisableDNSForwarderTCPRetries is whether the DNS forwarder should + // skip retrying truncated queries over TCP. + DisableDNSForwarderTCPRetries atomic.Bool } // UpdateFromNodeAttributes updates k (if non-nil) based on the provided self @@ -61,14 +65,15 @@ func (k *Knobs) UpdateFromNodeAttributes(selfNodeAttrs []tailcfg.NodeCapability, return ok || slices.Contains(selfNodeAttrs, attr) } var ( - keepFullWG = has(tailcfg.NodeAttrDebugDisableWGTrim) - disableDRPO = has(tailcfg.NodeAttrDebugDisableDRPO) - disableUPnP = has(tailcfg.NodeAttrDisableUPnP) - randomizeClientPort = has(tailcfg.NodeAttrRandomizeClientPort) - disableDeltaUpdates = has(tailcfg.NodeAttrDisableDeltaUpdates) - oneCGNAT opt.Bool - forceBackgroundSTUN = has(tailcfg.NodeAttrDebugForceBackgroundSTUN) - peerMTUEnable = has(tailcfg.NodeAttrPeerMTUEnable) + keepFullWG = has(tailcfg.NodeAttrDebugDisableWGTrim) + disableDRPO = has(tailcfg.NodeAttrDebugDisableDRPO) + disableUPnP = has(tailcfg.NodeAttrDisableUPnP) + randomizeClientPort = has(tailcfg.NodeAttrRandomizeClientPort) + disableDeltaUpdates = has(tailcfg.NodeAttrDisableDeltaUpdates) + oneCGNAT opt.Bool + forceBackgroundSTUN = has(tailcfg.NodeAttrDebugForceBackgroundSTUN) + peerMTUEnable = has(tailcfg.NodeAttrPeerMTUEnable) + dnsForwarderDisableTCPRetries = has(tailcfg.NodeAttrDNSForwarderDisableTCPRetries) ) if has(tailcfg.NodeAttrOneCGNATEnable) { @@ -85,6 +90,7 @@ func (k *Knobs) UpdateFromNodeAttributes(selfNodeAttrs []tailcfg.NodeCapability, k.ForceBackgroundSTUN.Store(forceBackgroundSTUN) k.DisableDeltaUpdates.Store(disableDeltaUpdates) k.PeerMTUEnable.Store(peerMTUEnable) + k.DisableDNSForwarderTCPRetries.Store(dnsForwarderDisableTCPRetries) } // AsDebugJSON returns k as something that can be marshalled with json.Marshal @@ -94,13 +100,14 @@ func (k *Knobs) AsDebugJSON() map[string]any { return nil } return map[string]any{ - "DisableUPnP": k.DisableUPnP.Load(), - "DisableDRPO": k.DisableDRPO.Load(), - "KeepFullWGConfig": k.KeepFullWGConfig.Load(), - "RandomizeClientPort": k.RandomizeClientPort.Load(), - "OneCGNAT": k.OneCGNAT.Load(), - "ForceBackgroundSTUN": k.ForceBackgroundSTUN.Load(), - "DisableDeltaUpdates": k.DisableDeltaUpdates.Load(), - "PeerMTUEnable": k.PeerMTUEnable.Load(), + "DisableUPnP": k.DisableUPnP.Load(), + "DisableDRPO": k.DisableDRPO.Load(), + "KeepFullWGConfig": k.KeepFullWGConfig.Load(), + "RandomizeClientPort": k.RandomizeClientPort.Load(), + "OneCGNAT": k.OneCGNAT.Load(), + "ForceBackgroundSTUN": k.ForceBackgroundSTUN.Load(), + "DisableDeltaUpdates": k.DisableDeltaUpdates.Load(), + "PeerMTUEnable": k.PeerMTUEnable.Load(), + "DisableDNSForwarderTCPRetries": k.DisableDNSForwarderTCPRetries.Load(), } } |
