wgengine/magicsock: fix panic regression from cryptokey routing change

Fixes #13332
Updates tailscale/corp#20732

Change-Id: I30f12746844bf77f5a664bf8e8d8ebf2511a2b27
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2024-08-30 21:07:15 -07:00 committed by Brad Fitzpatrick
parent 2f2aeaeaeb
commit 65fe0ba7b5

View File

@ -1089,7 +1089,13 @@ func (c *Conn) Send(buffs [][]byte, ep conn.Endpoint) error {
metricSendDataNetworkDown.Add(n) metricSendDataNetworkDown.Add(n)
return errNetworkDown return errNetworkDown
} }
return ep.(*endpoint).send(buffs) if ep, ok := ep.(*endpoint); ok {
return ep.send(buffs)
}
// If it's not of type *endpoint, it's probably *lazyEndpoint, which means
// we don't actually know who the peer is and we're waiting for wireguard-go
// to switch the endpoint. See go/corp/20732.
return nil
} }
var errConnClosed = errors.New("Conn closed") var errConnClosed = errors.New("Conn closed")