Lib API update

This commit is contained in:
Alfredo Cardigliano 2020-02-20 14:20:39 +01:00
parent 0cd9478ac9
commit 47772a761f
3 changed files with 11 additions and 15 deletions

View file

@ -441,15 +441,9 @@ void Flow::processDetectedProtocol() {
case NDPI_PROTOCOL_TOR:
case NDPI_PROTOCOL_TLS:
#if 0
ntop->getTrace()->traceEvent(TRACE_NORMAL, "-> [client: %s][server: %s]",
ndpiFlow->protos.stun_ssl.ssl.client_certificate,
ndpiFlow->protos.stun_ssl.ssl.server_certificate);
#endif
if((protos.ssl.certificate == NULL)
&& (ndpiFlow->protos.stun_ssl.ssl.client_certificate[0] != '\0')) {
protos.ssl.certificate = strdup(ndpiFlow->protos.stun_ssl.ssl.client_certificate);
&& (ndpiFlow->protos.stun_ssl.ssl.client_requested_server_name[0] != '\0')) {
protos.ssl.certificate = strdup(ndpiFlow->protos.stun_ssl.ssl.client_requested_server_name);
if(protos.ssl.certificate && (strncmp(protos.ssl.certificate, "www.", 4) == 0)) {
if(ndpi_is_proto(ndpiDetectedProtocol, NDPI_PROTOCOL_TOR))
@ -458,8 +452,8 @@ void Flow::processDetectedProtocol() {
}
if((protos.ssl.server_certificate == NULL)
&& (ndpiFlow->protos.stun_ssl.ssl.server_certificate[0] != '\0')) {
protos.ssl.server_certificate = strdup(ndpiFlow->protos.stun_ssl.ssl.server_certificate);
&& (ndpiFlow->protos.stun_ssl.ssl.server_names != NULL)) {
protos.ssl.server_certificate = strdup(ndpiFlow->protos.stun_ssl.ssl.server_names);
}
if(check_tor) {
@ -550,8 +544,8 @@ void Flow::setDetectedProtocol(ndpi_protocol proto_id, bool forceDetection) {
if((proto_id.master_protocol == NDPI_PROTOCOL_TLS)
&& (get_packets() < NDPI_MIN_NUM_PACKETS)
&& (ndpiFlow)
&& (ndpiFlow->protos.stun_ssl.ssl.client_certificate[0] == '\0'
|| ndpiFlow->protos.stun_ssl.ssl.server_certificate[0] == '\0')) {
&& (ndpiFlow->protos.stun_ssl.ssl.client_requested_server_name[0] == '\0'
|| ndpiFlow->protos.stun_ssl.ssl.server_names == NULL)) {
/*
Should never be mangled directly, returning is enough.
*/

View file

@ -165,7 +165,7 @@ NetworkInterface::NetworkInterface(const char *name,
macs_hash = new MacHash(this, num_hashes, ntop->getPrefs()->get_max_num_hosts());
// init global detection structure
ndpi_struct = ndpi_init_detection_module();
ndpi_struct = ndpi_init_detection_module(ndpi_no_prefs);
if(ndpi_struct == NULL) {
exit(-1);
@ -174,7 +174,6 @@ NetworkInterface::NetworkInterface(const char *name,
if(ntop->getCustomnDPIProtos() != NULL)
ndpi_load_protocols_file(ndpi_struct, ntop->getCustomnDPIProtos());
ndpi_set_detection_preferences(ndpi_struct, ndpi_pref_http_dont_dissect_response, 1);
/*
commit f2a5bbef173ee7f5447871f26024b9639735c096
Author: Luca Deri <deri@ntop.org>
@ -215,6 +214,9 @@ NetworkInterface::NetworkInterface(const char *name,
ndpi_struct = NULL, db = NULL, ifSpeed = 0;
}
if(ndpi_struct != NULL)
ndpi_finalize_initalization(ndpi_struct);
networkStats = NULL;
#ifdef NTOPNG_PRO

View file

@ -194,7 +194,7 @@ Prefs::~Prefs() {
void nDPIusage() {
printf("\nnDPI detected protocols:\n");
struct ndpi_detection_module_struct *ndpi_struct = ndpi_init_detection_module();
struct ndpi_detection_module_struct *ndpi_struct = ndpi_init_detection_module(ndpi_no_prefs);
ndpi_dump_protocols(ndpi_struct);
exit(0);