aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example/protos.txt2
-rw-r--r--src/lib/ndpi_main.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/example/protos.txt b/example/protos.txt
index de7dc1c40..4c995f543 100644
--- a/example/protos.txt
+++ b/example/protos.txt
@@ -13,7 +13,7 @@ tcp:3000@ntop
host:"googlesyndacation.com"@Google
host:"venere.com"@Venere
host:"kataweb.it",host:"repubblica.it"@Repubblica
-
+host:"ntop"@ntop
# IP based Subprotocols
# Format:
# ip:<value>,ip:<value>,.....@<subproto>
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 9807183ba..0623433bb 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -2000,6 +2000,21 @@ int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_mod, char* rule,
} else
at[0] = 0, proto = &at[1];
+ for(i=0; proto[i] != '\0'; i++) {
+ switch(proto[i]) {
+ case '/':
+ case '&':
+ case '^':
+ case ':':
+ case ';':
+ case '\'':
+ case '"':
+ case ' ':
+ proto[i] = '_';
+ break;
+ }
+ }
+
for(i=0, def = NULL; i<(int)ndpi_mod->ndpi_num_supported_protocols; i++) {
if(strcasecmp(ndpi_mod->proto_defaults[i].protoName, proto) == 0) {
def = &ndpi_mod->proto_defaults[i];