aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/tls.c
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2021-01-20 09:53:30 +0100
committerLuca <deri@ntop.org>2021-01-20 09:53:30 +0100
commit0809956e5f9ebbe11d5e11bebaf0c390eb993464 (patch)
treefa5629e9c65cb68952b569d8ff475771105cac74 /src/lib/protocols/tls.c
parente9f43516ec06638783fd03dea3aba0112584f566 (diff)
Rewored UPnP protocol that in essence was WSD hence it has been renamed
Cleaned up TLS code for DTLS detection by defining a new DTLS protocol
Diffstat (limited to 'src/lib/protocols/tls.c')
-rw-r--r--src/lib/protocols/tls.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c
index 1e2027712..9933ca8b2 100644
--- a/src/lib/protocols/tls.c
+++ b/src/lib/protocols/tls.c
@@ -858,7 +858,7 @@ static int ndpi_search_tls_udp(struct ndpi_detection_module_struct *ndpi_struct,
// handshake_type = packet->payload[13];
handshake_len = (packet->payload[14] << 16) + (packet->payload[15] << 8) + packet->payload[16];
-
+
if((handshake_len+25) != packet->payload_packet_len)
goto no_dtls;
@@ -871,7 +871,7 @@ static int ndpi_search_tls_udp(struct ndpi_detection_module_struct *ndpi_struct,
packet->payload = p;
packet->payload_packet_len = p_len; /* Restore */
- ndpi_int_tls_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_TLS);
+ ndpi_int_tls_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DTLS);
return(1); /* Keep working */
}
@@ -895,6 +895,9 @@ static void ndpi_int_tls_add_connection(struct ndpi_detection_module_struct *ndp
printf("[TLS] %s()\n", __FUNCTION__);
#endif
+ if((flow->packet.udp != NULL) && (protocol == NDPI_PROTOCOL_TLS))
+ protocol = NDPI_PROTOCOL_DTLS;
+
if((flow->detected_protocol_stack[0] == protocol)
|| (flow->detected_protocol_stack[1] == protocol)) {
if(!flow->check_extra_packets)
@@ -907,7 +910,7 @@ static void ndpi_int_tls_add_connection(struct ndpi_detection_module_struct *ndp
else
protocol = ndpi_tls_refine_master_protocol(ndpi_struct, flow, protocol);
- ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_TLS);
+ ndpi_set_detected_protocol(ndpi_struct, flow, protocol, protocol);
tlsInitExtraPacketProcessing(ndpi_struct, flow);
}
@@ -1637,8 +1640,8 @@ void init_tls_dissector(struct ndpi_detection_module_struct *ndpi_struct,
/* *************************************************** */
- ndpi_set_bitmask_protocol_detection("TLS", ndpi_struct, detection_bitmask, *id,
- NDPI_PROTOCOL_TLS,
+ ndpi_set_bitmask_protocol_detection("DTLS", ndpi_struct, detection_bitmask, *id,
+ NDPI_PROTOCOL_DTLS,
ndpi_search_tls_wrapper,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,