STUN: major code rework (#2116)
Try to have a faster classification, on first packet; use standard extra dissection data path for sub-classification, metadata extraction and monitoring. STUN caches: * use the proper confidence value * lookup into the caches only once per flow, after having found a proper STUN classification Add identification of Telegram VoIP calls.
This commit is contained in:
+13
-8
@@ -2176,6 +2176,11 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
|
||||
"ETHEREUM", NDPI_PROTOCOL_CATEGORY_CRYPTO_CURRENCY,
|
||||
ndpi_build_default_ports(ports_a, 30303, 0, 0, 0, 0) /* TCP */,
|
||||
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
||||
ndpi_set_proto_defaults(ndpi_str, 0 /* encrypted */, 1 /* app proto */, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_TELEGRAM_VOIP,
|
||||
"TelegramVoip", NDPI_PROTOCOL_CATEGORY_VOIP,
|
||||
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
||||
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
||||
|
||||
|
||||
#ifdef CUSTOM_NDPI_PROTOCOLS
|
||||
#include "../../../nDPI-custom/custom_ndpi_main.c"
|
||||
@@ -7082,14 +7087,6 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st
|
||||
if(ret.app_protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||
return(ret);
|
||||
|
||||
if((flow->guessed_protocol_id == NDPI_PROTOCOL_STUN) ||
|
||||
(enable_guess &&
|
||||
flow->stun.num_binding_requests > 0 &&
|
||||
flow->stun.num_processed_pkts > 0)) {
|
||||
ndpi_set_detected_protocol(ndpi_str, flow, NDPI_PROTOCOL_STUN, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI_PARTIAL);
|
||||
ret.app_protocol = flow->detected_protocol_stack[0];
|
||||
}
|
||||
|
||||
/* Check some caches */
|
||||
|
||||
/* Does it looks like BitTorrent? */
|
||||
@@ -8582,6 +8579,14 @@ void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_str, s
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
void ndpi_reset_detected_protocol(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow) {
|
||||
flow->detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||
flow->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN;
|
||||
flow->confidence = NDPI_CONFIDENCE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow) {
|
||||
return(flow->detected_protocol_stack[1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user