huge_buf_len and huge_data_len fix for mp

This commit is contained in:
wangyu 2020-07-15 04:35:09 -04:00
parent 4e5b3f2baa
commit 6c1446036b
3 changed files with 8 additions and 3 deletions

View File

@ -713,6 +713,11 @@ void async_cb(struct ev_loop *loop, struct ev_async *watcher, int revents)
pthread_mutex_unlock(&queue_mutex);
if(empty) break;
if(g_fix_gro==0&&len>max_data_len)
{
mylog(log_warn,"huge packet %d > %d, dropped\n",len,max_data_len);
break;
}
int new_len=len-pcap_link_header_len;
memcpy(g_packet_buf,p+pcap_link_header_len,new_len);

View File

@ -343,11 +343,11 @@ const int buf_len=max_data_len+400;
//const int max_address_len=512;
const int queue_len=2000;
const int queue_len=200;
struct queue_t
{
char data[queue_len][buf_len];
char data[queue_len][huge_buf_len];
int data_len[queue_len];
int head=0;

View File

@ -539,7 +539,7 @@ int init_raw_socket()
myexit(-1);
}
assert( pcap_set_snaplen(pcap_handle, max_data_len) ==0);
assert( pcap_set_snaplen(pcap_handle, huge_data_len) ==0);
assert( pcap_set_promisc(pcap_handle, 0) ==0);
assert( pcap_set_timeout(pcap_handle, 1) ==0);
assert( pcap_set_immediate_mode(pcap_handle,1) ==0);