From ca78a99ef24f205880bb78ce8d6091be6c27bb1d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 21 Jun 2007 17:32:14 +0000 Subject: added remote host auto detection --- anytun.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'anytun.cpp') diff --git a/anytun.cpp b/anytun.cpp index bebb71b..8a4fed5 100644 --- a/anytun.cpp +++ b/anytun.cpp @@ -68,6 +68,9 @@ void* sender(void* p) int len = param->dev->read(pack); pack.resizeBack(len); + if(param->opt->getRemoteAddr() == "") + continue; + // add payload type if(param->dev->getType() == TunDevice::TYPE_TUN) pack.addPayloadType(PAYLOAD_TYPE_TUN); @@ -111,10 +114,14 @@ void* receiver(void* p) pack.removeAuthTag(); if(at != param->a->calc(pack)) continue; + + // autodetect peer + if(param->opt->getRemoteAddr() == "") + param->opt->setRemoteAddrPort(remote_host, remote_port); // compare sender_id and seq with window pack.removeHeader(); - + // decypher the packet param->c->cypher(pack); -- cgit v1.2.3