From 25d2dd868bcbbbcfa30e269120def11a0aa95590 Mon Sep 17 00:00:00 2001 From: Aleksandar Pesic Date: Wed, 10 Mar 2021 10:44:38 +0100 Subject: [PATCH] wgengine/router: flushdns in windows when router config changes Fixes: https://github.com/tailscale/tailscale/issues/1430 Signed-off-by: Aleksandar Pesic --- wgengine/router/router_windows.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wgengine/router/router_windows.go b/wgengine/router/router_windows.go index 0f1ed8438..89c686b95 100644 --- a/wgengine/router/router_windows.go +++ b/wgengine/router/router_windows.go @@ -111,6 +111,14 @@ func (r *winRouter) Set(cfg *Config) error { return fmt.Errorf("dns set: %w", err) } + // Flush DNS on router config change to clear cached DNS entries (solves #1430) + out, err := exec.Command("ipconfig", "/flushdns").CombinedOutput() + if err != nil { + r.logf("flushdns error: %v; output: %s", err, out) + } else { + r.logf("flushdns successful") + } + return nil }