[-]
[+]
|
Changed |
nprobe.changes
|
|
[-]
[+]
|
Changed |
nprobe.spec
^
|
|
|
Changed |
GeoIPASNum.dat.gz
^
|
|
Changed |
GeoLiteCity.dat.gz
^
|
|
Changed |
PF_RING-5.5.2-svn.tar.bz2
^
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/example/Makefile
^
|
@@ -1,6 +1,6 @@
INC=-I../src/include/
LIB=../src/lib/.libs/libndpi.a -lpcap
-FLAGS=-O2 -g
+FLAGS=-g
pcapReader: pcapReader.c Makefile ../src/lib/.libs/libndpi.a
gcc $(FLAGS) $(INC) pcapReader.c -o pcapReader $(LIB)
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/example/pcapReader.c
^
|
@@ -676,6 +676,26 @@
printf("\n\n");
}
+static void closePcapFile(void)
+{
+ if (_pcap_handle != NULL) {
+ pcap_close(_pcap_handle);
+ }
+}
+
+// executed for each packet in the pcap file
+void sigproc(int sig) {
+ static int called = 0;
+
+ if(called) return; else called = 1;
+ shutdown_app = 1;
+
+ closePcapFile();
+ printResults(0);
+ terminateDetection();
+ exit(0);
+}
+
static void openPcapFileOrDevice(void)
{
u_int snaplen = 1514;
@@ -711,31 +731,13 @@
if(capture_until > 0) {
printf("Capturing traffic up to %u seconds\n", (unsigned int)capture_until);
- capture_until += time(NULL);
- }
-}
-static void closePcapFile(void)
-{
- if (_pcap_handle != NULL) {
- pcap_close(_pcap_handle);
+ alarm(capture_until);
+ signal(SIGALRM, sigproc);
+ capture_until += time(NULL);
}
}
-void sigproc(int sig) {
- static int called = 0;
-
- if(called) return; else called = 1;
- shutdown_app = 1;
-
- closePcapFile();
- printResults(0);
- terminateDetection();
- exit(0);
-}
-
-
-// executed for each packet in the pcap file
static void pcap_packet_callback(u_char * args, const struct pcap_pkthdr *header, const u_char * packet)
{
const struct ndpi_ethhdr *ethernet;
@@ -837,6 +839,8 @@
static void runPcapLoop(void)
{
+
+
if((!shutdown_app) && (_pcap_handle != NULL))
pcap_loop(_pcap_handle, -1, &pcap_packet_callback, NULL);
}
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/src/include/linux_compat.h
^
|
@@ -28,7 +28,7 @@
#include "ndpi_define.h"
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <machine/endian.h>
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/src/include/ndpi_main.h
^
|
@@ -38,7 +38,7 @@
#include <sys/time.h>
#endif
-#if 1 && !defined __APPLE__ && !defined __FreeBSD__
+#if 1 && !defined __APPLE__ && !defined __FreeBSD__ && !defined __NetBSD__
#ifndef __KERNEL__
#include <endian.h>
@@ -73,12 +73,16 @@
#include "linux_compat.h"
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <netinet/in.h>
+#if defined(__NetBSD__)
+#include <netinet/in_systm.h>
+#endif
#endif
#ifndef WIN32
#ifndef __KERNEL__
+
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/src/include/ndpi_public_functions.h
^
|
@@ -131,7 +131,7 @@
/* Public malloc/free */
void* ndpi_malloc(unsigned long size);
void ndpi_free(void *ptr);
- void *ndpi_realloc(void *ptr, size_t size);
+ void *ndpi_realloc(void *ptr, size_t old_size, size_t new_size);
char *ndpi_strdup(const char *s);
char* ndpi_strnstr(const char *s, const char *find, size_t slen);
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/src/lib/ndpi_main.c
^
|
@@ -291,13 +291,13 @@
/* ****************************************** */
-void *ndpi_realloc(void *ptr, size_t size) {
- void *ret = ndpi_malloc(size);
+void *ndpi_realloc(void *ptr, size_t old_size, size_t new_size) {
+ void *ret = ndpi_malloc(new_size);
if(!ret)
return(ret);
else {
- memcpy(ret, ptr, size);
+ memcpy(ret, ptr, old_size);
ndpi_free(ptr);
return(ret);
}
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/src/lib/third_party/src/ahocorasick.c
^
|
@@ -311,8 +311,11 @@
{
if(thiz->all_nodes_num >= thiz->all_nodes_max)
{
+ thiz->all_nodes = ndpi_realloc(thiz->all_nodes,
+ thiz->all_nodes_max*sizeof(AC_NODE_t *),
+ (REALLOC_CHUNK_ALLNODES+thiz->all_nodes_max)*sizeof(AC_NODE_t *)
+ );
thiz->all_nodes_max += REALLOC_CHUNK_ALLNODES;
- thiz->all_nodes = ndpi_realloc(thiz->all_nodes, thiz->all_nodes_max*sizeof(AC_NODE_t *));
}
thiz->all_nodes[thiz->all_nodes_num++] = node;
}
|
[-]
[+]
|
Changed |
nDPI.tar.bz2/src/lib/third_party/src/node.c
^
|
@@ -189,9 +189,11 @@
/* Manage memory */
if (thiz->matched_patterns_num >= thiz->matched_patterns_max)
{
- thiz->matched_patterns_max += REALLOC_CHUNK_MATCHSTR;
thiz->matched_patterns = (AC_PATTERN_t *) ndpi_realloc
- (thiz->matched_patterns, thiz->matched_patterns_max*sizeof(AC_PATTERN_t));
+ (thiz->matched_patterns, thiz->matched_patterns_max*sizeof(AC_PATTERN_t),
+ (REALLOC_CHUNK_MATCHSTR+thiz->matched_patterns_max)*sizeof(AC_PATTERN_t));
+
+ thiz->matched_patterns_max += REALLOC_CHUNK_MATCHSTR;
}
thiz->matched_patterns[thiz->matched_patterns_num].astring = str->astring;
@@ -209,9 +211,10 @@
{
if(thiz->outgoing_degree >= thiz->outgoing_max)
{
- thiz->outgoing_max += REALLOC_CHUNK_OUTGOING;
thiz->outgoing = (struct edge *) ndpi_realloc
- (thiz->outgoing, thiz->outgoing_max*sizeof(struct edge));
+ (thiz->outgoing, thiz->outgoing_max*sizeof(struct edge),
+ (REALLOC_CHUNK_OUTGOING+thiz->outgoing_max)*sizeof(struct edge));
+ thiz->outgoing_max += REALLOC_CHUNK_OUTGOING;
}
thiz->outgoing[thiz->outgoing_degree].alpha = alpha;
|
|
Added |
nprobe_6.12.130327_svn3352_proplugins.tgz
^
|