]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode/icmpv4: switch ptr checks to PKT_IS_ICMPV4
authorVictor Julien <vjulien@oisf.net>
Thu, 28 Mar 2024 10:56:23 +0000 (11:56 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 26 Apr 2024 18:59:45 +0000 (20:59 +0200)
To prepare future changes to the Packet header pointers.

Ticket: #5517.

src/detect-csum.c
src/detect-icmpv4hdr.c
src/flow-util.c

index 76f6902e5ad3b857c2e80dc30fe19db83ae05f6d..43c4826e6d751fe5c77b2c4a086895bab5650925 100644 (file)
@@ -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) {
index b0c6f54b75c4b90503be700bd04e6f65e6a97a2e..72c9156b2ebea06a2ebb37526febd5ad1532d7b7 100644 (file)
@@ -95,7 +95,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
 {
     SCEnter();
 
-    if (p->icmpv4h == NULL) {
+    if (!PKT_IS_ICMPV4(p)) {
         SCReturnPtr(NULL, "InspectionBuffer");
     }
 
index 97d48a5baa323fce7d78fa88196313c023496729..ce6a54d7be5883026906e5cca605b4b23dab8c47 100644 (file)
@@ -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);