mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-02-07 15:49:35 +08:00
huge_buf_len and huge_data_len fix for mp
This commit is contained in:
parent
4e5b3f2baa
commit
6c1446036b
@ -713,6 +713,11 @@ void async_cb(struct ev_loop *loop, struct ev_async *watcher, int revents)
|
|||||||
pthread_mutex_unlock(&queue_mutex);
|
pthread_mutex_unlock(&queue_mutex);
|
||||||
|
|
||||||
if(empty) break;
|
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;
|
int new_len=len-pcap_link_header_len;
|
||||||
memcpy(g_packet_buf,p+pcap_link_header_len,new_len);
|
memcpy(g_packet_buf,p+pcap_link_header_len,new_len);
|
||||||
|
4
common.h
4
common.h
@ -343,11 +343,11 @@ const int buf_len=max_data_len+400;
|
|||||||
|
|
||||||
//const int max_address_len=512;
|
//const int max_address_len=512;
|
||||||
|
|
||||||
const int queue_len=2000;
|
const int queue_len=200;
|
||||||
|
|
||||||
struct queue_t
|
struct queue_t
|
||||||
{
|
{
|
||||||
char data[queue_len][buf_len];
|
char data[queue_len][huge_buf_len];
|
||||||
int data_len[queue_len];
|
int data_len[queue_len];
|
||||||
|
|
||||||
int head=0;
|
int head=0;
|
||||||
|
@ -539,7 +539,7 @@ int init_raw_socket()
|
|||||||
myexit(-1);
|
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_promisc(pcap_handle, 0) ==0);
|
||||||
assert( pcap_set_timeout(pcap_handle, 1) ==0);
|
assert( pcap_set_timeout(pcap_handle, 1) ==0);
|
||||||
assert( pcap_set_immediate_mode(pcap_handle,1) ==0);
|
assert( pcap_set_immediate_mode(pcap_handle,1) ==0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user