1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00
Commit Graph

12 Commits

Author SHA1 Message Date
Jason A. Donenfeld
682401a177 device: use atomic access for unlocked keypair.next
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-05-02 01:16:08 +10:00
David Crawshaw
a4657f996d device: move stats fields back down and add test diagnostics
This reverts the movement of fields from d49f4e9.
That commit was cherry-picked from another branch where a field
had changed and misaligned the atomic fields. After cherry-picking,
moving the fields was no longer necessary but got dragged along.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-04-07 15:55:53 +10:00
David Crawshaw
f6020a2085 Revert "device: use wgcfg key types"
More cleanup work of wgcfg to do before bringing this in.

This reverts commit 83ca9b47b6.
2020-04-07 15:52:41 +10:00
David Crawshaw
83ca9b47b6 device: use wgcfg key types
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-04-02 15:53:10 +11:00
David Crawshaw
c4a8eab3dd conn: new package that splits out the Bind and Endpoint types
The sticky socket code stays in the device package for now,
as it reaches deeply into the peer list.

This is the first step in an effort to split some code out of
the very busy device package.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-30 21:05:11 +11:00
David Anderson
d49f4e9fe3 device: make Peer fields safe for atomic access on 32-bit.
All atomic access must be aligned to 64 bits, even on 32-bit
platforms. Go promises that the start of allocated structs is
aligned to 64 bits. So, place the atomically-accessed things
first in the struct so that they benefit from that alignment.

As a side bonus, it cleanly separates fields that are accessed
by atomic ops, and those that should be accessed under mu.

Also adds a test that will fail consistently on 32-bit platforms
if the struct ever changes again to violate the rules. This is
likely not needed because unaligned access crashes reliably,
but this will reliably fail even if tests accidentally pass due
to lucky alignment.

Signed-Off-By: David Anderson <danderson@tailscale.com>
2020-03-30 20:10:36 +11:00
Jason A. Donenfeld
4739708ca4 noise: unify zero checking of ecdh 2020-03-17 23:07:14 -06:00
Jason A. Donenfeld
4e3018a967 uapi: skip peers with invalid keys 2019-08-05 16:57:41 +02:00
Jason A. Donenfeld
a961aacc9f device: immediately rekey all peers after changing device private key
Reported-by: Derrick Pallas <derrick@pallas.us>
2019-07-11 17:37:35 +02:00
Jason A. Donenfeld
3371f8dac6 device: update transfer counters correctly
The rule is to always update them to the full packet size minus UDP/IP
encapsulation for all authenticated packet types.
2019-06-11 18:13:52 +02:00
Jason A. Donenfeld
b8e85267cf boundif: introduce API for socket binding 2019-03-04 16:37:11 +01:00
Jason A. Donenfeld
69f0fe67b6 global: begin modularization 2019-03-03 05:00:40 +01:00