]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Align 64-bit atomics
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 18 Apr 2018 04:54:21 +0000 (06:54 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 18 Apr 2018 04:54:21 +0000 (06:54 +0200)
64-bit varibles that are accessed using the Go atomic functions must be
8-byte aligned on 32-bit platforms. Otherwise there are crashes.

keypair.go
peer.go

index 283cb926ecfcbae40482489bcf7ebe8da0a13a22..1ab06497e57b35fa325c42d3202e55a9216baccd 100644 (file)
@@ -14,10 +14,10 @@ import (
  */
 
 type KeyPair struct {
+       sendNonce    uint64
        send         cipher.AEAD
        receive      cipher.AEAD
        replayFilter ReplayFilter
-       sendNonce    uint64
        isInitiator  bool
        created      time.Time
        localIndex   uint32
diff --git a/peer.go b/peer.go
index 5580cf69f1d192098d08c3a659a8a3c61bc86742..3a4f5f2fe300dc8b42ea0e8800c730d225ff27cd 100644 (file)
--- a/peer.go
+++ b/peer.go
@@ -13,9 +13,9 @@ const (
 )
 
 type Peer struct {
+       persistentKeepaliveInterval uint64
        isRunning                   AtomicBool
        mutex                       sync.RWMutex
-       persistentKeepaliveInterval uint64
        keyPairs                    KeyPairs
        handshake                   Handshake
        device                      *Device