add session id generator

This commit is contained in:
luwenpeng
2024-01-31 14:45:50 +08:00
parent 2766b3cfeb
commit 97ef872d9a
21 changed files with 385 additions and 167 deletions

View File

@@ -13,6 +13,7 @@
#include "packet_helpers.h"
#include "dupkt_filter.h"
#include "eviction_filter.h"
#include "id_generator.h"
struct session_manager
{
@@ -58,54 +59,54 @@ struct session_manager
uint64_t npkts_hit_udp_evicted; // fast forward
};
static void tcp_init_timeout_cb(struct session *sess, void *arg);
static void tcp_handshake_timeout_cb(struct session *sess, void *arg);
static void tcp_data_timeout_cb(struct session *sess, void *arg);
static void tcp_half_closed_timeout_cb(struct session *sess, void *arg);
static void tcp_time_wait_timeout_cb(struct session *sess, void *arg);
static void udp_data_timeout_cb(struct session *sess, void *arg);
static inline void tcp_init_timeout_cb(struct session *sess, void *arg);
static inline void tcp_handshake_timeout_cb(struct session *sess, void *arg);
static inline void tcp_data_timeout_cb(struct session *sess, void *arg);
static inline void tcp_half_closed_timeout_cb(struct session *sess, void *arg);
static inline void tcp_time_wait_timeout_cb(struct session *sess, void *arg);
static inline void udp_data_timeout_cb(struct session *sess, void *arg);
static int session_manager_check_config(struct session_manager_config *config);
static uint64_t session_manager_alloc_session_id(void);
static int session_manager_update_tcp_filter(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir);
static inline int session_manager_check_config(struct session_manager_config *config);
static inline uint64_t session_manager_alloc_session_id(void);
static inline int session_manager_update_tcp_filter(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir);
static enum session_dir judge_direction_by_tuple6(const struct tuple6 *key);
static enum session_dir judge_direction_by_session(const struct session *sess, const struct tuple6 *key);
static inline enum session_dir judge_direction_by_tuple6(const struct tuple6 *key);
static inline enum session_dir judge_direction_by_session(const struct session *sess, const struct tuple6 *key);
static void session_update_tcp_state(struct session *sess, const struct layer_record *tcp_layer, enum session_dir curr_dir);
static void session_update_udp_state(struct session *sess, const struct layer_record *udp_layer, enum session_dir curr_dir);
static inline void session_update_tcp_state(struct session *sess, const struct layer_record *tcp_layer, enum session_dir curr_dir);
static inline void session_update_udp_state(struct session *sess, const struct layer_record *udp_layer, enum session_dir curr_dir);
static void session_manager_update_session_state(struct session_manager *mgr, struct session *sess, enum session_state state);
static void session_manager_update_session_timer(struct session_manager *mgr, struct session *sess, session_expire_cb expire_cb, uint64_t timeout_sec);
static void session_manager_update_session_base(struct session_manager *mgr, struct session *sess, const struct tuple6 *key, enum session_dir curr_dir);
static void session_manager_update_session_packet(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir);
static inline void session_manager_update_session_state(struct session_manager *mgr, struct session *sess, enum session_state state);
static inline void session_manager_update_session_timer(struct session_manager *mgr, struct session *sess, session_expire_cb expire_cb, uint64_t timeout_sec);
static inline void session_manager_update_session_base(struct session_manager *mgr, struct session *sess, const struct tuple6 *key, enum session_dir curr_dir);
static inline void session_manager_update_session_packet(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir);
static void session_manager_update_udp_to_opening(struct session_manager *mgr, struct session *sess);
static void session_manager_update_udp_to_active(struct session_manager *mgr, struct session *sess);
static void session_manager_update_udp_to_closing(struct session_manager *mgr, struct session *sess);
static void session_manager_update_tcp_to_opening(struct session_manager *mgr, struct session *sess, int opening_by_syn);
static void session_manager_update_tcp_to_active(struct session_manager *mgr, struct session *sess);
static void session_manager_update_tcp_to_closing(struct session_manager *mgr, struct session *sess, int enable_time_wait);
static void session_manager_update_session_to_closed(struct session_manager *mgr, struct session *sess);
static inline void session_manager_update_udp_to_opening(struct session_manager *mgr, struct session *sess);
static inline void session_manager_update_udp_to_active(struct session_manager *mgr, struct session *sess);
static inline void session_manager_update_udp_to_closing(struct session_manager *mgr, struct session *sess);
static inline void session_manager_update_tcp_to_opening(struct session_manager *mgr, struct session *sess, int opening_by_syn);
static inline void session_manager_update_tcp_to_active(struct session_manager *mgr, struct session *sess);
static inline void session_manager_update_tcp_to_closing(struct session_manager *mgr, struct session *sess, int enable_time_wait);
static inline void session_manager_update_session_to_closed(struct session_manager *mgr, struct session *sess);
static void session_manager_handle_tcp_on_opening(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state);
static void session_manager_handle_tcp_on_active(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state);
static void session_manager_handle_tcp_on_closing(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state);
static inline void session_manager_handle_tcp_on_opening(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state);
static inline void session_manager_handle_tcp_on_active(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state);
static inline void session_manager_handle_tcp_on_closing(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state);
static struct session *session_manager_new_tcp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key);
static struct session *session_manager_new_udp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key);
static struct session *session_manager_update_tcp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key);
static struct session *session_manager_update_udp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key);
static inline struct session *session_manager_new_tcp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key);
static inline struct session *session_manager_new_udp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key);
static inline struct session *session_manager_update_tcp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key);
static inline struct session *session_manager_update_udp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key);
static void session_manager_free_session(struct session_manager *mgr, struct session *sess);
static void session_manager_recycle_session(struct session_manager *mgr);
static void session_manager_evicte_session(struct session_manager *mgr, struct session *sess);
static inline void session_manager_free_session(struct session_manager *mgr, struct session *sess);
static inline void session_manager_recycle_session(struct session_manager *mgr);
static inline void session_manager_evicte_session(struct session_manager *mgr, struct session *sess);
/******************************************************************************
* Private API
******************************************************************************/
static void tcp_init_timeout_cb(struct session *sess, void *arg)
static inline void tcp_init_timeout_cb(struct session *sess, void *arg)
{
SESSION_LOG_DEBUG("run tcp_init_timeout_cb on session %lu", session_get_id(sess));
struct session_manager *mgr = (struct session_manager *)arg;
@@ -118,7 +119,7 @@ static void tcp_init_timeout_cb(struct session *sess, void *arg)
session_manager_update_tcp_to_closing(mgr, sess, 1);
}
static void tcp_handshake_timeout_cb(struct session *sess, void *arg)
static inline void tcp_handshake_timeout_cb(struct session *sess, void *arg)
{
SESSION_LOG_DEBUG("run tcp_handshake_timeout_cb on session %lu", session_get_id(sess));
struct session_manager *mgr = (struct session_manager *)arg;
@@ -131,7 +132,7 @@ static void tcp_handshake_timeout_cb(struct session *sess, void *arg)
session_manager_update_tcp_to_closing(mgr, sess, 1);
}
static void tcp_data_timeout_cb(struct session *sess, void *arg)
static inline void tcp_data_timeout_cb(struct session *sess, void *arg)
{
SESSION_LOG_DEBUG("run tcp_data_timeout_cb on session %lu", session_get_id(sess));
struct session_manager *mgr = (struct session_manager *)arg;
@@ -144,7 +145,7 @@ static void tcp_data_timeout_cb(struct session *sess, void *arg)
session_manager_update_tcp_to_closing(mgr, sess, 1);
}
static void tcp_half_closed_timeout_cb(struct session *sess, void *arg)
static inline void tcp_half_closed_timeout_cb(struct session *sess, void *arg)
{
SESSION_LOG_DEBUG("run tcp_half_closed_timeout_cb on session %lu", session_get_id(sess));
struct session_manager *mgr = (struct session_manager *)arg;
@@ -157,7 +158,7 @@ static void tcp_half_closed_timeout_cb(struct session *sess, void *arg)
session_manager_update_tcp_to_closing(mgr, sess, 1);
}
static void tcp_time_wait_timeout_cb(struct session *sess, void *arg)
static inline void tcp_time_wait_timeout_cb(struct session *sess, void *arg)
{
SESSION_LOG_DEBUG("run tcp_time_wait_timeout_cb on session %lu", session_get_id(sess));
struct session_manager *mgr = (struct session_manager *)arg;
@@ -166,7 +167,7 @@ static void tcp_time_wait_timeout_cb(struct session *sess, void *arg)
session_manager_free_session(mgr, sess);
}
static void udp_data_timeout_cb(struct session *sess, void *arg)
static inline void udp_data_timeout_cb(struct session *sess, void *arg)
{
SESSION_LOG_DEBUG("run udp_data_timeout_cb on session %lu", session_get_id(sess));
struct session_manager *mgr = (struct session_manager *)arg;
@@ -181,7 +182,7 @@ static void udp_data_timeout_cb(struct session *sess, void *arg)
// return 0: success
// return -1: invalid config
static int session_manager_check_config(struct session_manager_config *config)
static inline int session_manager_check_config(struct session_manager_config *config)
{
if (config == NULL)
{
@@ -306,15 +307,14 @@ static int session_manager_check_config(struct session_manager_config *config)
return 0;
}
// TODO
static uint64_t session_manager_alloc_session_id(void)
static inline uint64_t session_manager_alloc_session_id(void)
{
return 0;
return id_generator_get();
}
// return 1: duplicate packet
// return 0: not duplicate packet
static int session_manager_update_tcp_filter(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir)
static inline int session_manager_update_tcp_filter(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir)
{
if (curr_dir == SESSION_DIR_C2S)
{
@@ -352,7 +352,7 @@ dupkt_fitler:
}
}
static enum session_dir judge_direction_by_tuple6(const struct tuple6 *key)
static inline enum session_dir judge_direction_by_tuple6(const struct tuple6 *key)
{
uint16_t src_port = ntohs(key->src_port);
uint16_t dst_port = ntohs(key->dst_port);
@@ -374,7 +374,7 @@ static enum session_dir judge_direction_by_tuple6(const struct tuple6 *key)
}
}
static enum session_dir judge_direction_by_session(const struct session *sess, const struct tuple6 *key)
static inline enum session_dir judge_direction_by_session(const struct session *sess, const struct tuple6 *key)
{
if (tuple6_cmp(session_get0_key(sess), key) == 0)
{
@@ -386,7 +386,7 @@ static enum session_dir judge_direction_by_session(const struct session *sess, c
}
}
static void session_update_tcp_state(struct session *sess, const struct layer_record *tcp_layer, enum session_dir curr_dir)
static inline void session_update_tcp_state(struct session *sess, const struct layer_record *tcp_layer, enum session_dir curr_dir)
{
const struct tcphdr *hdr = (const struct tcphdr *)tcp_layer->hdr_ptr;
uint64_t state = session_get_tcp_state(sess);
@@ -445,7 +445,7 @@ static void session_update_tcp_state(struct session *sess, const struct layer_re
session_set_tcp_state(sess, (enum tcp_state)state);
}
static void session_update_udp_state(struct session *sess, const struct layer_record *udp_layer, enum session_dir curr_dir)
static inline void session_update_udp_state(struct session *sess, const struct layer_record *udp_layer, enum session_dir curr_dir)
{
uint64_t state = session_get_udp_state(sess);
if (curr_dir == SESSION_DIR_C2S)
@@ -487,7 +487,7 @@ on closing update session
[*] session_set_closing_reasion
*/
static void session_manager_update_session_state(struct session_manager *mgr, struct session *sess, enum session_state state)
static inline void session_manager_update_session_state(struct session_manager *mgr, struct session *sess, enum session_state state)
{
// session state not change
if (session_get_state(sess) == state)
@@ -582,14 +582,14 @@ static void session_manager_update_session_state(struct session_manager *mgr, st
session_set_state(sess, state);
}
static void session_manager_update_session_timer(struct session_manager *mgr, struct session *sess, session_expire_cb expire_cb, uint64_t timeout_sec)
static inline void session_manager_update_session_timer(struct session_manager *mgr, struct session *sess, session_expire_cb expire_cb, uint64_t timeout_sec)
{
session_timer_del_session(mgr->sess_timer, sess);
session_set_expirecb(sess, expire_cb, mgr, timestamp_get_sec() + timeout_sec);
session_timer_add_session(mgr->sess_timer, sess);
}
static void session_manager_update_session_base(struct session_manager *mgr, struct session *sess, const struct tuple6 *key, enum session_dir curr_dir)
static inline void session_manager_update_session_base(struct session_manager *mgr, struct session *sess, const struct tuple6 *key, enum session_dir curr_dir)
{
session_init(sess);
session_set_id(sess, session_manager_alloc_session_id());
@@ -606,7 +606,7 @@ static void session_manager_update_session_base(struct session_manager *mgr, str
session_set_create_time(sess, timestamp_get_sec());
}
static void session_manager_update_session_packet(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir)
static inline void session_manager_update_session_packet(struct session_manager *mgr, struct session *sess, const struct packet *pkt, enum session_dir curr_dir)
{
uint64_t len = packet_get_raw_len(pkt);
if (curr_dir == SESSION_DIR_C2S)
@@ -630,19 +630,19 @@ static void session_manager_update_session_packet(struct session_manager *mgr, s
session_set_last_time(sess, timestamp_get_sec());
}
static void session_manager_update_udp_to_opening(struct session_manager *mgr, struct session *sess)
static inline void session_manager_update_udp_to_opening(struct session_manager *mgr, struct session *sess)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_OPENING);
session_manager_update_session_timer(mgr, sess, udp_data_timeout_cb, mgr->config.udp_timeout_data);
}
static void session_manager_update_udp_to_active(struct session_manager *mgr, struct session *sess)
static inline void session_manager_update_udp_to_active(struct session_manager *mgr, struct session *sess)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_ACTIVE);
session_manager_update_session_timer(mgr, sess, udp_data_timeout_cb, mgr->config.udp_timeout_data);
}
static void session_manager_update_udp_to_closing(struct session_manager *mgr, struct session *sess)
static inline void session_manager_update_udp_to_closing(struct session_manager *mgr, struct session *sess)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_CLOSING);
session_timer_del_session(mgr->sess_timer, sess);
@@ -650,7 +650,7 @@ static void session_manager_update_udp_to_closing(struct session_manager *mgr, s
eviction_filter_add(mgr->udp_eviction_filter, session_get0_1st_pkt(sess));
}
static void session_manager_update_tcp_to_opening(struct session_manager *mgr, struct session *sess, int opening_by_syn)
static inline void session_manager_update_tcp_to_opening(struct session_manager *mgr, struct session *sess, int opening_by_syn)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_OPENING);
if (opening_by_syn)
@@ -663,13 +663,13 @@ static void session_manager_update_tcp_to_opening(struct session_manager *mgr, s
}
}
static void session_manager_update_tcp_to_active(struct session_manager *mgr, struct session *sess)
static inline void session_manager_update_tcp_to_active(struct session_manager *mgr, struct session *sess)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_ACTIVE);
session_manager_update_session_timer(mgr, sess, tcp_data_timeout_cb, mgr->config.tcp_timeout_data);
}
static void session_manager_update_tcp_to_closing(struct session_manager *mgr, struct session *sess, int enable_time_wait)
static inline void session_manager_update_tcp_to_closing(struct session_manager *mgr, struct session *sess, int enable_time_wait)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_CLOSING);
if (enable_time_wait)
@@ -682,7 +682,7 @@ static void session_manager_update_tcp_to_closing(struct session_manager *mgr, s
}
}
static void session_manager_update_session_to_closed(struct session_manager *mgr, struct session *sess)
static inline void session_manager_update_session_to_closed(struct session_manager *mgr, struct session *sess)
{
session_manager_update_session_state(mgr, sess, SESSION_STATE_CLOSED);
session_timer_del_session(mgr->sess_timer, sess);
@@ -691,7 +691,7 @@ static void session_manager_update_session_to_closed(struct session_manager *mgr
// opening -> opening
// opening -> active
// opening -> closing
static void session_manager_handle_tcp_on_opening(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state)
static inline void session_manager_handle_tcp_on_opening(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state)
{
uint64_t tcp_mod_state = tcp_curr_state & (~tcp_old_state);
@@ -760,7 +760,7 @@ static void session_manager_handle_tcp_on_opening(struct session_manager *mgr, s
// active -> active
// active -> closing
static void session_manager_handle_tcp_on_active(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state)
static inline void session_manager_handle_tcp_on_active(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state)
{
// active -> closing
if ((tcp_curr_state & TCP_C2S_FIN_RECVED) && (tcp_curr_state & TCP_S2C_FIN_RECVED))
@@ -793,13 +793,13 @@ static void session_manager_handle_tcp_on_active(struct session_manager *mgr, st
// closing -> closing
// closing -> closed
static void session_manager_handle_tcp_on_closing(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state)
static inline void session_manager_handle_tcp_on_closing(struct session_manager *mgr, struct session *sess, enum tcp_state tcp_old_state, enum tcp_state tcp_curr_state)
{
// still closing
session_manager_update_tcp_to_closing(mgr, sess, 1);
}
static struct session *session_manager_new_tcp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key)
static inline struct session *session_manager_new_tcp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key)
{
const struct layer_record *tcp_layer = packet_get_innermost_layer(pkt, LAYER_TYPE_TCP);
if (tcp_layer == NULL)
@@ -846,7 +846,11 @@ static struct session *session_manager_new_tcp_session(struct session_manager *m
session_manager_update_session_packet(mgr, sess, pkt, curr_dir);
session_update_tcp_state(sess, tcp_layer, curr_dir);
char buffer[128] = {0};
tuple6_tostring(session_get0_key(sess), buffer, sizeof(buffer));
SESSION_LOG_DEBUG("session new: %lu %s", session_get_id(sess), buffer);
SESSION_LOG_DEBUG("TCP %s received, session %lu init -> opening", (curr_dir == SESSION_DIR_C2S ? "SYN" : "SYNACK"), session_get_id(sess));
session_manager_update_tcp_to_opening(mgr, sess, curr_dir == SESSION_DIR_C2S);
session_table_add_session(mgr->tcp_sess_table, key, sess);
dupkt_filter_add(mgr->tcp_dupkt_filter, pkt);
@@ -854,7 +858,7 @@ static struct session *session_manager_new_tcp_session(struct session_manager *m
return sess;
}
static struct session *session_manager_new_udp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key)
static inline struct session *session_manager_new_udp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key)
{
if (eviction_filter_lookup(mgr->udp_eviction_filter, pkt))
{
@@ -895,10 +899,15 @@ static struct session *session_manager_new_udp_session(struct session_manager *m
session_manager_update_udp_to_opening(mgr, sess);
session_table_add_session(mgr->udp_sess_table, key, sess);
char buffer[128] = {0};
tuple6_tostring(session_get0_key(sess), buffer, sizeof(buffer));
SESSION_LOG_DEBUG("session new: %lu %s", session_get_id(sess), buffer);
SESSION_LOG_DEBUG("UDP %s first packet received, session %lu init -> opening", (curr_dir == SESSION_DIR_C2S ? "C2S" : "S2C"), session_get_id(sess));
return sess;
}
static struct session *session_manager_update_tcp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key)
static inline struct session *session_manager_update_tcp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key)
{
const struct layer_record *tcp_layer = packet_get_innermost_layer(pkt, LAYER_TYPE_TCP);
if (tcp_layer == NULL)
@@ -942,7 +951,7 @@ static struct session *session_manager_update_tcp_session(struct session_manager
return sess;
}
static struct session *session_manager_update_udp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key)
static inline struct session *session_manager_update_udp_session(struct session_manager *mgr, struct session *sess, const struct packet *pkt, const struct tuple6 *key)
{
enum session_dir curr_dir = judge_direction_by_session(sess, key);
session_manager_update_session_packet(mgr, sess, pkt, curr_dir);
@@ -968,7 +977,7 @@ static struct session *session_manager_update_udp_session(struct session_manager
return sess;
}
static void session_manager_free_session(struct session_manager *mgr, struct session *sess)
static inline void session_manager_free_session(struct session_manager *mgr, struct session *sess)
{
if (sess)
{
@@ -990,7 +999,7 @@ static void session_manager_free_session(struct session_manager *mgr, struct ses
}
}
static void session_manager_recycle_session(struct session_manager *mgr)
static inline void session_manager_recycle_session(struct session_manager *mgr)
{
while (1)
{
@@ -1003,7 +1012,7 @@ static void session_manager_recycle_session(struct session_manager *mgr)
}
}
static void session_manager_evicte_session(struct session_manager *mgr, struct session *sess)
static inline void session_manager_evicte_session(struct session_manager *mgr, struct session *sess)
{
session_set_closing_reasion(sess, CLOSING_BY_EVICTED);
session_manager_update_session_state(mgr, sess, SESSION_STATE_CLOSING);
@@ -1091,8 +1100,32 @@ error:
void session_manager_destroy(struct session_manager *mgr)
{
struct session *sess;
if (mgr)
{
// move all evicted session to closed queue
while (mgr->sess_evicted_queue && session_manager_get_evicted_session(mgr))
{
}
// free all closed queue
if (mgr->sess_toclosed_queue)
{
session_manager_recycle_session(mgr);
}
// free all udp session which is not in closed state
while (mgr->udp_sess_table && (sess = session_table_find_least_recently_unused_session(mgr->udp_sess_table)))
{
session_manager_free_session(mgr, sess);
}
// free all tcp session which is not in closed state
while (mgr->tcp_sess_table && (sess = session_table_find_least_recently_unused_session(mgr->tcp_sess_table)))
{
session_manager_free_session(mgr, sess);
}
eviction_filter_destroy(mgr->udp_eviction_filter);
dupkt_filter_destroy(mgr->tcp_dupkt_filter);
session_queue_destroy(mgr->sess_toclosed_queue);