mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 23:17:29 +00:00
wgengine/magicsock: fix looksLikeInitiationMsg endianness (#16771)
WireGuard message type is little-endian encoded. Updates tailscale/corp#30903 Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
@@ -1765,11 +1765,8 @@ func (c *Conn) mkReceiveFunc(ruc *RebindingUDPConn, healthItem *health.ReceiveFu
|
||||
// looksLikeInitiationMsg returns true if b looks like a WireGuard initiation
|
||||
// message, otherwise it returns false.
|
||||
func looksLikeInitiationMsg(b []byte) bool {
|
||||
if len(b) == device.MessageInitiationSize &&
|
||||
binary.BigEndian.Uint32(b) == device.MessageInitiationType {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return len(b) == device.MessageInitiationSize &&
|
||||
binary.LittleEndian.Uint32(b) == device.MessageInitiationType
|
||||
}
|
||||
|
||||
// receiveIP is the shared bits of ReceiveIPv4 and ReceiveIPv6.
|
||||
|
Reference in New Issue
Block a user