Skip to content

Commit

Permalink
Fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
vel21ripn committed Nov 11, 2024
1 parent 3c82662 commit b45b732
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lib/ndpi_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ bool ndpi_address_cache_insert(struct ndpi_address_cache *cache,
}

/* ***************************************************** */

#ifndef __KERNEL__
bool ndpi_address_cache_dump(struct ndpi_address_cache *cache,
char *path, u_int32_t epoch_now) {
FILE *fd = fopen(path, "w");
Expand Down Expand Up @@ -472,7 +472,7 @@ u_int32_t ndpi_address_cache_restore(struct ndpi_address_cache *cache, char *pat

return(num_added);
}

#endif
/* ***************************************************** */
/* ***************************************************** */

Expand Down Expand Up @@ -500,7 +500,7 @@ struct ndpi_address_cache_item* ndpi_cache_address_find(struct ndpi_detection_mo
}

/* ***************************************************** */

#ifndef __KERNEL__
bool ndpi_cache_address_dump(struct ndpi_detection_module_struct *ndpi_struct, char *path, u_int32_t epoch_now) {
if(ndpi_struct->address_cache == NULL) return(false);

Expand All @@ -520,7 +520,7 @@ u_int32_t ndpi_cache_address_restore(struct ndpi_detection_module_struct *ndpi_s

return(ndpi_address_cache_restore(ndpi_struct->address_cache, path, epoch_now));
}

#endif
/* ***************************************************** */

u_int32_t ndpi_cache_address_flush_expired(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t epoch_now) {
Expand Down
9 changes: 8 additions & 1 deletion src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11874,6 +11874,13 @@ static const struct cfg_param {

{ "rtp", "search_for_stun", "disable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(rtp_search_for_stun), NULL, 1 },

{ "openvpn", "dpi.heuristics", "0x00", "0", "0x01", CFG_PARAM_INT, __OFF(openvpn_heuristics), NULL, 1 },
{ "openvpn", "dpi.heuristics.num_messages", "10", "0", "255", CFG_PARAM_INT, __OFF(openvpn_heuristics_num_msgs), NULL, 1 },
{ "openvpn", "subclassification_by_ip", "enable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(openvpn_subclassification_by_ip), NULL, 1 },

{ "wireguard", "subclassification_by_ip", "enable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(wireguard_subclassification_by_ip), NULL, 1 },


{ "$PROTO_NAME_OR_ID", "log", "disable", NULL, NULL, CFG_PARAM_PROTOCOL_ENABLE_DISABLE, __OFF(debug_bitmask), NULL, 1 },
{ "$PROTO_NAME_OR_ID", "ip_list.load", "1", NULL, NULL, CFG_PARAM_PROTOCOL_ENABLE_DISABLE, __OFF(ip_list_bitmask), NULL, 0 },
{ "$PROTO_NAME_OR_ID", "monitoring", "disable", NULL, NULL, CFG_PARAM_PROTOCOL_ENABLE_DISABLE, __OFF(monitoring), NULL, 1 },
Expand All @@ -11885,7 +11892,7 @@ static const struct cfg_param {
{ NULL, "flow.track_payload", "disable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(track_payload_enabled), NULL, 0 },
{ NULL, "flow.use_client_ip_in_guess", "enable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(use_client_ip_in_guess), NULL, 1},
{ NULL, "flow.use_client_port_in_guess", "enable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(use_client_port_in_guess), NULL, 1},
{ NULL, "tcp_ack_payload_heuristic", "disable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(tcp_ack_paylod_heuristic), NULL, 1 },
{ NULL, "tcp_ack_payload_heuristic", "enable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(tcp_ack_paylod_heuristic), NULL, 1 },
{ NULL, "fully_encrypted_heuristic", "enable", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(fully_encrypted_heuristic), NULL, 1 },
{ NULL, "libgcrypt.init", "1", NULL, NULL, CFG_PARAM_ENABLE_DISABLE, __OFF(libgcrypt_init), NULL, 0 },
{ NULL, "dpi.guess_on_giveup", "0x3", "0", "3", CFG_PARAM_INT, __OFF(guess_on_giveup), NULL, 1 },
Expand Down
6 changes: 5 additions & 1 deletion src/lib/ndpi_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ void *ndpi_malloc(size_t size) {

void *ndpi_calloc(unsigned long count, size_t size) {
size_t len = count * size;
#ifndef __KERNEL__
void *p = _ndpi_malloc ? _ndpi_malloc(len) : malloc(len);
#else
void *p = _ndpi_malloc(len);
#endif

if(p) {
memset(p, 0, len);
#ifndef __KERNEL__
__sync_fetch_and_add(&ndpi_tot_allocated_memory, size);
__sync_fetch_and_add(&ndpi_tot_allocated_memory, len);
#endif
}

Expand Down

0 comments on commit b45b732

Please sign in to comment.