fix last commit

This commit is contained in:
wangyu- 2018-02-24 18:07:16 -06:00
parent 86a78b223e
commit 2c67c319b7

@ -568,6 +568,8 @@ int send_raw_ip(raw_info_t &raw_info,const char * payload,int payloadlen)
if(raw_info.disabled) if(raw_info.disabled)
{ {
mylog(log_debug,"[%s,%d]connection disabled, no packet will be sent\n",my_ntoa(recv_info.src_ip),recv_info.src_port);
assert(max_rst_allowed>=0);
return 0; return 0;
} }
@ -1451,6 +1453,7 @@ int recv_raw_tcp(raw_info_t &raw_info,char * &payload,int &payloadlen)
if(tcph->rst==1) if(tcph->rst==1)
{ {
raw_info.rst_received++; raw_info.rst_received++;
if(max_rst_to_show>0) if(max_rst_to_show>0)
{ {
if(raw_info.rst_received < max_rst_to_show) if(raw_info.rst_received < max_rst_to_show)
@ -1459,14 +1462,14 @@ int recv_raw_tcp(raw_info_t &raw_info,char * &payload,int &payloadlen)
} }
else if(raw_info.rst_received == max_rst_to_show) else if(raw_info.rst_received == max_rst_to_show)
{ {
mylog(log_warn,"[%s,%d]rst==1,cnt=%d >=max_rst_to_show, this log is muted for current connection\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received); mylog(log_warn,"[%s,%d]rst==1,cnt=%d >=max_rst_to_show, this log will be muted for current connection\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received);
} }
else else
{ {
mylog(log_debug,"[%s,%d]rst==1,cnt=%d\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received); mylog(log_debug,"[%s,%d]rst==1,cnt=%d\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received);
} }
} }
if(max_rst_to_show==0) else if(max_rst_to_show==0)
{ {
mylog(log_debug,"[%s,%d]rst==1,cnt=%d\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received); mylog(log_debug,"[%s,%d]rst==1,cnt=%d\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received);
} }
@ -1477,7 +1480,7 @@ int recv_raw_tcp(raw_info_t &raw_info,char * &payload,int &payloadlen)
if(max_rst_allowed>=0 && raw_info.rst_received==max_rst_allowed+1 ) if(max_rst_allowed>=0 && raw_info.rst_received==max_rst_allowed+1 )
{ {
mylog(log_warn,"[%s,%d]connection disabled because of rst_received %d > max_rst_allow=%d\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received,(int)max_rst_allowed ); mylog(log_warn,"[%s,%d]connection disabled because of rst_received=%d > max_rst_allow=%d\n",my_ntoa(recv_info.src_ip),recv_info.src_port,(int)raw_info.rst_received,(int)max_rst_allowed );
raw_info.disabled=1; raw_info.disabled=1;
} }
} }