Add stat of ip reassembly

This commit is contained in:
luwenpeng
2024-04-30 16:19:28 +08:00
parent bdf899cf01
commit 388144b8c0
3 changed files with 88 additions and 4 deletions

View File

@@ -96,6 +96,7 @@ static void *work_thread(void *arg)
char thd_name[16] = {0};
void *plugin_ctx = NULL;
struct packet *pkt = NULL;
struct packet *defraged_pkt = NULL;
struct packet packets[RX_BURST_MAX];
struct session *sess = NULL;
struct packet_io *packet_io = runtime->packet_io;
@@ -130,12 +131,13 @@ static void *work_thread(void *arg)
for (int i = 0; i < nr_recv; i++)
{
sess = NULL;
defraged_pkt = NULL;
pkt = &packets[i];
plugin_manager_dispatch_packet(plug_mgr, pkt);
if (packet_is_fragment(pkt))
{
struct packet *defraged_pkt = ip_reassembly_packet(ip_reass, pkt, now);
defraged_pkt = ip_reassembly_packet(ip_reass, pkt, now);
if (defraged_pkt == NULL)
{
goto fast_path;
@@ -171,11 +173,27 @@ static void *work_thread(void *arg)
update_session_stat(sess, pkt);
if (packet_need_drop(pkt))
{
packet_io_drop(packet_io, thr_idx, pkt, 1);
if (pkt == defraged_pkt)
{
packet_io_drop(packet_io, thr_idx, &packets[i], 1);
packet_free(defraged_pkt);
}
else
{
packet_io_drop(packet_io, thr_idx, pkt, 1);
}
}
else
{
packet_io_egress(packet_io, thr_idx, pkt, 1);
if (pkt == defraged_pkt)
{
packet_io_egress(packet_io, thr_idx, &packets[i], 1);
packet_free(defraged_pkt);
}
else
{
packet_io_egress(packet_io, thr_idx, pkt, 1);
}
}
}