summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--options.cpp8
-rw-r--r--plainPacket.cpp4
-rw-r--r--threadUtils.hpp1
3 files changed, 8 insertions, 5 deletions
diff --git a/options.cpp b/options.cpp
index ad70459..174844f 100644
--- a/options.cpp
+++ b/options.cpp
@@ -116,12 +116,14 @@ Options::~Options()
i+=2; \
}
-#define PARSE_HEXSTRING_PARAM(SHORT, LONG, VALUE) \
+#define PARSE_HEXSTRING_PARAM_SEC(SHORT, LONG, VALUE) \
else if(str == SHORT || str == LONG) \
{ \
if(argc < 1 || argv[i+1][0] == '-') \
return false; \
VALUE = Buffer(std::string(argv[i+1])); \
+ for(size_t j=0; j < strlen(argv[i+1]); ++j) \
+ argv[i+1][j] = '#'; \
argc--; \
i++; \
}
@@ -177,8 +179,8 @@ bool Options::parse(int argc, char* argv[])
PARSE_SCALAR_PARAM("-w","--window-size", seq_window_size_)
PARSE_SCALAR_PARAM("-m","--mux", mux_)
PARSE_SCALAR_PARAM("-c","--cipher", cipher_)
- PARSE_HEXSTRING_PARAM("-K","--key", key_)
- PARSE_HEXSTRING_PARAM("-A","--salt", salt_)
+ PARSE_HEXSTRING_PARAM_SEC("-K","--key", key_)
+ PARSE_HEXSTRING_PARAM_SEC("-A","--salt", salt_)
PARSE_SCALAR_PARAM("-k","--kd-prf", kd_prf_)
PARSE_SCALAR_PARAM("-a","--auth-algo", auth_algo_)
PARSE_CSLIST_PARAM("-M","--sync-hosts", host_port_queue)
diff --git a/plainPacket.cpp b/plainPacket.cpp
index ab9ccea..c4717c3 100644
--- a/plainPacket.cpp
+++ b/plainPacket.cpp
@@ -31,7 +31,7 @@
#include <stdexcept>
#include <iostream>
#include <arpa/inet.h>
-#include <net/ethernet.h>
+#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
@@ -60,7 +60,7 @@ void PlainPacket::setPayloadType(payload_type_t payload_type)
if(payload_type == PAYLOAD_TYPE_TUN) {
if(!payload_) {
- *payload_type_ = PAYLOAD_TYPE_T_HTON(0);
+ *payload_type_ = PAYLOAD_TYPE_T_HTON(PAYLOAD_TYPE_TUN);
return;
}
diff --git a/threadUtils.hpp b/threadUtils.hpp
index ad45f68..f084980 100644
--- a/threadUtils.hpp
+++ b/threadUtils.hpp
@@ -32,6 +32,7 @@
#define _THREADUTILS_HPP_
#include <stdexcept>
+#include <pthread.h>
#include <semaphore.h>
class Mutex