update TCP utils
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
#include "session_timer.h"
|
||||
#include "session_queue.h"
|
||||
#include "session_manager.h"
|
||||
#include "tcp_helpers.h"
|
||||
#include "udp_helpers.h"
|
||||
#include "tcp_utils.h"
|
||||
#include "udp_utils.h"
|
||||
#include "packet_helpers.h"
|
||||
#include "dupkt_filter.h"
|
||||
#include "eviction_filter.h"
|
||||
@@ -390,13 +390,13 @@ static inline void session_update_tcp_state(struct session *sess, const struct l
|
||||
{
|
||||
const struct tcphdr *hdr = (const struct tcphdr *)tcp_layer->hdr_ptr;
|
||||
uint64_t state = session_get_tcp_state(sess);
|
||||
if (tcp_hdr_has_flag_syn(hdr))
|
||||
if (tcp_hdr_get_syn_flag(hdr))
|
||||
{
|
||||
state |= (tcp_hdr_has_flag_ack(hdr) ? TCP_SYNACK_RECVED : TCP_SYN_RECVED);
|
||||
state |= (tcp_hdr_get_ack_flag(hdr) ? TCP_SYNACK_RECVED : TCP_SYN_RECVED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tcp_hdr_has_flag_ack(hdr))
|
||||
if (tcp_hdr_get_ack_flag(hdr))
|
||||
{
|
||||
if (curr_dir == SESSION_DIR_C2S)
|
||||
{
|
||||
@@ -408,7 +408,7 @@ static inline void session_update_tcp_state(struct session *sess, const struct l
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tcp_hdr_has_flag_fin(hdr))
|
||||
if (tcp_hdr_get_fin_flag(hdr))
|
||||
{
|
||||
if (curr_dir == SESSION_DIR_C2S)
|
||||
{
|
||||
@@ -419,7 +419,7 @@ static inline void session_update_tcp_state(struct session *sess, const struct l
|
||||
state |= TCP_S2C_FIN_RECVED;
|
||||
}
|
||||
}
|
||||
if (tcp_hdr_has_flag_rst(hdr))
|
||||
if (tcp_hdr_get_rst_flag(hdr))
|
||||
{
|
||||
if (curr_dir == SESSION_DIR_C2S)
|
||||
{
|
||||
@@ -608,7 +608,7 @@ static inline void session_manager_update_session_base(struct session_manager *m
|
||||
|
||||
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);
|
||||
uint64_t len = packet_get_len(pkt);
|
||||
if (curr_dir == SESSION_DIR_C2S)
|
||||
{
|
||||
session_inc_c2s_metrics(sess, 1, len);
|
||||
@@ -809,7 +809,7 @@ static inline struct session *session_manager_new_tcp_session(struct session_man
|
||||
}
|
||||
|
||||
const struct tcphdr *hdr = (const struct tcphdr *)tcp_layer->hdr_ptr;
|
||||
if (!tcp_hdr_has_flag_syn(hdr))
|
||||
if (!tcp_hdr_get_syn_flag(hdr))
|
||||
{
|
||||
mgr->npkts_hit_tcp_miss_sess++;
|
||||
return NULL;
|
||||
@@ -841,7 +841,7 @@ static inline struct session *session_manager_new_tcp_session(struct session_man
|
||||
struct session *sess = session_pool_alloc(mgr->sess_pool);
|
||||
assert(sess);
|
||||
|
||||
enum session_dir curr_dir = tcp_hdr_has_flag_ack(hdr) ? SESSION_DIR_S2C : SESSION_DIR_C2S;
|
||||
enum session_dir curr_dir = tcp_hdr_get_ack_flag(hdr) ? SESSION_DIR_S2C : SESSION_DIR_C2S;
|
||||
session_manager_update_session_base(mgr, sess, key, curr_dir);
|
||||
session_manager_update_session_packet(mgr, sess, pkt, curr_dir);
|
||||
session_update_tcp_state(sess, tcp_layer, curr_dir);
|
||||
|
||||
Reference in New Issue
Block a user