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

@@ -194,7 +194,6 @@ static void *work_thread(void *arg)
* Suggestion: After modifying the system time, restart the service to ensure consistent timing. * Suggestion: After modifying the system time, restart the service to ensure consistent timing.
*/ */
now_ms = stellar_get_real_time_msec(); 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); nr_recv = packet_io_ingress(packet_io, thr_idx, packets, RX_BURST_MAX);
if (nr_recv == 0) if (nr_recv == 0)
{ {
@@ -218,12 +217,10 @@ static void *work_thread(void *arg)
else else
{ {
pkt = defraged_pkt; pkt = defraged_pkt;
plugin_manager_on_packet_ingress(plug_mgr, pkt); plugin_manager_on_packet_ingress(plug_mgr, defraged_pkt);
plugin_manager_on_packet_egress(plug_mgr, pkt);
} }
} }
pkt = &packets[i];
sess = session_manager_lookup_session_by_packet(sess_mgr, pkt); sess = session_manager_lookup_session_by_packet(sess_mgr, pkt);
if (sess == NULL) if (sess == NULL)
{ {
@@ -250,7 +247,15 @@ static void *work_thread(void *arg)
fast_path: fast_path:
plugin_manager_on_session_egress(sess, pkt); 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); plugin_manager_on_packet_egress(plug_mgr, pkt);
}
if (sess && session_get_current_state(sess) == SESSION_STATE_DISCARD) if (sess && session_get_current_state(sess) == SESSION_STATE_DISCARD)
{ {