mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-22 17:01:43 +00:00
net/netcheck: fix crash when IPv6 kinda but not really works
Looks like on some systems there's an IPv6 address, but then opening a IPv6 UDP socket fails later. Probably some firewall. Tolerate it better and don't crash. To repro: check the "udp6" to something like "udp7" (something that'll fail) and run "go run ./cmd/tailscale netcheck" on a machine with active IPv6. It used to crash and now it doesn't. Fixes #7949 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
7778d708a6
commit
90ba26cea1
@ -40,6 +40,7 @@ import (
|
|||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
"tailscale.com/types/nettype"
|
"tailscale.com/types/nettype"
|
||||||
"tailscale.com/types/opt"
|
"tailscale.com/types/opt"
|
||||||
|
"tailscale.com/types/ptr"
|
||||||
"tailscale.com/util/clientmetric"
|
"tailscale.com/util/clientmetric"
|
||||||
"tailscale.com/util/mak"
|
"tailscale.com/util/mak"
|
||||||
)
|
)
|
||||||
@ -943,6 +944,16 @@ func (c *Client) GetReport(ctx context.Context, dm *tailcfg.DERPMap) (_ *Report,
|
|||||||
go c.readPackets(ctx, u6)
|
go c.readPackets(ctx, u6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If our interfaces.State suggested we have IPv6 support but then we
|
||||||
|
// failed to get an IPv6 sending socket (as in
|
||||||
|
// https://github.com/tailscale/tailscale/issues/7949), then change
|
||||||
|
// ifState.HaveV6 before we make a probe plan that involves sending IPv6
|
||||||
|
// packets and thus assuming rs.pc6 is non-nil.
|
||||||
|
if rs.pc6 == nil {
|
||||||
|
ifState = ptr.To(*ifState) // shallow clone
|
||||||
|
ifState.HaveV6 = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plan := makeProbePlan(dm, ifState, last)
|
plan := makeProbePlan(dm, ifState, last)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user