Refactored packet API to support struct layer (using union to contain different types of encapsulation headers)
This commit is contained in:
@@ -488,7 +488,7 @@ static int duplicated_packet_bypass(struct session_manager *mgr, struct session
|
||||
if (duplicated_packet_filter_lookup(mgr->dup_pkt_filter, pkt, now))
|
||||
{
|
||||
session_inc_stat(sess, dir, STAT_DUPLICATE_PACKETS_BYPASS, 1);
|
||||
session_inc_stat(sess, dir, STAT_DUPLICATE_BYTES_BYPASS, packet_get_len(pkt));
|
||||
session_inc_stat(sess, dir, STAT_DUPLICATE_BYTES_BYPASS, packet_get_raw_len(pkt));
|
||||
switch (session_get_type(sess))
|
||||
{
|
||||
case SESSION_TYPE_TCP:
|
||||
@@ -572,18 +572,13 @@ static void session_update(struct session *sess, enum session_state next_state,
|
||||
}
|
||||
|
||||
session_inc_stat(sess, dir, STAT_RAW_PACKETS_RECEIVED, 1);
|
||||
session_inc_stat(sess, dir, STAT_RAW_BYTES_RECEIVED, packet_get_len(pkt));
|
||||
session_inc_stat(sess, dir, STAT_RAW_BYTES_RECEIVED, packet_get_raw_len(pkt));
|
||||
|
||||
if (!session_get_first_packet(sess, dir))
|
||||
{
|
||||
struct route_ctx ctx = {0};
|
||||
struct sid_list list = {0};
|
||||
packet_get_route_ctx(pkt, &ctx);
|
||||
packet_get_sid_list(pkt, &list);
|
||||
|
||||
session_set_first_packet(sess, dir, packet_dup(pkt));
|
||||
session_set_route_ctx(sess, dir, &ctx);
|
||||
session_set_sid_list(sess, dir, &list);
|
||||
session_set_route_ctx(sess, dir, packet_get_route_ctx(pkt));
|
||||
session_set_sids(sess, dir, packet_get_sids(pkt));
|
||||
}
|
||||
|
||||
session_set_current_packet(sess, pkt);
|
||||
@@ -1044,8 +1039,8 @@ void session_manager_free_session(struct session_manager *mgr, struct session *s
|
||||
session_set_first_packet(sess, FLOW_DIRECTION_S2C, NULL);
|
||||
session_clear_route_ctx(sess, FLOW_DIRECTION_C2S);
|
||||
session_clear_route_ctx(sess, FLOW_DIRECTION_S2C);
|
||||
session_clear_sid_list(sess, FLOW_DIRECTION_C2S);
|
||||
session_clear_sid_list(sess, FLOW_DIRECTION_S2C);
|
||||
session_clear_sids(sess, FLOW_DIRECTION_C2S);
|
||||
session_clear_sids(sess, FLOW_DIRECTION_S2C);
|
||||
session_set_current_packet(sess, NULL);
|
||||
session_set_current_flow_direction(sess, FLOW_DIRECTION_NONE);
|
||||
session_pool_push(mgr->sess_pool, sess);
|
||||
|
||||
Reference in New Issue
Block a user