]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Make error messages consistent
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 18 Dec 2018 23:35:53 +0000 (00:35 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 18 Dec 2018 23:35:53 +0000 (00:35 +0100)
receive.go
send.go
timers.go

index b07d4799d22243f55eae6529a11efebe1e902796..b22abf5c1a4f395689318649044829c108699ef2 100644 (file)
@@ -351,7 +351,10 @@ func (device *Device) RoutineHandshake() {
                        // consume reply
 
                        if peer := entry.peer; peer.isRunning.Get() {
-                               peer.cookieGenerator.ConsumeReply(&reply)
+                               logDebug.Println("Receiving cookie response from ", elem.endpoint.DstToString())
+                               if !peer.cookieGenerator.ConsumeReply(&reply) {
+                                       logDebug.Println("Could not decrypt invalid cookie response")
+                               }
                        }
 
                        continue
diff --git a/send.go b/send.go
index 07e43e12173c45f5bc66ec7bf7c1c0653f8135d0..6edc6d70284286e677d64fdf826597e67b663fb5 100644 (file)
--- a/send.go
+++ b/send.go
@@ -206,7 +206,7 @@ func (peer *Peer) SendHandshakeResponse() error {
 
 func (device *Device) SendHandshakeCookie(initiatingElem *QueueHandshakeElement) error {
 
-       device.log.Debug.Println("Sending cookie reply to:", initiatingElem.endpoint.DstToString())
+       device.log.Debug.Println("Sending cookie response for denied handshake message for", initiatingElem.endpoint.DstToString())
 
        sender := binary.LittleEndian.Uint32(initiatingElem.packet[4:8])
        reply, err := device.cookieChecker.CreateReply(initiatingElem.packet, sender, initiatingElem.endpoint.DstToBytes())
index 0a9c7397b37ea40c148f93974dd5a2bb33fbd2a4..266e42255bc4faa2ffb736cced83dc6d1f666d19 100644 (file)
--- a/timers.go
+++ b/timers.go
@@ -79,7 +79,7 @@ func (peer *Peer) timersActive() bool {
 
 func expiredRetransmitHandshake(peer *Peer) {
        if atomic.LoadUint32(&peer.timers.handshakeAttempts) > MaxTimerHandshakes {
-               peer.device.log.Debug.Printf("%s: Handshake did not complete after %d attempts, giving up\n", peer, MaxTimerHandshakes+2)
+               peer.device.log.Debug.Printf("%s - Handshake did not complete after %d attempts, giving up\n", peer, MaxTimerHandshakes+2)
 
                if peer.timersActive() {
                        peer.timers.sendKeepalive.Del()
@@ -98,7 +98,7 @@ func expiredRetransmitHandshake(peer *Peer) {
                }
        } else {
                atomic.AddUint32(&peer.timers.handshakeAttempts, 1)
-               peer.device.log.Debug.Printf("%s: Handshake did not complete after %d seconds, retrying (try %d)\n", peer, int(RekeyTimeout.Seconds()), atomic.LoadUint32(&peer.timers.handshakeAttempts)+1)
+               peer.device.log.Debug.Printf("%s - Handshake did not complete after %d seconds, retrying (try %d)\n", peer, int(RekeyTimeout.Seconds()), atomic.LoadUint32(&peer.timers.handshakeAttempts)+1)
 
                /* We clear the endpoint address src address, in case this is the cause of trouble. */
                peer.mutex.Lock()
@@ -122,7 +122,7 @@ func expiredSendKeepalive(peer *Peer) {
 }
 
 func expiredNewHandshake(peer *Peer) {
-       peer.device.log.Debug.Printf("%s: Retrying handshake because we stopped hearing back after %d seconds\n", peer, int((KeepaliveTimeout + RekeyTimeout).Seconds()))
+       peer.device.log.Debug.Printf("%s - Retrying handshake because we stopped hearing back after %d seconds\n", peer, int((KeepaliveTimeout + RekeyTimeout).Seconds()))
        /* We clear the endpoint address src address, in case this is the cause of trouble. */
        peer.mutex.Lock()
        if peer.endpoint != nil {
@@ -134,7 +134,7 @@ func expiredNewHandshake(peer *Peer) {
 }
 
 func expiredZeroKeyMaterial(peer *Peer) {
-       peer.device.log.Debug.Printf("%s: Removing all keys, since we haven't received a new one in %d seconds\n", peer, int((RejectAfterTime * 3).Seconds()))
+       peer.device.log.Debug.Printf("%s - Removing all keys, since we haven't received a new one in %d seconds\n", peer, int((RejectAfterTime * 3).Seconds()))
        peer.ZeroAndFlushAll()
 }