aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 9c6432de0..8ff3855af 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -1571,6 +1571,11 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
no_master, "MQTT", NDPI_PROTOCOL_CATEGORY_RPC,
ndpi_build_default_ports(ports_a, 1883, 8883, 0, 0, 0), /* TCP */
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0)); /* UDP */
+ ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_SOMEIP,
+ no_master,
+ no_master, "SOME/IP", NDPI_PROTOCOL_CATEGORY_RPC,
+ ndpi_build_default_ports(ports_a, 30491, 30501, 0, 0, 0), /* TCP */
+ ndpi_build_default_ports(ports_b, 30491, 30501, 30490, 0, 0)); /* UDP */
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_RX,
no_master,
no_master, "RX", NDPI_PROTOCOL_CATEGORY_RPC,
@@ -1622,9 +1627,6 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
ndpi_build_default_ports(ports_a, 655, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 655, 0, 0, 0, 0) /* UDP */);
-/* To be removed as soon as we define new protocols */
- ndpi_init_placeholder_proto(ndpi_mod, ports_a, ports_b, no_master, NDPI_PROTOCOL_FREE_224);
-
/* calling function for host and content matched protocols */
init_string_based_protocols(ndpi_mod);
@@ -1640,11 +1642,14 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
static int ac_match_handler(AC_MATCH_t *m, void *param) {
int *matching_protocol_id = (int*)param;
- /* Stopping to the first match. We might consider searching
- * for the more specific match, paying more cpu cycles. */
+ /*
+ Return 1 for stopping to the first match.
+ We might consider searching for the more
+ specific match, paying more cpu cycles.
+ */
*matching_protocol_id = m->patterns[0].rep.number;
- return 1; /* 0 to continue searching, !0 to stop */
+ return 0; /* 0 to continue searching, !0 to stop */
}
/* ******************************************************************** */
@@ -2691,6 +2696,9 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
/* MQTT */
init_mqtt_dissector(ndpi_struct, &a, detection_bitmask);
+ /* SOME/IP */
+ init_someip_dissector(ndpi_struct, &a, detection_bitmask);
+
/* RX */
init_rx_dissector(ndpi_struct, &a, detection_bitmask);
@@ -4493,6 +4501,9 @@ const char* ndpi_category_str(ndpi_protocol_category_t category) {
case NDPI_PROTOCOL_CATEGORY_UNSPECIFIED:
return("Unspecified");
break;
+ case NDPI_PROTOCOL_CATEGORY_SW_UPDATE:
+ return("SoftwareUpdate");
+ break;
case NDPI_PROTOCOL_NUM_CATEGORIES:
return("Code should not use this internal constant");
break;
@@ -4615,9 +4626,9 @@ char* ndpi_strnstr(const char *s, const char *find, size_t slen) {
int ndpi_match_prefix(const u_int8_t *payload, size_t payload_len,
const char *str, size_t str_len)
{
- return str_len <= payload_len
- ? memcmp(payload, str, str_len) == 0
- : 0;
+ int rc = str_len <= payload_len ? memcmp(payload, str, str_len) == 0 : 0;
+
+ return rc;
}
/* ****************************************************** */
@@ -4628,7 +4639,8 @@ int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_stru
int matching_protocol_id = NDPI_PROTOCOL_UNKNOWN;
AC_TEXT_t ac_input_text;
ndpi_automa *automa = is_host_match ? &ndpi_struct->host_automa : &ndpi_struct->content_automa;
-
+ int rc;
+
if((automa->ac_automa == NULL) || (string_to_match_len == 0)) return(NDPI_PROTOCOL_UNKNOWN);
if(!automa->ac_automa_finalized) {
@@ -4638,6 +4650,7 @@ int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_stru
ac_input_text.astring = string_to_match, ac_input_text.length = string_to_match_len;
ac_automata_search(((AC_AUTOMATA_t*)automa->ac_automa), &ac_input_text, (void*)&matching_protocol_id);
+
ac_automata_reset(((AC_AUTOMATA_t*)automa->ac_automa));
return(matching_protocol_id);