From: Michael Matirko (mmatirko) Date: Mon, 28 Apr 2025 15:13:22 +0000 (+0000) Subject: Pull request #4703: flow: don't offset flow instance number by 1 when printing flows X-Git-Tag: 3.7.4.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a3458b2d54206e06aa73ed3a3438ba78a45499d;p=thirdparty%2Fsnort3.git Pull request #4703: flow: don't offset flow instance number by 1 when printing flows Merge in SNORT/snort3 from ~MMATIRKO/snort3:flow_off_by_one to master Squashed commit of the following: commit 3a644db3963d2fef5638e7b30a792d85fd9abe30 Author: Michael Matirko Date: Tue Apr 15 12:46:20 2025 -0400 flow: don't offset flow instance number by 1 when printing flows --- diff --git a/src/flow/flow_cache.cc b/src/flow/flow_cache.cc index 238426522..53b34ff1f 100644 --- a/src/flow/flow_cache.cc +++ b/src/flow/flow_cache.cc @@ -964,16 +964,16 @@ void FlowCache::output_flow(std::fstream& stream, const Flow& flow, const struct switch ( flow.key->pkt_type ) { case PktType::IP: - out << "Instance-ID: " << get_relative_instance_number() + 1<< " IP " << flow.key->addressSpaceId << ": " << src_ip << " " << dst_ip; + out << "Instance-ID: " << get_relative_instance_number() << " IP " << flow.key->addressSpaceId << ": " << src_ip << " " << dst_ip; break; case PktType::ICMP: - out << "Instance-ID: " << get_relative_instance_number() + 1 << " ICMP " << flow.key->addressSpaceId << ": " << src_ip << " type " << src_port << " " + out << "Instance-ID: " << get_relative_instance_number() << " ICMP " << flow.key->addressSpaceId << ": " << src_ip << " type " << src_port << " " << dst_ip; break; case PktType::TCP: - out << "Instance-ID: " << get_relative_instance_number() + 1 << " TCP " << flow.key->addressSpaceId << ": " << src_ip << "/" << src_port << " " + out << "Instance-ID: " << get_relative_instance_number() << " TCP " << flow.key->addressSpaceId << ": " << src_ip << "/" << src_port << " " << dst_ip << "/" << dst_port; if (flow.session) { @@ -984,7 +984,7 @@ void FlowCache::output_flow(std::fstream& stream, const Flow& flow, const struct break; case PktType::UDP: - out << "Instance-ID: " << get_relative_instance_number() + 1 << " UDP " << flow.key->addressSpaceId << ": "<< src_ip << "/" << src_port << " " + out << "Instance-ID: " << get_relative_instance_number() << " UDP " << flow.key->addressSpaceId << ": "<< src_ip << "/" << src_port << " " << dst_ip << "/" << dst_port; break;