From ee0392ed03bf89417ebe26dd53a738b65974ae31 Mon Sep 17 00:00:00 2001 From: wangyu- Date: Fri, 3 Aug 2018 16:43:56 -0500 Subject: [PATCH] new option disable-checksum --- misc.cpp | 7 +++++++ misc.h | 1 + packet.cpp | 3 +++ 3 files changed, 11 insertions(+) diff --git a/misc.cpp b/misc.cpp index ef57344..39fbe9d 100644 --- a/misc.cpp +++ b/misc.cpp @@ -15,6 +15,7 @@ int mtu_warn=1350; int disable_mtu_warn=1; int disable_fec=0; +int disable_checksum=0; int debug_force_flush_fec=0; @@ -638,6 +639,7 @@ void process_arg(int argc, char *argv[]) {"disable-fec", no_argument, 0, 1}, {"disable-obscure", no_argument, 0, 1}, {"disable-xor", no_argument, 0, 1}, + {"disable-checksum", no_argument, 0, 1}, {"fix-latency", no_argument, 0, 1}, {"sock-buf", required_argument, 0, 1}, {"random-drop", required_argument, 0, 1}, @@ -849,6 +851,11 @@ void process_arg(int argc, char *argv[]) mylog(log_info,"xor disabled\n"); disable_xor=1; } + else if(strcmp(long_options[option_index].name,"disable-checksum")==0) + { + disable_checksum=1; + mylog(log_warn,"checksum disabled\n"); + } else if(strcmp(long_options[option_index].name,"fix-latency")==0) { mylog(log_info,"fix-latency enabled\n"); diff --git a/misc.h b/misc.h index 5a9d15d..a53639d 100644 --- a/misc.h +++ b/misc.h @@ -22,6 +22,7 @@ extern int mtu_warn; extern int disable_mtu_warn; extern int disable_fec; +extern int disable_checksum; extern int debug_force_flush_fec; diff --git a/packet.cpp b/packet.cpp index 3da0dc2..523b40a 100644 --- a/packet.cpp +++ b/packet.cpp @@ -9,6 +9,7 @@ #include "common.h" #include "log.h" #include "packet.h" +#include "misc.h" int iv_min=4; int iv_max=32;//< 256; @@ -324,6 +325,7 @@ int get_conv0(u32_t &conv,const char *input,int len_in,char *&output,int &len_ou } int put_crc32(char * s,int &len) { + if(disable_checksum)return 0; assert(len>=0); //if(len<0) return -1; u32_t crc32=crc32h((unsigned char *)s,len); @@ -336,6 +338,7 @@ int put_crc32(char * s,int &len) int do_cook(char * data,int &len) { + if(disable_checksum)return 0; put_crc32(data,len); if(!disable_obscure)do_obscure(data,len); if(!disable_xor)encrypt_0(data,len,key_string);