mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-02-07 23:59:36 +08:00
fix ipv6 of libnet
This commit is contained in:
parent
00776c3423
commit
314e982570
11
network.cpp
11
network.cpp
@ -498,7 +498,15 @@ int init_raw_socket()
|
||||
#ifndef NO_LIBNET
|
||||
char libnet_errbuf[LIBNET_ERRBUF_SIZE];
|
||||
|
||||
if(raw_ip_version==AF_INET)
|
||||
{
|
||||
libnet_handle = libnet_init(LIBNET_RAW4, dev, libnet_errbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(raw_ip_version==AF_INET6);
|
||||
libnet_handle = libnet_init(LIBNET_RAW6, dev, libnet_errbuf);
|
||||
}
|
||||
|
||||
if(libnet_handle==0)
|
||||
{
|
||||
@ -822,6 +830,8 @@ void init_filter(int port)
|
||||
|
||||
//pthread_mutex_lock(&filter_mutex);//not sure if mutex is needed here
|
||||
|
||||
pcap_setdirection(pcap_handle,PCAP_D_IN);
|
||||
|
||||
pcap_freecode(&g_filter);
|
||||
|
||||
if (pcap_compile(pcap_handle, &g_filter, filter_exp, 0, PCAP_NETMASK_UNKNOWN ) == -1) {
|
||||
@ -835,6 +845,7 @@ void init_filter(int port)
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
|
||||
//pthread_mutex_unlock(&filter_mutex);
|
||||
/*
|
||||
if(disable_bpf_filter) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user