diff --git a/config.h.in b/config.h.in index 7d50134118..a1cfc10753 100644 --- a/config.h.in +++ b/config.h.in @@ -43,9 +43,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Major Version of Libpcap */ -#undef LIBPCAP_VERSION_MAJOR - /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index ee65978f8d..c3f203cea1 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -98,28 +98,9 @@ void PcapFileCallback(char *user, struct pcap_pkthdr *h, u_char *pkt) { int ReceivePcapFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq) { PcapFileThreadVars *ptv = (PcapFileThreadVars *)data; - //printf("ReceivePcap: tv %p\n", tv); int r = pcap_dispatch(pcap_g.pcap_handle, 1, (pcap_handler)PcapFileCallback, (u_char *)ptv); if (r <= 0) { printf("ReceivePcap: code %d error %s\n", r, pcap_geterr(pcap_g.pcap_handle)); -#if 0 - /* Stop the engine so it quits after processing the pcap file - * but first make sure all packets are processed by all other - * threads. */ - char done = 0; - do { - mutex_lock(&mutex_pending); - if (pending == 0) - done = 1; - mutex_unlock(&mutex_pending); - - if (done == 0) { - usleep(100); - } - } while (done == 0); - - printf("ReceivePcapFile: all packets processed by threads, stopping engine\n"); -#endif EngineStop(); return 1; } @@ -139,10 +120,8 @@ int ReceivePcapFileThreadInit(ThreadVars *tv, void *initdata, void **data) { } memset(ptv, 0, sizeof(PcapFileThreadVars)); - /* XXX create a general pcap setup function */ - char errbuf[PCAP_ERRBUF_SIZE]; + char errbuf[PCAP_ERRBUF_SIZE] = ""; pcap_g.pcap_handle = pcap_open_offline((char *)initdata, errbuf); - /* Cannot use pcap_geterror with pcap_open_offline have to use errbuf */ if (pcap_g.pcap_handle == NULL) { printf("error %s\n", errbuf); exit(1); diff --git a/src/source-pcap.c b/src/source-pcap.c index 0f70c82c87..4702a94792 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -197,10 +197,9 @@ int ReceivePcapThreadInit(ThreadVars *tv, void *initdata, void **data) { printf("ReceivePcapThreadInit: using interface %s\n", (char *)initdata); - /* XXX create a general pcap setup function */ - char errbuf[PCAP_ERRBUF_SIZE]; - pcap_g.pcap_handle = pcap_open_live((char *)initdata, LIBPCAP_SNAPLEN, LIBPCAP_PROMISC, LIBPCAP_COPYWAIT, errbuf); - /* Cannot use pcap_geterror with pcap_open_live have to use errbuf */ + char errbuf[PCAP_ERRBUF_SIZE] = ""; + pcap_g.pcap_handle = pcap_open_live((char *)initdata, LIBPCAP_SNAPLEN, + LIBPCAP_PROMISC, LIBPCAP_COPYWAIT, errbuf); if (pcap_g.pcap_handle == NULL) { printf("error %s\n", errbuf); exit(1); @@ -223,7 +222,6 @@ int ReceivePcapThreadInit(ThreadVars *tv, void *initdata, void **data) { break; } - *data = (void *)ptv; return 0; }