aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2020-04-07 19:17:37 +0200
committerLuca Deri <deri@ntop.org>2020-04-07 19:17:37 +0200
commitdb8497778ddc578a58caf5447f0b5de3972f64c6 (patch)
treeddd498ece57a403f7ff133e6135309e0182762b6 /src/lib/ndpi_main.c
parentdea883a25d97a9b5564cfb6b9d1b0d61a8a818f3 (diff)
Fixes #853 and adds a self check for duplicates
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 4a187c9a9..5c016174b 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -691,6 +691,24 @@ static void destroy_hyperscan(struct ndpi_detection_module_struct *ndpi_str) {
/* ******************************************************************** */
+/* Self check function to be called onli for testing purposes */
+void ndpi_self_check_host_match() {
+ u_int32_t i, j;
+
+ for(i=0; host_match[i].string_to_match != NULL; i++) {
+ for(j=0; host_match[j].string_to_match != NULL; j++) {
+ if((i != j) && (strcmp(host_match[i].string_to_match, host_match[j].string_to_match) == 0)) {
+ printf("[INTERNAL ERROR]: Duplicate string detected '%s' [id: %u, id %u]\n",
+ host_match[i].string_to_match, i, j);
+ printf("\nPlease fix host_match[] in ndpi_content_match.c.inc\n");
+ exit(0);
+ }
+ }
+ }
+}
+
+/* ******************************************************************** */
+
static void init_string_based_protocols(struct ndpi_detection_module_struct *ndpi_str) {
int i;