net/dns: skip DNS base config when using userspace networking (#18355)

When tailscaled gets started with userspace networking, it won't
modify your system's network configuration. For this, it creates
a noopManager for DNS management. noopManager correctly observes
that there's no real OS DNS to send queries to. This leads to we
completely dropping any DNS internal resolution from `dns query`

This change alters this so that even without a base config we'll
still allow the internal resolver to handle internal DNS queries

Fixes #18354

Signed-off-by: Fernando Serboncini <fserb@tailscale.com>
main
Fernando Serboncini 3 months ago committed by GitHub
parent db96e52d6f
commit 214b70cc1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      net/dns/manager.go
  2. 5
      net/dns/noop.go

@ -388,9 +388,9 @@ func (m *Manager) compileConfig(cfg Config) (rcfg resolver.Config, ocfg OSConfig
cfg, err := m.os.GetBaseConfig()
if err == nil {
baseCfg = &cfg
} else if isApple && err == ErrGetBaseConfigNotSupported {
// This is currently (2022-10-13) expected on certain iOS and macOS
// builds.
} else if (isApple || isNoopManager(m.os)) && err == ErrGetBaseConfigNotSupported {
// Expected when using noopManager (userspace networking) or on
// certain iOS/macOS builds. Continue without base config.
} else {
m.health.SetUnhealthy(osConfigurationReadWarnable, health.Args{health.ArgError: err.Error()})
return resolver.Config{}, OSConfig{}, err

@ -15,3 +15,8 @@ func (m noopManager) GetBaseConfig() (OSConfig, error) {
func NewNoopManager() (noopManager, error) {
return noopManager{}, nil
}
func isNoopManager(c OSConfigurator) bool {
_, ok := c.(noopManager)
return ok
}

Loading…
Cancel
Save