net/tsdial: be smarter about when to close SystemDial conns

It was too aggressive before, as it only had the ill-defined "Major"
bool to work with. Now it can check more precisely.

Updates #9040

Change-Id: I20967283b64af6a9cad3f8e90cff406de91653b8
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-08-31 22:54:21 -07:00
committed by Brad Fitzpatrick
parent f7b7ccf835
commit 8b3ea13af0
2 changed files with 38 additions and 12 deletions

View File

@@ -364,10 +364,9 @@ func (s *State) HasIP(ip netip.Addr) bool {
if s == nil {
return false
}
want := netip.PrefixFrom(ip, ip.BitLen())
for _, pv := range s.InterfaceIPs {
for _, p := range pv {
if p == want {
if p.Contains(ip) {
return true
}
}