]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2337 in SNORT/snort3 from ~DAVMCPHE/snort3:meta-ack-bugfix to...
authorDavis McPherson (davmcphe) <davmcphe@cisco.com>
Sat, 18 Jul 2020 12:07:01 +0000 (12:07 +0000)
committerDavis McPherson (davmcphe) <davmcphe@cisco.com>
Sat, 18 Jul 2020 12:07:01 +0000 (12:07 +0000)
Squashed commit of the following:

commit facdc89e9bc8937a7cd33d4063dc0a9a50fbdf58
Author: davis mcpherson <davmcphe@cisco.com>
Date:   Wed Jul 15 16:20:24 2020 -0400

    stream_tcp: when clearing a session during meta-ack processing pass a nullptr as the Packet* parameter

src/stream/tcp/tcp_state_closed.cc
src/stream/tcp/tcp_state_closing.cc
src/stream/tcp/tcp_state_last_ack.cc
src/stream/tcp/tcp_state_time_wait.cc

index 582d593f673f4ff8df326f0a1e8e478080e4b70c..575e69e829474e8241de3a2f6ebb58e0143bd69c 100644 (file)
@@ -143,7 +143,7 @@ bool TcpStateClosed::do_post_sm_packet_actions(TcpSegmentDescriptor& tsd, TcpStr
         {
             // The last ACK is a part of the session. Delete the session after processing is
             // complete.
-            trk.session->clear_session(false, true, false, tsd.get_pkt() );
+            trk.session->clear_session(false, true, false, tsd.is_meta_ack_packet() ? nullptr : tsd.get_pkt() );
             flow->session_state |= STREAM_STATE_CLOSED;
             trk.session->set_pkt_action_flag(ACTION_LWSSN_CLOSED);
         }
index 132585fcea5296eda27227331720f65cb2212886..22c5b3ee7bbdb45a877e6932bc6ce8894a8ad9ab 100644 (file)
@@ -136,7 +136,7 @@ bool TcpStateClosing::do_post_sm_packet_actions(TcpSegmentDescriptor& tsd, TcpSt
             ( trk.session->get_listener_state(tsd) == TcpStreamTracker::TCP_TIME_WAIT ) )
         {
             Flow* flow = tsd.get_flow();
-            trk.session->clear_session(false, true, false, tsd.get_pkt() );
+            trk.session->clear_session(false, true, false, tsd.is_meta_ack_packet() ? nullptr : tsd.get_pkt() );
             flow->session_state |= STREAM_STATE_CLOSED;
             trk.session->set_pkt_action_flag(ACTION_LWSSN_CLOSED);
         }
index 2f1f54dcb54ae8a9d8e484fde8a0f83239ded446..c779edcec88120a2a0749848ec0d5745173d4f31 100644 (file)
@@ -134,9 +134,8 @@ bool TcpStateLastAck::do_post_sm_packet_actions(TcpSegmentDescriptor& tsd, TcpSt
         if ( ( talker_state == TcpStreamTracker::TCP_TIME_WAIT )
             || ( talker_state == TcpStreamTracker::TCP_CLOSED ) )
         {
-            // The last ACK is a part of the session. Delete the session after processing is
-            // complete.
-            trk.session->clear_session(false, true, false, tsd.get_pkt() );
+            // The last ACK is a part of the session. Delete session after processing the ack
+            trk.session->clear_session(false, true, false, tsd.is_meta_ack_packet() ? nullptr : tsd.get_pkt() );
             flow->session_state |= STREAM_STATE_CLOSED;
             trk.session->set_pkt_action_flag(ACTION_LWSSN_CLOSED);
         }
index 679d1153de9c94ca73313105daffeb328ffb1676..2787bae09f9715e95763a348fa4ad6ff9fc93cac 100644 (file)
@@ -120,7 +120,7 @@ bool TcpStateTimeWait::do_post_sm_packet_actions(TcpSegmentDescriptor& tsd, TcpS
         {
             // The last ACK is a part of the session. Delete the session after processing is
             // complete.
-            trk.session->clear_session(false, true, false, tsd.get_pkt() );
+            trk.session->clear_session(false, true, false, tsd.is_meta_ack_packet() ? nullptr : tsd.get_pkt() );
             flow->session_state |= STREAM_STATE_CLOSED;
             trk.session->set_pkt_action_flag(ACTION_LWSSN_CLOSED);
         }