fix: plugin_manager_on_packet_egress called incorrectly when IP is defragmented

This commit is contained in:
luwenpeng
2024-08-14 10:57:08 +08:00
parent a64837d19d
commit e8e2d5e548

View File

@@ -166,7 +166,7 @@ static void *work_thread(void *arg)
memset(packets, 0, sizeof(packets));
for(int i=0; i<RX_BURST_MAX; i++)
for (int i = 0; i < RX_BURST_MAX; i++)
{
packet_set_user_data(&packets[i], (void *)plug_mgr);
}
@@ -194,7 +194,6 @@ static void *work_thread(void *arg)
* Suggestion: After modifying the system time, restart the service to ensure consistent timing.
*/
now_ms = stellar_get_real_time_msec();
//memset(packets, 0, sizeof(packets));
nr_recv = packet_io_ingress(packet_io, thr_idx, packets, RX_BURST_MAX);
if (nr_recv == 0)
{
@@ -218,12 +217,10 @@ static void *work_thread(void *arg)
else
{
pkt = defraged_pkt;
plugin_manager_on_packet_ingress(plug_mgr, pkt);
plugin_manager_on_packet_egress(plug_mgr, pkt);
plugin_manager_on_packet_ingress(plug_mgr, defraged_pkt);
}
}
pkt = &packets[i];
sess = session_manager_lookup_session_by_packet(sess_mgr, pkt);
if (sess == NULL)
{
@@ -250,7 +247,15 @@ static void *work_thread(void *arg)
fast_path:
plugin_manager_on_session_egress(sess, pkt);
if (pkt == defraged_pkt)
{
plugin_manager_on_packet_egress(plug_mgr, defraged_pkt);
plugin_manager_on_packet_egress(plug_mgr, &packets[i]);
}
else
{
plugin_manager_on_packet_egress(plug_mgr, pkt);
}
if (sess && session_get_current_state(sess) == SESSION_STATE_DISCARD)
{
@@ -435,7 +440,7 @@ static void stellar_thread_join(struct stellar_runtime *runtime, struct stellar_
int stellar_run(int argc __attribute__((unused)), char **argv __attribute__((unused)))
{
static struct stellar st={};
static struct stellar st = {};
struct stellar_runtime *runtime = &st.runtime;
struct stellar_config *config = &st.config;