summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--anytun.cpp1
-rw-r--r--options.cpp28
2 files changed, 28 insertions, 1 deletions
diff --git a/anytun.cpp b/anytun.cpp
index 13c5371..97e70c2 100644
--- a/anytun.cpp
+++ b/anytun.cpp
@@ -296,6 +296,7 @@ void* receiver(void* p)
cLog.msg(Log::PRIO_NOTICE) << "autodetected remote host ip changed " << remote_host << ":" << remote_port;
conn.remote_host_=remote_host;
conn.remote_port_=remote_port;
+ param->queue.push(SyncCommand(param->cl,0));
}
//Replay Protection
diff --git a/options.cpp b/options.cpp
index 4bdefd0..bc72f91 100644
--- a/options.cpp
+++ b/options.cpp
@@ -29,6 +29,7 @@
*/
#include <iostream>
+#include <queue>
#include <string>
#include <sstream>
@@ -70,6 +71,19 @@
i+=2; \
}
+#define PARSE_SCALAR_CSLIST(SHORT, LONG, LIST) \
+ else if(str == SHORT || str == LONG) \
+ { \
+ if(argc < 1 || argv[i+1][0] == '-') \
+ return false; \
+ std::stringstream tmp; \
+ tmp << argv[i+1]; \
+ std::string tmp_line; \
+ getline(tmp,tmp_line,','); \
+ LIST.push(tmp_line); \
+ argc--; \
+ i++; \
+ }
Options::Options()
{
@@ -97,7 +111,7 @@ bool Options::parse(int argc, char* argv[])
progname_ = argv[0];
argc--;
-
+ std::queue<std::string> host_port_queue;
for(int i=1; argc > 0; ++i)
{
std::string str(argv[i]);
@@ -119,9 +133,21 @@ bool Options::parse(int argc, char* argv[])
PARSE_SCALAR_PARAM("-w","--window-size", seq_window_size_)
PARSE_SCALAR_PARAM("-c","--cypher", cypher_)
PARSE_SCALAR_PARAM("-a","--auth-algo", auth_algo_)
+ PARSE_SCALAR_CSLIST("-M","--sync-hosts", host_port_queue)
else
return false;
}
+ while(!host_port_queue.empty())
+ {
+ std::stringstream tmp_stream(host_port_queue.front());
+ std::string host;
+ u_int16_t port;
+ getline(tmp_stream,host,':');
+ if(!tmp_stream.good())
+ return false;
+ tmp_stream >> port;
+ host_port_queue.pop();
+ }
return true;
}