summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--anytun.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/anytun.cpp b/anytun.cpp
index 03d2dc9..7578740 100644
--- a/anytun.cpp
+++ b/anytun.cpp
@@ -151,7 +151,11 @@ bool checkPacketSeqNr(Packet & pack,ConnectionParam & conn)
u_int16_t seq = pack.getSeqNr();
// compare sender_id and seq with window
if(conn.seq_window_.hasSeqNr(pack.getSenderId(), pack.getSeqNr()))
+ {
+ cLog.msg(Log::PRIO_NOTICE) << "Replay attack from " << conn.remote_host_<<":"<< conn.remote_port_<< " seq:"<<pack.getSeqNr() << " sid: "<<pack.getSenderId();
return false;
+ }
+
conn.seq_window_.addSeqNr(pack.getSenderId(), pack.getSeqNr());
return true;
}
@@ -251,8 +255,8 @@ void* receiver(void* p)
}
//Replay Protection
- //if (!checkPacketSeqNr(pack,conn))
- // continue;
+ if (!checkPacketSeqNr(pack,conn))
+ continue;
pack.removeHeader();
if (!decryptPacket(pack, c, conn))