From: VISHAL RATNAKAR KHARVI -X (vkharvi - XORIANT CORPORATION at Cisco) Date: Mon, 6 Nov 2023 20:22:08 +0000 (+0000) Subject: Pull request #4083: bad checksum fix X-Git-Tag: 3.1.74.0~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14f07e331404068ca8b5e319805d657a70aca682;p=thirdparty%2Fsnort3.git Pull request #4083: bad checksum fix Merge in SNORT/snort3 from ~VKHARVI/snort3:proto_51_fix to master Squashed commit of the following: commit bff3344649af8f6eb2e8e48679aa802df7d92e5c Author: VISHAL RATNAKAR KHARVI -X (vkharvi - XORIANT CORPORATION at Cisco) Date: Wed Nov 1 18:43:15 2023 +0530 codecs: Fix bad checksum when auth(51) protocol header is present between IP and TCP layer. --- diff --git a/src/codecs/ip/cd_tcp.cc b/src/codecs/ip/cd_tcp.cc index 5df64e66e..178871f33 100644 --- a/src/codecs/ip/cd_tcp.cc +++ b/src/codecs/ip/cd_tcp.cc @@ -178,7 +178,7 @@ bool TcpCodec::valid_checksum4(const RawData& raw, DecodeData& snort) ph.hdr.sip = ip4h->get_src(); ph.hdr.dip = ip4h->get_dst(); ph.hdr.zero = 0; - ph.hdr.protocol = ip4h->proto(); + ph.hdr.protocol = IpProtocol::TCP; ph.hdr.len = htons((uint16_t) raw.len); return (checksum::tcp_cksum((const uint16_t*) raw.data, raw.len, ph) == 0); diff --git a/src/codecs/ip/cd_udp.cc b/src/codecs/ip/cd_udp.cc index 9dd9327e3..22ebbce4b 100644 --- a/src/codecs/ip/cd_udp.cc +++ b/src/codecs/ip/cd_udp.cc @@ -283,7 +283,7 @@ bool UdpCodec::valid_checksum4(const RawData& raw, const DecodeData& snort) ph.hdr.sip = ip4h->get_src(); ph.hdr.dip = ip4h->get_dst(); ph.hdr.zero = 0; - ph.hdr.protocol = ip4h->proto(); + ph.hdr.protocol = IpProtocol::UDP; ph.hdr.len = htons((uint16_t) raw.len); return (checksum::udp_cksum((const uint16_t*) raw.data, raw.len, ph) == 0);