Skip to content

Commit

Permalink
fix last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu- committed Feb 25, 2018
1 parent 86a78b2 commit 2c67c31
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ int send_raw_ip(raw_info_t &raw_info,const char * payload,int payloadlen)

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

Expand Down Expand Up @@ -1451,6 +1453,7 @@ int recv_raw_tcp(raw_info_t &raw_info,char * &payload,int &payloadlen)
if(tcph->rst==1)
{
raw_info.rst_received++;

if(max_rst_to_show>0)
{
if(raw_info.rst_received < max_rst_to_show)
Expand All @@ -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)
{
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
{
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);
}
Expand All @@ -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 )
{
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;
}
}
Expand Down

0 comments on commit 2c67c31

Please sign in to comment.