From a0b7ecbfe0d2ed974a68892cf8111a45ab24cd0f Mon Sep 17 00:00:00 2001 From: jdl Date: Mon, 15 Sep 2025 21:15:05 +0200 Subject: [PATCH] Fix syn-ack bug --- peer/remotefsm.go | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/peer/remotefsm.go b/peer/remotefsm.go index 6ea3e16..14d9261 100644 --- a/peer/remotefsm.go +++ b/peer/remotefsm.go @@ -163,24 +163,21 @@ func (r *remoteFSM) stateServer_onSyn(msg controlMsg[packetSyn]) { r.lastSeen = time.Now() p := msg.Packet - if p.TraceID == r.traceID { - return - } - - r.traceID = p.TraceID - - // Before we can respond to this packet, we need to make sure the - // route is setup properly. conf := r.conf() - conf.Up = true - conf.Direct = p.Direct - conf.DirectAddr = msg.SrcAddr + // New trace ID => Update the route configuration. + if p.TraceID != r.traceID { + r.traceID = p.TraceID - conf.DataCipher = newDataCipherFromKey(p.SharedKey) + conf.Up = true + conf.Direct = p.Direct + conf.DirectAddr = msg.SrcAddr - r.updateConf(conf) - r.logf("Got SYN.") + conf.DataCipher = newDataCipherFromKey(p.SharedKey) + + r.updateConf(conf) + r.logf("Got SYN.") + } r.sendControl(conf, packetAck{ TraceID: p.TraceID,