]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #615 in SNORT/snort3 from ha-tcp-stream to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Thu, 8 Sep 2016 19:33:14 +0000 (15:33 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Thu, 8 Sep 2016 19:33:14 +0000 (15:33 -0400)
Squashed commit of the following:

commit 8ed6a1c5d87cafdf9fd3319a8ae41b65378207d5
Author: Ed Borgoyn <eborgoyn@cisco.com>
Date:   Wed Sep 7 13:10:29 2016 -0400

    Needed additional calls to *HAManager::process_deletion()

commit 8d921b570018695ce9db9b308c8d730d18133afe
Author: Ed Borgoyn <eborgoyn@cisco.com>
Date:   Fri Sep 2 12:58:05 2016 -0400

    Updates got TCP flow HA.

src/stream/ip/ip_session.cc
src/stream/libtcp/tcp_stream_session.cc
src/stream/tcp/tcp_ha.cc
src/stream/tcp/tcp_session.cc
src/stream/udp/udp_session.cc

index 68fa2ff1ee9d60dcca25722cb531ff3c109de1df..34390a12b7db1f3552d5bf84b351980ee8ef9648 100644 (file)
@@ -177,6 +177,7 @@ int IpSession::process(Packet* p)
         if ( flow_con->expected_session(flow, p))
             return 0;
 #endif
+        IpHAManager::process_deletion(flow);
     }
 
     if ( stream.blocked_session(flow, p) || stream.ignored_session(flow, p) )
index e7d4c883a6e954e4e2d072392f92acb252ddee52..2a56fa616ec35c0a5ff80bd9d30e4eb4ed1b70f5 100644 (file)
@@ -22,6 +22,7 @@
 #include "log/messages.h"
 #include "main/snort_debug.h"
 #include "sfip/sf_ip.h"
+#include "stream/tcp/tcp_ha.h"
 
 #include "tcp_stream_session.h"
 
@@ -437,6 +438,7 @@ void TcpStreamSession::clear()
     if ( tcp_init )
         // this does NOT flush data
         clear_session( true, false, false );
+    TcpHAManager::process_deletion(flow);
 }
 
 void TcpStreamSession::set_splitter(bool to_server, StreamSplitter* ss)
index ad2c394a6381d174801722dbffb0ab0008072d9e..85b9ac2313c77bac1b02685b66d76af5203a266b 100644 (file)
@@ -41,9 +41,18 @@ Flow* TcpHA::create_session(FlowKey* key)
 
 }
 
-void TcpHA::deactivate_session(Flow*)
+void TcpHA::deactivate_session(Flow* flow)
 {
     DebugMessage(DEBUG_HA,"TcpHA::deactivate_session)\n");
+    assert( flow );
+    if ( flow->session )
+        ((TcpSession*)(flow->session))->clear_session(true, true, false);
+
+    flow->session_state &= ~( STREAM_STATE_SYN | STREAM_STATE_SYN_ACK |
+            STREAM_STATE_ACK | STREAM_STATE_ESTABLISHED );
+
+    assert( flow->ha_state );
+    flow->clear_session_flags( SSNFLAG_SEEN_CLIENT | SSNFLAG_SEEN_SERVER );
 }
 
 THREAD_LOCAL TcpHA* TcpHAManager::tcp_ha = nullptr;
index 06197f66217df30188f77d789858f28989af6e11..b77d971fa6f488ba1a58e3da20018b4407558c11 100644 (file)
@@ -1043,6 +1043,7 @@ void TcpSession::cleanup_session_if_expired(Packet* p)
             clear_session(true, true, false, p);
 
         tcpStats.timeouts++;
+        TcpHAManager::process_deletion(flow);
     }
 }
 
index 0b091ea818ecc7b6285b3abb2ffd599304b9e74c..87d6fd39623c4034c9f770eb6b7784a8da859c77 100644 (file)
@@ -200,6 +200,7 @@ int UdpSession::process(Packet* p)
         flow->ssn_state.session_flags |= SSNFLAG_SEEN_SENDER;
         udpStats.created++; // FIXIT-M is this correct? will mess with calc of current sessions
         udpStats.timeouts++;
+        UdpHAManager::process_deletion(flow);
     }
 
     ProcessUdp(flow, p, pc, nullptr);