aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/ndpi_utils.h5
-rw-r--r--src/lib/ndpi_main.c108
-rw-r--r--src/lib/ndpi_utils.c2
3 files changed, 61 insertions, 54 deletions
diff --git a/src/include/ndpi_utils.h b/src/include/ndpi_utils.h
index 340934c60..4d72849e1 100644
--- a/src/include/ndpi_utils.h
+++ b/src/include/ndpi_utils.h
@@ -12,6 +12,7 @@
// #define NDPI_ENABLE_DEBUG_INFO_MESSAGES
// #define NDPI_ENABLE_DEBUG_TRACE_MESSAGES
+#ifdef FRAG_MAN
#ifdef NDPI_ENABLE_DEBUG_POINTER_MESSAGES
#define DBGPOINTER(m, args...) MYDBG(m, ##args)
#else
@@ -58,12 +59,16 @@ typedef struct {
int item_index;
} sorter_index_item_t;
+
/* ***************************************************** */
extern void ins_sort_array(sorter_index_item_t arr[], int len);
extern void shell_sort_array(sorter_index_item_t arr[], int len);
extern void free_fragment(fragments_wrapper_t *frag);
+#endif
+
+
extern void printRawData(const uint8_t *ptr, size_t len);
//extern uint8_t add_segment_to_buffer( struct ndpi_flow_struct *flow, struct ndpi_tcphdr const * tcph, uint32_t waited);
//extern uint8_t check_for_sequence( struct ndpi_flow_struct *flow, struct ndpi_tcphdr const * tcph);
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 696ceefe9..1c69848c6 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -3688,6 +3688,61 @@ void ndpi_apply_flow_protocol_to_packet(struct ndpi_flow_struct *flow, struct nd
memcpy(&packet->protocol_stack_info, &flow->protocol_stack_info, sizeof(packet->protocol_stack_info));
}
+/* ****************************************************** */
+
+void ndpi_free_flow_data(struct ndpi_flow_struct* flow) {
+ if (flow) {
+ if (flow->http.url)
+ ndpi_free(flow->http.url);
+
+ if (flow->http.content_type)
+ ndpi_free(flow->http.content_type);
+
+ if (flow->http.request_content_type)
+ ndpi_free(flow->http.request_content_type);
+
+ if (flow->http.user_agent)
+ ndpi_free(flow->http.user_agent);
+
+ if (flow->kerberos_buf.pktbuf)
+ ndpi_free(flow->kerberos_buf.pktbuf);
+
+ if (flow_is_proto(flow, NDPI_PROTOCOL_QUIC) ||
+ flow_is_proto(flow, NDPI_PROTOCOL_TLS) ||
+ flow_is_proto(flow, NDPI_PROTOCOL_DTLS) ||
+ flow_is_proto(flow, NDPI_PROTOCOL_MAIL_SMTPS) ||
+ flow_is_proto(flow, NDPI_PROTOCOL_MAIL_POPS) ||
+ flow_is_proto(flow, NDPI_PROTOCOL_MAIL_IMAPS)) {
+ if (flow->protos.tls_quic_stun.tls_quic.server_names)
+ ndpi_free(flow->protos.tls_quic_stun.tls_quic.server_names);
+
+ if (flow->protos.tls_quic_stun.tls_quic.alpn)
+ ndpi_free(flow->protos.tls_quic_stun.tls_quic.alpn);
+
+ if (flow->protos.tls_quic_stun.tls_quic.tls_supported_versions)
+ ndpi_free(flow->protos.tls_quic_stun.tls_quic.tls_supported_versions);
+
+ if (flow->protos.tls_quic_stun.tls_quic.issuerDN)
+ ndpi_free(flow->protos.tls_quic_stun.tls_quic.issuerDN);
+
+ if (flow->protos.tls_quic_stun.tls_quic.subjectDN)
+ ndpi_free(flow->protos.tls_quic_stun.tls_quic.subjectDN);
+
+ if (flow->protos.tls_quic_stun.tls_quic.encrypted_sni.esni)
+ ndpi_free(flow->protos.tls_quic_stun.tls_quic.encrypted_sni.esni);
+ }
+
+ if (flow->l4_proto == IPPROTO_TCP) {
+ if (flow->l4.tcp.tls.message.buffer)
+ ndpi_free(flow->l4.tcp.tls.message.buffer);
+#ifdef FRAG_MAN
+ free_fragment(&flow->tcp_segments_list[0]);
+ free_fragment(&flow->tcp_segments_list[1]);
+#endif
+ }
+ }
+}
+
/* ************************************************ */
static int ndpi_init_packet_header(struct ndpi_detection_module_struct *ndpi_str,
@@ -6418,59 +6473,6 @@ uint8_t ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_str,
/* ****************************************************** */
- void ndpi_free_flow_data(struct ndpi_flow_struct *flow) {
- if(flow) {
- if(flow->http.url)
- ndpi_free(flow->http.url);
-
- if(flow->http.content_type)
- ndpi_free(flow->http.content_type);
-
- if(flow->http.request_content_type)
- ndpi_free(flow->http.request_content_type);
-
- if(flow->http.user_agent)
- ndpi_free(flow->http.user_agent);
-
- if(flow->kerberos_buf.pktbuf)
- ndpi_free(flow->kerberos_buf.pktbuf);
-
- if (flow_is_proto(flow, NDPI_PROTOCOL_QUIC) ||
- flow_is_proto(flow, NDPI_PROTOCOL_TLS) ||
- flow_is_proto(flow, NDPI_PROTOCOL_DTLS) ||
- flow_is_proto(flow, NDPI_PROTOCOL_MAIL_SMTPS) ||
- flow_is_proto(flow, NDPI_PROTOCOL_MAIL_POPS) ||
- flow_is_proto(flow, NDPI_PROTOCOL_MAIL_IMAPS)) {
- if(flow->protos.tls_quic_stun.tls_quic.server_names)
- ndpi_free(flow->protos.tls_quic_stun.tls_quic.server_names);
-
- if(flow->protos.tls_quic_stun.tls_quic.alpn)
- ndpi_free(flow->protos.tls_quic_stun.tls_quic.alpn);
-
- if(flow->protos.tls_quic_stun.tls_quic.tls_supported_versions)
- ndpi_free(flow->protos.tls_quic_stun.tls_quic.tls_supported_versions);
-
- if(flow->protos.tls_quic_stun.tls_quic.issuerDN)
- ndpi_free(flow->protos.tls_quic_stun.tls_quic.issuerDN);
-
- if(flow->protos.tls_quic_stun.tls_quic.subjectDN)
- ndpi_free(flow->protos.tls_quic_stun.tls_quic.subjectDN);
-
- if(flow->protos.tls_quic_stun.tls_quic.encrypted_sni.esni)
- ndpi_free(flow->protos.tls_quic_stun.tls_quic.encrypted_sni.esni);
- }
-
- if(flow->l4_proto == IPPROTO_TCP) {
- if(flow->l4.tcp.tls.message.buffer)
- ndpi_free(flow->l4.tcp.tls.message.buffer);
-#ifdef FRAG_MAN
- free_fragment(&flow->tcp_segments_list[0]);
- free_fragment(&flow->tcp_segments_list[1]);
-#endif
- }
- }
- }
-
void ndpi_free_flow(struct ndpi_flow_struct *flow) {
if(flow) {
ndpi_free_flow_data(flow);
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index f69087d2d..749e2e91e 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -1814,6 +1814,7 @@ ndpi_http_method ndpi_http_str2method(const char* method, u_int16_t method_len)
return(NDPI_HTTP_METHOD_UNKNOWN);
}
+#ifdef FRAG_MAN
#define ARRAYSZ_255 255
void printRawData(const uint8_t *ptr, size_t len) {
uint8_t *p=(uint8_t*)ptr;
@@ -1878,7 +1879,6 @@ void shell_sort_array(sorter_index_item_t arr[], int n) {
}
/* ******************************************************************** */
-#ifdef FRAG_MAN
void free_fragment(fragments_wrapper_t *frag) {
/*