Compare commits
8
Commits
dev
...
4.4-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
299fc4d1ff | ||
|
|
13b9a27e83 | ||
|
|
0aeb97492c | ||
|
|
9b775fc100 | ||
|
|
d2e7673a1e | ||
|
|
3dc1129cb2 | ||
|
|
dd8953cb64 | ||
|
|
2c5258b19d |
+2
-2
@@ -1,4 +1,4 @@
|
||||
AC_INIT([libndpi],[4.3.0])
|
||||
AC_INIT([libndpi],[4.4.0])
|
||||
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
@@ -31,7 +31,7 @@ AS_IF([test "${with_sanitizer+set}" = set -a "${with_thread_sanitizer+set}" = se
|
||||
AS_IF([test "${with_sanitizer+set}" = set -o "${with_thread_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -O0 -g3"
|
||||
],[
|
||||
CFLAGS="${CFLAGS} -g"
|
||||
CFLAGS="${CFLAGS} -O2"
|
||||
])
|
||||
|
||||
AS_IF([test "${with_sanitizer+set}" = set],[
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "ndpi_config.h"
|
||||
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
@@ -105,7 +105,7 @@ static u_int16_t num_loops = 1;
|
||||
static u_int8_t shutdown_app = 0, quiet_mode = 0;
|
||||
static u_int8_t num_threads = 1;
|
||||
static struct timeval startup_time, begin, end;
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
static int core_affinity[MAX_NUM_READER_THREADS];
|
||||
#endif
|
||||
static struct timeval pcap_start = { 0, 0}, pcap_end = { 0, 0 };
|
||||
@@ -456,7 +456,7 @@ static void help(u_int long_help) {
|
||||
" -k <file> | Specify a file to write serialized detection results\n"
|
||||
" -K <format> | Specify the serialization format for `-k'\n"
|
||||
" | Valid formats are tlv, csv or json (default)\n"
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
" -g <id:id...> | Thread affinity mask (one core id per thread)\n"
|
||||
#endif
|
||||
" -a <mode> | Generates option values for GUIs\n"
|
||||
@@ -781,7 +781,7 @@ static void parseOptions(int argc, char **argv) {
|
||||
#ifndef USE_DPDK
|
||||
char *__pcap_file = NULL;
|
||||
int thread_id, do_capture = 0;
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
char *bind_mask = NULL;
|
||||
u_int num_cores = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#endif
|
||||
@@ -853,7 +853,7 @@ static void parseOptions(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
#ifndef USE_DPDK
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
case 'g':
|
||||
bind_mask = optarg;
|
||||
break;
|
||||
@@ -1091,7 +1091,7 @@ static void parseOptions(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
#ifndef USE_DPDK
|
||||
for(thread_id = 0; thread_id < num_threads; thread_id++)
|
||||
core_affinity[thread_id] = -1;
|
||||
@@ -4017,7 +4017,7 @@ void * processing_thread(void *_thread_id) {
|
||||
char pcap_error_buffer[PCAP_ERRBUF_SIZE];
|
||||
#endif
|
||||
|
||||
#if defined(linux) && defined(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||
#if defined(__linux__) && defined(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||
if(core_affinity[thread_id] >= 0) {
|
||||
cpu_set_t cpuset;
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
%{?el6:%define libdir /usr/lib}
|
||||
%{?el7:%define libdir /usr/lib}
|
||||
%{?el8:%define libdir /usr/lib64}
|
||||
%{?el9:%define libdir /usr/lib64}
|
||||
%define bindir /usr/bin
|
||||
|
||||
%install
|
||||
|
||||
+25
-19
@@ -2182,16 +2182,18 @@ static u_int64_t ndpi_host_ip_risk_ptree_match(struct ndpi_detection_module_stru
|
||||
/* Check isuerDN exception */
|
||||
u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
|
||||
char *issuerDN) {
|
||||
ndpi_list *head = ndpi_str->trusted_issuer_dn;
|
||||
|
||||
if(issuerDN != NULL) {
|
||||
ndpi_list *head = ndpi_str->trusted_issuer_dn;
|
||||
|
||||
while(head != NULL) {
|
||||
if(strcmp(issuerDN, head->value) == 0)
|
||||
return(1); /* This is a trusted DN */
|
||||
else
|
||||
head = head->next;
|
||||
}
|
||||
}
|
||||
|
||||
return(0 /* no exception */);
|
||||
return(0 /* no exception */);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
@@ -2200,23 +2202,27 @@ u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct
|
||||
static u_int8_t ndpi_check_hostname_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *hostname) {
|
||||
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
|
||||
u_int8_t ret = 0;
|
||||
|
||||
if(automa->ac_automa) {
|
||||
AC_TEXT_t ac_input_text;
|
||||
AC_REP_t match;
|
||||
|
||||
ac_input_text.astring = hostname, ac_input_text.length = strlen(hostname);
|
||||
ac_input_text.option = 0;
|
||||
|
||||
if(ac_automata_search(automa->ac_automa, &ac_input_text, &match) > 0) {
|
||||
if(flow) flow->risk_mask &= match.number64;
|
||||
ret = 1;
|
||||
}
|
||||
if(hostname == NULL)
|
||||
return(0);
|
||||
else {
|
||||
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
|
||||
u_int8_t ret = 0;
|
||||
|
||||
if(automa->ac_automa) {
|
||||
AC_TEXT_t ac_input_text;
|
||||
AC_REP_t match;
|
||||
|
||||
ac_input_text.astring = hostname, ac_input_text.length = strlen(hostname);
|
||||
ac_input_text.option = 0;
|
||||
|
||||
if(ac_automata_search(automa->ac_automa, &ac_input_text, &match) > 0) {
|
||||
if(flow) flow->risk_mask &= match.number64;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
+37
-4
@@ -42,6 +42,10 @@
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(linux) || defined(__linux__)
|
||||
static u_int8_t cached_has_aesni = 0, has_aesni_checked = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AES-NI support detection routine
|
||||
*/
|
||||
@@ -56,12 +60,41 @@ int mbedtls_aesni_has_support( unsigned int what )
|
||||
#if defined(linux) || defined(__linux__)
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) == 0)
|
||||
{
|
||||
return 0;
|
||||
if(has_aesni_checked == 0) {
|
||||
/*
|
||||
NOTE
|
||||
|
||||
This code is necessary as __get_cpuid() is not reliable
|
||||
Example with Intel(R) Celeron(R) CPU N2930 (that has NO AES-NI)
|
||||
the code based on __get_cpuid() reports that AES-NI is present
|
||||
and thus nDPI crashes on such platform.
|
||||
*/
|
||||
FILE *fd = fopen("/proc/cpuinfo", "r");
|
||||
|
||||
if(fd != NULL) {
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
u_int8_t num_lines = 0;
|
||||
|
||||
while(getline(&line, &len, fd) != -1) {
|
||||
if(strstr(line, "aes")) {
|
||||
/* printf("FOUND %s", line); */
|
||||
cached_has_aesni = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(++num_lines > 99)
|
||||
break; /* We giveup */
|
||||
}
|
||||
|
||||
free(line);
|
||||
fclose(fd);
|
||||
|
||||
has_aesni_checked = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ( (ecx & what) != 0 );
|
||||
return(cached_has_aesni);
|
||||
#elif defined(WIN32) || defined(WIN64)
|
||||
int cpuInfo[4];
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef linux
|
||||
#ifdef __linux__
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user