SCE支持动态更新sid list; SCE存储raw packet/decrypted packet共计4个方向的metadata

This commit is contained in:
luwenpeng
2023-05-06 10:41:30 +08:00
parent 1577f489c9
commit bd899c08f1
8 changed files with 309 additions and 29 deletions

View File

@@ -28,6 +28,21 @@ int metadata_is_empty(struct metadata *meta)
}
}
void metadata_shallow_copy(struct metadata *dst, struct metadata *src)
{
dst->write_ref++;
dst->session_id = src->session_id;
dst->raw_data = NULL;
dst->raw_len = 0;
dst->l7offset = src->l7offset;
dst->is_e2i_dir = src->is_e2i_dir;
dst->is_ctrl_pkt = src->is_ctrl_pkt;
dst->is_decrypted = src->is_decrypted;
sids_copy(&dst->sids, &src->sids);
route_ctx_copy(&dst->route_ctx, &src->route_ctx);
}
void metadata_deep_copy(struct metadata *dst, struct metadata *src)
{
dst->write_ref++;
@@ -70,6 +85,8 @@ struct session_ctx *session_ctx_new()
fixed_num_array_init(&session_ctx->rule_ids);
session_ctx->decrypted_meta_i2e = metadata_new();
session_ctx->decrypted_meta_e2i = metadata_new();
session_ctx->raw_meta_i2e = metadata_new();
session_ctx->raw_meta_e2i = metadata_new();
session_ctx->ctrl_meta = metadata_new();
@@ -81,6 +98,18 @@ void session_ctx_free(struct session_ctx *session_ctx)
{
if (session_ctx)
{
if (session_ctx->decrypted_meta_i2e)
{
metadata_free(session_ctx->decrypted_meta_i2e);
session_ctx->decrypted_meta_i2e = NULL;
}
if (session_ctx->decrypted_meta_e2i)
{
metadata_free(session_ctx->decrypted_meta_e2i);
session_ctx->decrypted_meta_e2i = NULL;
}
if (session_ctx->raw_meta_i2e)
{
metadata_free(session_ctx->raw_meta_i2e);