new option disable-checksum

This commit is contained in:
wangyu- 2018-08-03 16:43:56 -05:00
parent bc45ae23b8
commit ee0392ed03
3 changed files with 11 additions and 0 deletions

View File

@ -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");

1
misc.h
View File

@ -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;

View File

@ -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);