added free for flow in get_ndpi_flow - deleted dead part in ndpi_typedef.c
This commit is contained in:
@@ -575,6 +575,7 @@ static void free_ndpi_flow(struct ndpi_flow *flow) {
|
|||||||
if(flow->ndpi_flow) { ndpi_free_flow(flow->ndpi_flow); flow->ndpi_flow = NULL; }
|
if(flow->ndpi_flow) { ndpi_free_flow(flow->ndpi_flow); flow->ndpi_flow = NULL; }
|
||||||
if(flow->src_id) { ndpi_free(flow->src_id); flow->src_id = NULL; }
|
if(flow->src_id) { ndpi_free(flow->src_id); flow->src_id = NULL; }
|
||||||
if(flow->dst_id) { ndpi_free(flow->dst_id); flow->dst_id = NULL; }
|
if(flow->dst_id) { ndpi_free(flow->dst_id); flow->dst_id = NULL; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ***************************************************** */
|
/* ***************************************************** */
|
||||||
@@ -845,18 +846,21 @@ static struct ndpi_flow *get_ndpi_flow(u_int16_t thread_id,
|
|||||||
|
|
||||||
if((newflow->ndpi_flow = malloc_wrapper(size_flow_struct)) == NULL) {
|
if((newflow->ndpi_flow = malloc_wrapper(size_flow_struct)) == NULL) {
|
||||||
printf("[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
printf("[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
||||||
|
free(newflow);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else
|
} else
|
||||||
memset(newflow->ndpi_flow, 0, size_flow_struct);
|
memset(newflow->ndpi_flow, 0, size_flow_struct);
|
||||||
|
|
||||||
if((newflow->src_id = malloc_wrapper(size_id_struct)) == NULL) {
|
if((newflow->src_id = malloc_wrapper(size_id_struct)) == NULL) {
|
||||||
printf("[NDPI] %s(3): not enough memory\n", __FUNCTION__);
|
printf("[NDPI] %s(3): not enough memory\n", __FUNCTION__);
|
||||||
|
free(newflow);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else
|
} else
|
||||||
memset(newflow->src_id, 0, size_id_struct);
|
memset(newflow->src_id, 0, size_id_struct);
|
||||||
|
|
||||||
if((newflow->dst_id = malloc_wrapper(size_id_struct)) == NULL) {
|
if((newflow->dst_id = malloc_wrapper(size_id_struct)) == NULL) {
|
||||||
printf("[NDPI] %s(4): not enough memory\n", __FUNCTION__);
|
printf("[NDPI] %s(4): not enough memory\n", __FUNCTION__);
|
||||||
|
free(newflow);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else
|
} else
|
||||||
memset(newflow->dst_id, 0, size_id_struct);
|
memset(newflow->dst_id, 0, size_id_struct);
|
||||||
@@ -868,7 +872,7 @@ static struct ndpi_flow *get_ndpi_flow(u_int16_t thread_id,
|
|||||||
|
|
||||||
// printFlow(thread_id, newflow);
|
// printFlow(thread_id, newflow);
|
||||||
|
|
||||||
return(newflow);
|
return newflow ;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct ndpi_flow *flow = *(struct ndpi_flow**)ret;
|
struct ndpi_flow *flow = *(struct ndpi_flow**)ret;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ struct ndpi_ipv6hdr {
|
|||||||
struct ndpi_ip6_addr saddr;
|
struct ndpi_ip6_addr saddr;
|
||||||
struct ndpi_ip6_addr daddr;
|
struct ndpi_ip6_addr daddr;
|
||||||
};
|
};
|
||||||
#endif /* NDPI_DETECTION_SUPPORT_IPV6 */
|
#endif
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
u_int32_t ipv4;
|
u_int32_t ipv4;
|
||||||
@@ -310,7 +310,7 @@ struct ndpi_flow_tcp_struct {
|
|||||||
u_int32_t http_stage:2;
|
u_int32_t http_stage:2;
|
||||||
u_int32_t http_empty_line_seen:1;
|
u_int32_t http_empty_line_seen:1;
|
||||||
u_int32_t http_wait_for_retransmission:1;
|
u_int32_t http_wait_for_retransmission:1;
|
||||||
#endif // NDPI_PROTOCOL_HTTP
|
#endif
|
||||||
#ifdef NDPI_PROTOCOL_GNUTELLA
|
#ifdef NDPI_PROTOCOL_GNUTELLA
|
||||||
u_int32_t gnutella_stage:2; // 0 - 2
|
u_int32_t gnutella_stage:2; // 0 - 2
|
||||||
#endif
|
#endif
|
||||||
@@ -467,9 +467,6 @@ typedef struct ndpi_packet_struct {
|
|||||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||||
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||||
|
|
||||||
/* this is for simple read-only access to the real protocol
|
|
||||||
* used for the main loop */
|
|
||||||
/* u_int16_t real_protocol_read_only; */
|
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
__attribute__ ((__packed__))
|
__attribute__ ((__packed__))
|
||||||
@@ -577,6 +574,7 @@ typedef struct ndpi_detection_module_struct {
|
|||||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||||
void *user_data;
|
void *user_data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* callback function buffer */
|
/* callback function buffer */
|
||||||
struct ndpi_call_function_struct callback_buffer[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
struct ndpi_call_function_struct callback_buffer[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||||
u_int32_t callback_buffer_size;
|
u_int32_t callback_buffer_size;
|
||||||
@@ -602,6 +600,7 @@ typedef struct ndpi_detection_module_struct {
|
|||||||
const char *ndpi_debug_print_function;
|
const char *ndpi_debug_print_function;
|
||||||
u_int32_t ndpi_debug_print_line;
|
u_int32_t ndpi_debug_print_line;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* misc parameters */
|
/* misc parameters */
|
||||||
u_int32_t tcp_max_retransmission_window_size;
|
u_int32_t tcp_max_retransmission_window_size;
|
||||||
|
|
||||||
@@ -635,9 +634,9 @@ typedef struct ndpi_detection_module_struct {
|
|||||||
u_int32_t rtsp_connection_timeout;
|
u_int32_t rtsp_connection_timeout;
|
||||||
/* tvants parameters */
|
/* tvants parameters */
|
||||||
u_int32_t tvants_connection_timeout;
|
u_int32_t tvants_connection_timeout;
|
||||||
|
/* rstp */
|
||||||
u_int32_t orb_rstp_ts_timeout;
|
u_int32_t orb_rstp_ts_timeout;
|
||||||
/* yahoo */
|
/* yahoo */
|
||||||
// u_int32_t yahoo_http_filetransfer_timeout;
|
|
||||||
u_int8_t yahoo_detect_http_connections;
|
u_int8_t yahoo_detect_http_connections;
|
||||||
u_int32_t yahoo_lan_video_timeout;
|
u_int32_t yahoo_lan_video_timeout;
|
||||||
u_int32_t zattoo_connection_timeout;
|
u_int32_t zattoo_connection_timeout;
|
||||||
@@ -648,7 +647,6 @@ typedef struct ndpi_detection_module_struct {
|
|||||||
char ip_string[NDPI_IP_STRING_SIZE];
|
char ip_string[NDPI_IP_STRING_SIZE];
|
||||||
#endif
|
#endif
|
||||||
u_int8_t ip_version_limit;
|
u_int8_t ip_version_limit;
|
||||||
/* ********************* */
|
|
||||||
#ifdef NDPI_PROTOCOL_BITTORRENT
|
#ifdef NDPI_PROTOCOL_BITTORRENT
|
||||||
struct hash_ip4p_table *bt_ht;
|
struct hash_ip4p_table *bt_ht;
|
||||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||||
@@ -737,11 +735,9 @@ typedef struct ndpi_flow_struct {
|
|||||||
#ifdef NDPI_PROTOCOL_REDIS
|
#ifdef NDPI_PROTOCOL_REDIS
|
||||||
u_int8_t redis_s2d_first_char, redis_d2s_first_char;
|
u_int8_t redis_s2d_first_char, redis_d2s_first_char;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u_int16_t packet_counter; // can be 0 - 65000
|
u_int16_t packet_counter; // can be 0 - 65000
|
||||||
u_int16_t packet_direction_counter[2];
|
u_int16_t packet_direction_counter[2];
|
||||||
u_int16_t byte_counter[2];
|
u_int16_t byte_counter[2];
|
||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_BITTORRENT
|
#ifdef NDPI_PROTOCOL_BITTORRENT
|
||||||
u_int8_t bittorrent_stage; // can be 0 - 255
|
u_int8_t bittorrent_stage; // can be 0 - 255
|
||||||
#endif
|
#endif
|
||||||
@@ -755,12 +751,11 @@ typedef struct ndpi_flow_struct {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef NDPI_PROTOCOL_HTTP
|
#ifdef NDPI_PROTOCOL_HTTP
|
||||||
u_int32_t http_detected:1;
|
u_int32_t http_detected:1;
|
||||||
#endif // NDPI_PROTOCOL_HTTP
|
#endif
|
||||||
#ifdef NDPI_PROTOCOL_RTSP
|
#ifdef NDPI_PROTOCOL_RTSP
|
||||||
u_int32_t rtsprdt_stage:2;
|
u_int32_t rtsprdt_stage:2;
|
||||||
u_int32_t rtsp_control_flow:1;
|
u_int32_t rtsp_control_flow:1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_YAHOO
|
#ifdef NDPI_PROTOCOL_YAHOO
|
||||||
u_int32_t yahoo_detection_finished:2;
|
u_int32_t yahoo_detection_finished:2;
|
||||||
#endif
|
#endif
|
||||||
@@ -817,9 +812,4 @@ typedef struct ndpi_flow_struct {
|
|||||||
struct ndpi_id_struct *dst;
|
struct ndpi_id_struct *dst;
|
||||||
} ndpi_flow_struct_t;
|
} ndpi_flow_struct_t;
|
||||||
|
|
||||||
/* typedef enum { */
|
|
||||||
/* NDPI_REAL_PROTOCOL = 0, */
|
|
||||||
/* NDPI_CORRELATED_PROTOCOL = 1 */
|
|
||||||
/* } ndpi_protocol_type_t; */
|
|
||||||
|
|
||||||
#endif/* __NDPI_TYPEDEFS_FILE__ */
|
#endif/* __NDPI_TYPEDEFS_FILE__ */
|
||||||
|
|||||||
Reference in New Issue
Block a user