diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index a61343ebe..603fa3a41 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -40,6 +40,7 @@ import ( "tailscale.com/types/logger" "tailscale.com/types/nettype" "tailscale.com/types/opt" + "tailscale.com/types/ptr" "tailscale.com/util/clientmetric" "tailscale.com/util/mak" ) @@ -943,6 +944,16 @@ func (c *Client) GetReport(ctx context.Context, dm *tailcfg.DERPMap) (_ *Report, 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)