mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-10-14 01:45:35 +08:00
added --fix-gro
This commit is contained in:
21
network.cpp
21
network.cpp
@@ -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);
|
||||
|
Reference in New Issue
Block a user