net/dns: add GetBaseConfig to CallbackRouter.

Allow users of CallbackRouter to supply a GetBaseConfig
implementation. This is expected to be used on Android,
which currently lacks both a) platform support for
Split-DNS and b) a way to retrieve the current DNS
servers.

iOS/macOS also use the CallbackRouter but have platform
support for SplitDNS, so don't need getBaseConfig.

Updates https://github.com/tailscale/tailscale/issues/2116
Updates https://github.com/tailscale/tailscale/issues/988

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:
Denton Gentry
2021-10-09 12:17:59 -07:00
committed by Denton Gentry
parent a28d280b95
commit 878a20df29
4 changed files with 17 additions and 31 deletions

View File

@@ -1199,7 +1199,7 @@ func (e *userspaceEngine) linkChange(changed bool, cur *interfaces.State) {
// suspend/resume or whenever NetworkManager is started, it
// nukes all systemd-resolved configs. So reapply our DNS
// config on major link change.
if runtime.GOOS == "linux" && changed {
if (runtime.GOOS == "linux" || runtime.GOOS == "android") && changed {
e.wgLock.Lock()
dnsCfg := e.lastDNSConfig
e.wgLock.Unlock()