mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-23 03:17:43 +00:00
wgengine: flush DNS cache after major link change.
Windows has a public dns.Flush used in router_windows.go. However that won't work for platforms like Linux, where we need a different flush mechanism for resolved versus other implementations. We're instead adding a FlushCaches method to the dns Manager, which can be made to work on all platforms as needed. Fixes https://github.com/tailscale/tailscale/issues/2132 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:

committed by
Denton Gentry

parent
280c84e46a
commit
93c2882a2f
@@ -1160,6 +1160,11 @@ func (e *userspaceEngine) linkChange(changed bool, cur *interfaces.State) {
|
||||
|
||||
health.SetAnyInterfaceUp(up)
|
||||
e.magicConn.SetNetworkUp(up)
|
||||
if !up || changed {
|
||||
if err := e.dns.FlushCaches(); err != nil {
|
||||
e.logf("wgengine: dns flush failed after major link change: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Hacky workaround for Linux DNS issue 2458: on
|
||||
// suspend/resume or whenever NetworkManager is started, it
|
||||
|
Reference in New Issue
Block a user