pcap: small cleanups

pull/2020/head
Victor Julien 9 years ago
parent 3f16ebe476
commit c3efc4e072

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2014 Open Information Security Foundation /* Copyright (C) 2007-2016 Open Information Security Foundation
* *
* You can copy, redistribute or modify this Program under the terms of * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free * the GNU General Public License version 2 as published by the Free
@ -59,8 +59,6 @@
extern int max_pending_packets; extern int max_pending_packets;
//static int pcap_max_read_packets = 0;
typedef struct PcapFileGlobalVars_ { typedef struct PcapFileGlobalVars_ {
pcap_t *pcap_handle; pcap_t *pcap_handle;
int (*Decoder)(ThreadVars *, DecodeThreadVars *, Packet *, u_int8_t *, u_int16_t, PacketQueue *); int (*Decoder)(ThreadVars *, DecodeThreadVars *, Packet *, u_int8_t *, u_int16_t, PacketQueue *);
@ -73,9 +71,6 @@ typedef struct PcapFileGlobalVars_ {
} PcapFileGlobalVars; } PcapFileGlobalVars;
/** max packets < 65536 */
//#define PCAP_FILE_MAX_PKTS 256
typedef struct PcapFileThreadVars_ typedef struct PcapFileThreadVars_
{ {
uint32_t tenant_id; uint32_t tenant_id;
@ -260,8 +255,10 @@ TmEcode ReceivePcapFileLoop(ThreadVars *tv, void *data, void *slot)
TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, void *initdata, void **data) TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, void *initdata, void **data)
{ {
SCEnter(); SCEnter();
char *tmpbpfstring = NULL; char *tmpbpfstring = NULL;
char *tmpstring = NULL; char *tmpstring = NULL;
if (initdata == NULL) { if (initdata == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "error: initdata == NULL"); SCLogError(SC_ERR_INVALID_ARGUMENT, "error: initdata == NULL");
SCReturnInt(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
@ -303,7 +300,8 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, void *initdata, void **data)
SCLogInfo("using bpf-filter \"%s\"", tmpbpfstring); SCLogInfo("using bpf-filter \"%s\"", tmpbpfstring);
if (pcap_compile(pcap_g.pcap_handle, &pcap_g.filter, tmpbpfstring, 1, 0) < 0) { if (pcap_compile(pcap_g.pcap_handle, &pcap_g.filter, tmpbpfstring, 1, 0) < 0) {
SCLogError(SC_ERR_BPF,"bpf compilation error %s",pcap_geterr(pcap_g.pcap_handle)); SCLogError(SC_ERR_BPF,"bpf compilation error %s",
pcap_geterr(pcap_g.pcap_handle));
SCFree(ptv); SCFree(ptv);
return TM_ECODE_FAILED; return TM_ECODE_FAILED;
} }

Loading…
Cancel
Save