From a4aba626567caf769a23b377308baec79b1c31e0 Mon Sep 17 00:00:00 2001 From: wangyu- Date: Wed, 29 Aug 2018 05:25:44 -0500 Subject: [PATCH] sync easy-tcp and other options from mp version --- misc.cpp | 39 ++++++++++++++++++++++++++++++++++++++- network.cpp | 1 + network.h | 1 + server.cpp | 4 +--- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/misc.cpp b/misc.cpp index c9734c9..71e50f1 100644 --- a/misc.cpp +++ b/misc.cpp @@ -237,6 +237,10 @@ int process_log_level(int argc,char *argv[])//process --log-level and --disable } } } + if(strcmp(argv[i],"--enable-color")==0) + { + enable_log_color=1; + } if(strcmp(argv[i],"--disable-color")==0) { enable_log_color=0; @@ -266,6 +270,7 @@ void process_arg(int argc, char *argv[]) //process all options {"cipher-mode", required_argument, 0, 1}, {"raw-mode", required_argument, 0, 1}, {"disable-color", no_argument, 0, 1}, + {"enable-color", no_argument, 0, 1}, {"log-position", no_argument, 0, 1}, {"disable-bpf", no_argument, 0, 1}, {"disable-anti-replay", no_argument, 0, 1}, @@ -273,7 +278,6 @@ void process_arg(int argc, char *argv[]) //process all options {"gen-rule", no_argument, 0, 'g'}, {"gen-add", no_argument, 0, 1}, {"debug", no_argument, 0, 1}, - {"dev", required_argument, 0, 1}, {"retry-on-error", no_argument, 0, 1}, {"clear", no_argument, 0, 1}, {"simple-rule", no_argument, 0, 1}, @@ -292,7 +296,9 @@ void process_arg(int argc, char *argv[]) //process all options {"max-rst-to-show", required_argument, 0, 1}, {"max-rst-allowed", required_argument, 0, 1}, {"set-ttl", required_argument, 0, 1}, + {"dev", required_argument, 0, 1}, {"dns-resolve", no_argument, 0, 1}, + {"easy-tcp", no_argument, 0, 1}, {NULL, 0, 0, 0} }; @@ -495,6 +501,7 @@ void process_arg(int argc, char *argv[]) //process all options } else if(strcmp(long_options[option_index].name,"raw-mode")==0) { + /* for(i=0;i\n",option_index, optopt); diff --git a/network.cpp b/network.cpp index bfb8ba3..8cb0c75 100644 --- a/network.cpp +++ b/network.cpp @@ -12,6 +12,7 @@ int raw_recv_fd=-1; int raw_send_fd=-1; u32_t link_level_header_len=0;//set it to 14 if SOCK_RAW is used in socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP)); +int use_tcp_dummy_socket=0; int seq_mode=3; int max_seq_mode=4; diff --git a/network.h b/network.h index f5d5635..55acabb 100644 --- a/network.h +++ b/network.h @@ -10,6 +10,7 @@ extern int raw_recv_fd; extern int raw_send_fd; +extern int use_tcp_dummy_socket; extern int seq_mode; extern int max_seq_mode; extern int filter_port; diff --git a/server.cpp b/server.cpp index f42e68d..50e8e29 100644 --- a/server.cpp +++ b/server.cpp @@ -15,8 +15,6 @@ #include "encrypt.h" #include "fd_manager.h" -int server_easytcp=0;//currently only for test - int server_on_timer_multi(conn_info_t &conn_info) //for server. called when a timer is ready in epoll.for server,there will be one timer for every connection // there is also a global timer for server,but its not handled here { @@ -458,7 +456,7 @@ int server_on_raw_recv_multi() //called when server received an raw packet { return 0; } - if(server_easytcp!=0) + if(use_tcp_dummy_socket!=0) return 0; raw_info_t &raw_info=tmp_raw_info; packet_info_t &send_info=raw_info.send_info;