From e223899982fd2b75c653db3f90a08618d6997392 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 28 Apr 2015 11:12:45 +0100 Subject: [PATCH] remove nonce transmission from protocol --- router/connection.go | 5 ----- router/consts.go | 1 - router/crypto.go | 9 --------- router/protocol.go | 3 +-- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/router/connection.go b/router/connection.go index 8be52e26..5ba2e033 100644 --- a/router/connection.go +++ b/router/connection.go @@ -489,11 +489,6 @@ func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte) nil) case ProtocolFragmentationReceived: conn.setStackFrag(true) - case ProtocolNonce: - if conn.SessionKey == nil { - return fmt.Errorf("unexpected nonce on unencrypted connection") - } - conn.Decryptor.ReceiveNonce(payload) case ProtocolPMTUVerified: conn.pmtuVerified(int(binary.BigEndian.Uint16(payload))) case ProtocolGossipUnicast, ProtocolGossipBroadcast, ProtocolGossip: diff --git a/router/consts.go b/router/consts.go index 0aa13fd6..c0cc0b09 100644 --- a/router/consts.go +++ b/router/consts.go @@ -13,7 +13,6 @@ const ( DefaultPMTU = 65535 MaxUDPPacketSize = 65536 ChannelSize = 16 - UDPNonceSendAt = 8192 FragTestSize = 60001 PMTUDiscoverySize = 60000 TCPHeartbeat = 30 * time.Second diff --git a/router/crypto.go b/router/crypto.go index 77e72715..0d893469 100644 --- a/router/crypto.go +++ b/router/crypto.go @@ -9,7 +9,6 @@ import ( "encoding/binary" "encoding/gob" "fmt" - "log" "sync" ) @@ -153,7 +152,6 @@ type FrameConsumer func(src []byte, dst []byte, frame []byte) type Decryptor interface { IterateFrames([]byte, FrameConsumer) error - ReceiveNonce([]byte) Shutdown() } @@ -214,10 +212,6 @@ func (nd *NonDecryptor) IterateFrames(packet []byte, consumer FrameConsumer) err func (nd *NonDecryptor) Shutdown() { } -func (nd *NonDecryptor) ReceiveNonce(msg []byte) { - log.Println("Received Nonce on non-encrypted channel. Ignoring.") -} - func NewNaClDecryptor(sessionKey *[32]byte, outbound bool) *NaClDecryptor { return &NaClDecryptor{ NonDecryptor: *NewNonDecryptor(), @@ -229,9 +223,6 @@ func NewNaClDecryptor(sessionKey *[32]byte, outbound bool) *NaClDecryptor { func (nd *NaClDecryptor) Shutdown() { } -func (nd *NaClDecryptor) ReceiveNonce(msg []byte) { -} - func (nd *NaClDecryptor) IterateFrames(packet []byte, consumer FrameConsumer) error { if len(packet) < 8 { return PacketDecodingError{Desc: fmt.Sprintf("encrypted UDP packet too short; expected length >= 8, got %d", len(packet))} diff --git a/router/protocol.go b/router/protocol.go index 0fc548c6..441c208c 100644 --- a/router/protocol.go +++ b/router/protocol.go @@ -2,7 +2,7 @@ package router const ( Protocol = "weave" - ProtocolVersion = 15 + ProtocolVersion = 16 ) type ProtocolTag byte @@ -12,7 +12,6 @@ const ( ProtocolConnectionEstablished ProtocolFragmentationReceived ProtocolStartFragmentationTest - ProtocolNonce ProtocolPMTUVerified ProtocolGossip ProtocolGossipUnicast