Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conn/controlfns_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func kernelVersion() (major, minor int) {
value = (value * 10) + int(c-'0')
} else {
// Note that we're assuming N.N.N here.
// If we see anything else, we are likely to mis-parse it.
// If we see anything else, we are likely to miss-parse it.
values[vi] = value
vi++
if vi >= len(values) {
Expand Down
8 changes: 4 additions & 4 deletions device/allowedips_rand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ func TestTrieRandom(t *testing.T) {
for n := 0; n < NumberOfAddresses; n++ {
var addr4 [4]byte
rng.Read(addr4[:])
cidr := uint8(rand.Intn(32) + 1)
index := rand.Intn(NumberOfPeers)
cidr := uint8(rng.Intn(32) + 1)
index := rng.Intn(NumberOfPeers)
allowedIPs.Insert(netip.PrefixFrom(netip.AddrFrom4(addr4), int(cidr)), peers[index])
slow4 = slow4.Insert(addr4[:], cidr, peers[index])

var addr6 [16]byte
rng.Read(addr6[:])
cidr = uint8(rand.Intn(128) + 1)
index = rand.Intn(NumberOfPeers)
cidr = uint8(rng.Intn(128) + 1)
index = rng.Intn(NumberOfPeers)
allowedIPs.Insert(netip.PrefixFrom(netip.AddrFrom16(addr6), int(cidr)), peers[index])
slow6 = slow6.Insert(addr6[:], cidr, peers[index])
}
Expand Down
2 changes: 1 addition & 1 deletion device/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
RejectAfterTime = time.Second * 180
KeepaliveTimeout = time.Second * 10
CookieRefreshTime = time.Second * 120
HandshakeInitationRate = time.Second / 50
HandshakeInitiationRate = time.Second / 50
PaddingMultiple = 16
)

Expand Down
2 changes: 1 addition & 1 deletion device/noise-protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer {
// protect against replay & flood

replay := !timestamp.After(handshake.lastTimestamp)
flood := time.Since(handshake.lastInitiationConsumption) <= HandshakeInitationRate
flood := time.Since(handshake.lastInitiationConsumption) <= HandshakeInitiationRate
handshake.mutex.RUnlock()
if replay {
device.log.Verbosef("%v - ConsumeMessageInitiation: handshake replay @ %v", peer, timestamp)
Expand Down