|
|
|
|
@ -30,6 +30,7 @@
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "suricata-common.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "suricata.h"
|
|
|
|
|
@ -42,6 +43,7 @@
|
|
|
|
|
#include "tm-threads.h"
|
|
|
|
|
#include "tm-threads-common.h"
|
|
|
|
|
#include "conf.h"
|
|
|
|
|
#include "util-bpf.h"
|
|
|
|
|
#include "util-debug.h"
|
|
|
|
|
#include "util-device.h"
|
|
|
|
|
#include "util-error.h"
|
|
|
|
|
@ -616,15 +618,19 @@ static TmEcode ReceiveNetmapThreadInit(ThreadVars *tv, const void *initdata, voi
|
|
|
|
|
if (aconf->in.bpf_filter) {
|
|
|
|
|
SCLogConfig("Using BPF '%s' on iface '%s'",
|
|
|
|
|
aconf->in.bpf_filter, ntv->ifsrc->ifname);
|
|
|
|
|
if (pcap_compile_nopcap(default_packet_size, /* snaplen_arg */
|
|
|
|
|
char errbuf[PCAP_ERRBUF_SIZE];
|
|
|
|
|
if (SCBPFCompile(default_packet_size, /* snaplen_arg */
|
|
|
|
|
LINKTYPE_ETHERNET, /* linktype_arg */
|
|
|
|
|
&ntv->bpf_prog, /* program */
|
|
|
|
|
aconf->in.bpf_filter, /* const char *buf */
|
|
|
|
|
1, /* optimize */
|
|
|
|
|
PCAP_NETMASK_UNKNOWN /* mask */
|
|
|
|
|
) == -1)
|
|
|
|
|
PCAP_NETMASK_UNKNOWN, /* mask */
|
|
|
|
|
errbuf,
|
|
|
|
|
sizeof(errbuf)) == -1)
|
|
|
|
|
{
|
|
|
|
|
SCLogError(SC_ERR_NETMAP_CREATE, "Filter compilation failed.");
|
|
|
|
|
SCLogError(SC_ERR_NETMAP_CREATE, "Failed to compile BPF \"%s\": %s",
|
|
|
|
|
aconf->in.bpf_filter,
|
|
|
|
|
errbuf);
|
|
|
|
|
goto error_dst;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -952,7 +958,7 @@ static TmEcode ReceiveNetmapThreadDeinit(ThreadVars *tv, void *data)
|
|
|
|
|
ntv->ifdst = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (ntv->bpf_prog.bf_insns) {
|
|
|
|
|
pcap_freecode(&ntv->bpf_prog);
|
|
|
|
|
SCBPFFree(&ntv->bpf_prog);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SCReturnInt(TM_ECODE_OK);
|
|
|
|
|
|