control/controlclient,ipn/ipnlocal,net/dnscache: reset stale connection state on link change by plusk01 · Pull Request #19200 · tailscale/tailscale

@plusk01

…on state on link change

When the network changes (e.g., switching WiFi networks), the control
client's HTTP transport, DNS cache, and Noise client retain connections
and resolved addresses from the previous network. If that network
returned bad DNS results, the control client keeps dialing the wrong
IP indefinitely, requiring a manual service restart to recover.

Add ResetConnections() to flush the DNS cache, close idle HTTP
connections, and tear down the Noise client on major link changes.
The Noise client is lazily recreated by getNoiseClient() via
singleflight on the next control RPC.

Fixes tailscale#19199

Signed-off-by: Parker Lusk <parkerclusk@gmail.com>