From: Victor Julien Date: Thu, 28 Mar 2024 10:56:23 +0000 (+0100) Subject: decode/icmpv4: switch ptr checks to PKT_IS_ICMPV4 X-Git-Tag: suricata-8.0.0-beta1~1385 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54b9f344b70dc3dc530e5630a996c5e3351cccbc;p=thirdparty%2Fsuricata.git decode/icmpv4: switch ptr checks to PKT_IS_ICMPV4 To prepare future changes to the Packet header pointers. Ticket: #5517. --- diff --git a/src/detect-csum.c b/src/detect-csum.c index 76f6902e5a..43c4826e6d 100644 --- a/src/detect-csum.c +++ b/src/detect-csum.c @@ -682,7 +682,7 @@ static int DetectICMPV4CsumMatch(DetectEngineThreadCtx *det_ctx, { const DetectCsumData *cd = (const DetectCsumData *)ctx; - if (!PacketIsIPv4(p) || p->icmpv4h == NULL || p->proto != IPPROTO_ICMP || PKT_IS_PSEUDOPKT(p)) + if (!PacketIsIPv4(p) || !PKT_IS_ICMPV4(p) || p->proto != IPPROTO_ICMP || PKT_IS_PSEUDOPKT(p)) return 0; if (p->flags & PKT_IGNORE_CHECKSUM) { diff --git a/src/detect-icmpv4hdr.c b/src/detect-icmpv4hdr.c index b0c6f54b75..72c9156b2e 100644 --- a/src/detect-icmpv4hdr.c +++ b/src/detect-icmpv4hdr.c @@ -95,7 +95,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, { SCEnter(); - if (p->icmpv4h == NULL) { + if (!PKT_IS_ICMPV4(p)) { SCReturnPtr(NULL, "InspectionBuffer"); } diff --git a/src/flow-util.c b/src/flow-util.c index 97d48a5baa..ce6a54d7be 100644 --- a/src/flow-util.c +++ b/src/flow-util.c @@ -176,7 +176,7 @@ void FlowInit(Flow *f, const Packet *p) } else if (PKT_IS_UDP(p)) { SET_UDP_SRC_PORT(p,&f->sp); SET_UDP_DST_PORT(p,&f->dp); - } else if (p->icmpv4h != NULL) { + } else if (PKT_IS_ICMPV4(p)) { f->icmp_s.type = p->icmp_s.type; f->icmp_s.code = p->icmp_s.code; FlowSetICMPv4CounterPart(f);