]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1778 in SNORT/snort3 from ~THOPETER/snort3:small_seg4 to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Thu, 3 Oct 2019 11:57:56 +0000 (07:57 -0400)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Thu, 3 Oct 2019 11:57:56 +0000 (07:57 -0400)
Squashed commit of the following:

commit 916155bb5155a0f6985f0225f0718cba1013a705
Author: Tom Peters <thopeter@cisco.com>
Date:   Wed Oct 2 12:06:04 2019 -0400

    stream: clean up cppcheck warnings

src/stream/ip/ip_defrag.cc
src/stream/libtcp/tcp_stream_session.cc
src/stream/stream.cc
src/stream/tcp/tcp_session.cc

index a807ee9ed062d548c27ba28318c2d51b9b78e1ea..4673c607dcf95e0bdcb78f4ec7b94b0a5b7d2439 100644 (file)
@@ -1103,10 +1103,7 @@ int Defrag::insert(Packet* p, FragTracker* ft, FragEngine* fe)
     if (p->is_ip6() && (net_frag_offset == 0))
     {
         const ip::IP6Frag* const fragHdr = layer::get_inner_ip6_frag();
-        if (ft->ip_proto != fragHdr->ip6f_nxt)
-        {
-            ft->ip_proto = fragHdr->ip6f_nxt;
-        }
+        ft->ip_proto = fragHdr->ip6f_nxt;
     }
 
     /*
@@ -1119,7 +1116,7 @@ int Defrag::insert(Packet* p, FragTracker* ft, FragEngine* fe)
      * truncated.  Don't want to try to copy more than we actually
      * captured. Use dsize as the frag length since it is distance
      * between the last succesfully decoded layer (which is ip6_frag
-     *  or ipv4) and the end of packet, */
+     * or ipv4) and the end of packet, */
     len = fragLength = p->dsize;
     fragStart = p->data;
 
index 843b8ee9ab656df57aeb5963e74ad0e926db2b08..a0583947826a4b706ab5612b5ee54147ddbab577 100644 (file)
@@ -327,22 +327,6 @@ void TcpStreamSession::GetPacketHeaderFoo(DAQ_PktHdr_t* pkth, uint32_t dir)
     pkth->address_space_id = address_space_id;
 }
 
-void TcpStreamSession::SwapPacketHeaderFoo()
-{
-    if ( egress_index != DAQ_PKTHDR_UNKNOWN )
-    {
-        int32_t save_ingress_index;
-        int32_t save_ingress_group;
-
-        save_ingress_index = ingress_index;
-        save_ingress_group = ingress_group;
-        ingress_index = egress_index;
-        ingress_group = egress_group;
-        egress_index = save_ingress_index;
-        egress_group = save_ingress_group;
-    }
-}
-
 void TcpStreamSession::reset()
 {
     if (tcp_init)
index 3c051a65d51630621db487844912702b83e519b3..ce693410e0703ed882478d59aadb79873209a2bf 100644 (file)
@@ -227,10 +227,7 @@ void Stream::stop_inspection(
     case SSN_DIR_BOTH:
     case SSN_DIR_FROM_CLIENT:
     case SSN_DIR_FROM_SERVER:
-        if (flow->ssn_state.ignore_direction != dir)
-        {
-            flow->ssn_state.ignore_direction = dir;
-        }
+        flow->ssn_state.ignore_direction = dir;
         break;
     }
 
@@ -413,10 +410,7 @@ void Stream::set_snort_protocol_id(
     }
 #endif
 
-    if (flow->ssn_state.snort_protocol_id != snort_protocol_id)
-    {
-        flow->ssn_state.snort_protocol_id = snort_protocol_id;
-    }
+    flow->ssn_state.snort_protocol_id = snort_protocol_id;
 }
 
 SnortProtocolId Stream::get_snort_protocol_id(Flow* flow)
@@ -464,10 +458,7 @@ SnortProtocolId Stream::set_snort_protocol_id(Flow* flow, SnortProtocolId id)
     if (!flow)
         return UNKNOWN_PROTOCOL_ID;
 
-    if (flow->ssn_state.snort_protocol_id != id)
-    {
-        flow->ssn_state.snort_protocol_id = id;
-    }
+    flow->ssn_state.snort_protocol_id = id;
 
     if (!flow->ssn_state.ipprotocol)
         set_ip_protocol(flow);
index e09fa3764dee33c046177b57f5ca4eb36a2f19de..b232a07bafab72ac01ef590553be9807278c5cef 100644 (file)
@@ -451,6 +451,7 @@ void TcpSession::set_os_policy()
 }
 
 // FIXIT-H this is no longer called (but should be)
+#if 0
 void TcpSession::swap_trackers()
 {
     uint32_t session_flags = flow->get_session_flags( );
@@ -486,6 +487,7 @@ void TcpSession::swap_trackers()
         flow->update_session_flags(session_flags);
     }
 }
+#endif
 
 void TcpSession::NewTcpSessionOnSyn(TcpSegmentDescriptor& tsd)
 {