From: Mike Stepanek (mstepane) Date: Thu, 3 Oct 2019 11:57:56 +0000 (-0400) Subject: Merge pull request #1778 in SNORT/snort3 from ~THOPETER/snort3:small_seg4 to master X-Git-Tag: 3.0.0-262~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf5c21696aceaf5efd403c1e93e69c6ab69f0736;p=thirdparty%2Fsnort3.git Merge pull request #1778 in SNORT/snort3 from ~THOPETER/snort3:small_seg4 to master Squashed commit of the following: commit 916155bb5155a0f6985f0225f0718cba1013a705 Author: Tom Peters Date: Wed Oct 2 12:06:04 2019 -0400 stream: clean up cppcheck warnings --- diff --git a/src/stream/ip/ip_defrag.cc b/src/stream/ip/ip_defrag.cc index a807ee9ed..4673c607d 100644 --- a/src/stream/ip/ip_defrag.cc +++ b/src/stream/ip/ip_defrag.cc @@ -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; diff --git a/src/stream/libtcp/tcp_stream_session.cc b/src/stream/libtcp/tcp_stream_session.cc index 843b8ee9a..a05839478 100644 --- a/src/stream/libtcp/tcp_stream_session.cc +++ b/src/stream/libtcp/tcp_stream_session.cc @@ -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) diff --git a/src/stream/stream.cc b/src/stream/stream.cc index 3c051a65d..ce693410e 100644 --- a/src/stream/stream.cc +++ b/src/stream/stream.cc @@ -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); diff --git a/src/stream/tcp/tcp_session.cc b/src/stream/tcp/tcp_session.cc index e09fa3764..b232a07ba 100644 --- a/src/stream/tcp/tcp_session.cc +++ b/src/stream/tcp/tcp_session.cc @@ -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) {