added --fix-gro

This commit is contained in:
wangyu
2019-07-15 08:36:06 -04:00
parent 7d481d26b9
commit ee787e0d4a
11 changed files with 234 additions and 93 deletions

View File

@@ -9,6 +9,8 @@
#include "log.h"
#include "misc.h"
int g_fix_gro=1;
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));
@@ -839,10 +841,27 @@ int pre_recv_raw_packet()
if(g_packet_buf_len==max_data_len+1)
{
mylog(log_warn,"huge packet, data_len > %d,dropped\n",max_data_len);
mylog(log_warn,"huge packet, data_len %d > %d(max_data_len),dropped\n",g_packet_buf_len,max_data_len);
return -1;
}
if(g_packet_buf_len> single_max_data_len+1)
{
if(g_fix_gro==0)
{
mylog(log_warn, "huge packet, data_len %d > %d(single_max_data_len) dropped\n", g_packet_buf_len,
single_max_data_len);
return -1;
}
else
{
mylog(log_debug, "huge packet, data_len %d > %d(single_max_data_len) dropped\n", g_packet_buf_len,
single_max_data_len);
return -1;
}
}
if(g_packet_buf_len<0)
{
mylog(log_trace,"recv_len %d\n",g_packet_buf_len);