From fc4f975a4de1917df9d0fe2aaf0e009428546fe2 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Tue, 16 Nov 2021 21:07:15 +0100
Subject: [PATCH] device: align 64-bit atomic member in Device

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 device/device.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/device/device.go b/device/device.go
index 91654c6..3625608 100644
--- a/device/device.go
+++ b/device/device.go
@@ -53,16 +53,17 @@ type Device struct {
 		publicKey  NoisePublicKey
 	}
 
-	rate struct {
-		underLoadUntil int64
-		limiter        ratelimiter.Ratelimiter
-	}
-
 	peers struct {
 		sync.RWMutex // protects keyMap
 		keyMap       map[NoisePublicKey]*Peer
 	}
 
+	// Keep this 8-byte aligned
+	rate struct {
+		underLoadUntil int64
+		limiter        ratelimiter.Ratelimiter
+	}
+
 	allowedips    AllowedIPs
 	indexTable    IndexTable
 	cookieChecker CookieChecker