net/dns: add an envknob to force Linux DNS mode

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
This commit is contained in:
Anton Tolchanov 2026-06-16 20:45:31 +01:00
parent f0a1aa818f
commit b9d49335f3

View File

@ -15,6 +15,7 @@
"time"
"tailscale.com/control/controlknobs"
"tailscale.com/envknob"
"tailscale.com/feature"
"tailscale.com/feature/buildfeatures"
"tailscale.com/health"
@ -61,6 +62,8 @@ func (kv kv) String() string {
optDBusReadString feature.Hook[func(name, objectPath, iface, member string) (string, error)]
)
var forceMode = envknob.RegisterString("TS_DEBUG_LINUX_DNS_MODE")
// NewOSConfigurator created a new OS configurator.
//
// The health tracker may be nil; the knobs may be nil and are ignored on this platform.
@ -139,6 +142,11 @@ func dnsMode(logf logger.Logf, health *health.Tracker, env newOSConfigEnv) (ret
debug = append(debug, kv{k, v})
}
defer func() {
if fm := forceMode(); fm != "" {
dbg("forced", fm)
dbg("detected", ret)
ret = fm
}
if ret != "" {
dbg("ret", ret)
}