aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r--src/lib/ndpi_utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index d6f5b7f60..ff56bb61d 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -3023,3 +3023,11 @@ u_int32_t ndpi_nearest_power_of_two(u_int32_t x) {
return(x);
}
+/* ******************************************* */
+
+int tpkt_verify_hdr(const struct ndpi_packet_struct * const packet)
+{
+ return ((packet->tcp != NULL) && (packet->payload_packet_len > 4) &&
+ (packet->payload[0] == 3) && (packet->payload[1] == 0) &&
+ (get_u_int16_t(packet->payload,2) == htons(packet->payload_packet_len)));
+}