aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/mongodb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/protocols/mongodb.c')
-rw-r--r--src/lib/protocols/mongodb.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/lib/protocols/mongodb.c b/src/lib/protocols/mongodb.c
index 38cac1622..12e1fcc4b 100644
--- a/src/lib/protocols/mongodb.c
+++ b/src/lib/protocols/mongodb.c
@@ -68,7 +68,7 @@ static void ndpi_check_mongodb(struct ndpi_detection_module_struct *ndpi_struct,
uint32_t responseFlags;
if (packet->payload_packet_len <= sizeof(mongodb_hdr)) {
- NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
+ NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow);
return;
}
@@ -81,7 +81,7 @@ static void ndpi_check_mongodb(struct ndpi_detection_module_struct *ndpi_struct,
|| (le32toh(mongodb_hdr.message_length) > 1000000) /* Used to avoid false positives */
) {
NDPI_LOG_DBG(ndpi_struct, "Invalid MONGODB length");
- NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
+ NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow);
return;
}
@@ -115,7 +115,7 @@ static void ndpi_check_mongodb(struct ndpi_detection_module_struct *ndpi_struct,
default:
NDPI_LOG_DBG(ndpi_struct, "Invalid MONGODB length");
- NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
+ NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow);
break;
}
}
@@ -125,7 +125,7 @@ static void ndpi_search_mongodb(struct ndpi_detection_module_struct *ndpi_struct
{
// Break after 6 packets.
if(flow->packet_counter > 6) {
- NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
+ NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow);
return;
}
@@ -138,13 +138,9 @@ static void ndpi_search_mongodb(struct ndpi_detection_module_struct *ndpi_struct
/* ********************************* */
-void init_mongodb_dissector(struct ndpi_detection_module_struct *ndpi_struct,
- u_int32_t *id) {
- ndpi_set_bitmask_protocol_detection("MongoDB", ndpi_struct,
- *id, NDPI_PROTOCOL_MONGODB, ndpi_search_mongodb,
- NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
- SAVE_DETECTION_BITMASK_AS_UNKNOWN,
- ADD_TO_DETECTION_BITMASK);
-
- *id += 1;
+void init_mongodb_dissector(struct ndpi_detection_module_struct *ndpi_struct) {
+ register_dissector("MongoDB", ndpi_struct,
+ ndpi_search_mongodb,
+ NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
+ 1, NDPI_PROTOCOL_MONGODB);
}