summaryrefslogtreecommitdiff
path: root/anytun.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2007-06-21 17:32:14 +0000
committerChristian Pointner <equinox@anytun.org>2007-06-21 17:32:14 +0000
commitca78a99ef24f205880bb78ce8d6091be6c27bb1d (patch)
treec4d53dc692a814c37b8c791af49167f514839894 /anytun.cpp
parentadded options parser (diff)
added remote host auto detection
Diffstat (limited to 'anytun.cpp')
-rw-r--r--anytun.cpp9
1 files changed, 8 insertions, 1 deletions
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);