]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: fix alignment of peer stats member
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 22 Dec 2020 20:34:21 +0000 (21:34 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 7 Jan 2021 13:49:44 +0000 (14:49 +0100)
This was shifted by 2 bytes when making persistent keepalive into a u32.
Fix it by placing it after the aligned region.

Fixes: e739ff7 ("device: fix persistent_keepalive_interval data races")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
device/peer.go

index 73e60839075ed0b0b4f34498a5001460e44c3973..8006b9f3cc826126ebea15e093a3ebf6b1888d1c 100644 (file)
@@ -28,7 +28,6 @@ type Peer struct {
        device                      *Device
        endpoint                    conn.Endpoint
        persistentKeepaliveInterval uint32 // accessed atomically
-       disableRoaming              bool
 
        // These fields are accessed with atomic operations, which must be
        // 64-bit aligned even on 32-bit platforms. Go guarantees that an
@@ -41,6 +40,8 @@ type Peer struct {
                lastHandshakeNano int64  // nano seconds since epoch
        }
 
+       disableRoaming bool
+
        timers struct {
                retransmitHandshake     *Timer
                sendKeepalive           *Timer