From 668c0e854579226be03896176af0d5485a084100 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Sun, 9 Dec 2007 13:46:35 +0000 Subject: added dynamic ip support added comments --- anytun.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'anytun.cpp') diff --git a/anytun.cpp b/anytun.cpp index 6c103b4..c3e3be2 100644 --- a/anytun.cpp +++ b/anytun.cpp @@ -227,19 +227,29 @@ void* receiver(void* p) // autodetect peer - // TODO fixme, IP might change!!! // TODO check auth tag first + // this should be done by keymanagement anyway if(param->opt.getRemoteAddr() == "" && param->cl.empty()) { createConnection(remote_host, remote_port, param->cl,param->opt.getSeqWindowSize()); cLog.msg(Log::PRIO_NOTICE) << "autodetected remote host " << remote_host << ":" << remote_port; } + //TODO Add multi connection support here ConnectionParam conn = param->cl.getConnection(); if (!checkPacketAuthTag(pack, c, conn)) continue; + //Allow dynamic IP changes + //TODO add command line option to turn this off + if (remote_host != conn.remote_host_ || remote_port != conn.remote_port_) + { + conn.remote_host_=remote_host; + conn.remote_port_=remote_port; + } + + //Replay Protection if (!checkPacketSeqNr(pack,conn)) continue; pack.removeHeader(); -- cgit v1.2.3