]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode: don't clear computed csums twice 10783/head
authorVictor Julien <vjulien@oisf.net>
Fri, 22 Mar 2024 09:02:16 +0000 (10:02 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Apr 2024 12:53:38 +0000 (14:53 +0200)
Already done in a generic way by PACKET_RESET_CHECKSUMS.

src/decode-icmpv4.h
src/decode-icmpv6.h
src/decode-ipv4.h
src/decode-tcp.h
src/decode-udp.h

index 1f4f486298ed853adee2cc3b101d68c00b9a34d0..5cd6280887d0aed4839581e47d2daca3d5fa379e 100644 (file)
@@ -221,11 +221,11 @@ typedef struct ICMPV4Timestamp_ {
     uint32_t tx_ts;
 } __attribute__((__packed__)) ICMPV4Timestamp;
 
-#define CLEAR_ICMPV4_PACKET(p) do { \
-    (p)->level4_comp_csum = -1;     \
-    PACKET_CLEAR_L4VARS((p));       \
-    (p)->icmpv4h = NULL;            \
-} while(0)
+#define CLEAR_ICMPV4_PACKET(p)                                                                     \
+    do {                                                                                           \
+        PACKET_CLEAR_L4VARS((p));                                                                  \
+        (p)->icmpv4h = NULL;                                                                       \
+    } while (0)
 
 #define ICMPV4_HEADER_PKT_OFFSET 8
 
index 412d9c5fa3b8b386d7e1eb6bb8b76036a6462a44..06be88bc461c9b50a2f815cdb144536d4d9c6557 100644 (file)
@@ -182,12 +182,11 @@ typedef struct ICMPV6Vars_ {
 
 } ICMPV6Vars;
 
-
-#define CLEAR_ICMPV6_PACKET(p) do { \
-    (p)->level4_comp_csum = -1;     \
-    PACKET_CLEAR_L4VARS((p));       \
-    (p)->icmpv6h = NULL;            \
-} while(0)
+#define CLEAR_ICMPV6_PACKET(p)                                                                     \
+    do {                                                                                           \
+        PACKET_CLEAR_L4VARS((p));                                                                  \
+        (p)->icmpv6h = NULL;                                                                       \
+    } while (0)
 
 void DecodeICMPV6RegisterTests(void);
 
index cb0734aa4c059242b566c50474def27237df7038..b0fd1256f15e54a0412ef5eac702db53de1aa9c2 100644 (file)
@@ -148,11 +148,11 @@ typedef struct IPV4Hdr_
 #define IPV4_GET_IPPROTO(p) \
     IPV4_GET_RAW_IPPROTO((p)->ip4h)
 
-#define CLEAR_IPV4_PACKET(p) do { \
-    (p)->ip4h = NULL; \
-    (p)->level3_comp_csum = -1; \
-    memset(&p->ip4vars, 0x00, sizeof(p->ip4vars)); \
-} while (0)
+#define CLEAR_IPV4_PACKET(p)                                                                       \
+    do {                                                                                           \
+        (p)->ip4h = NULL;                                                                          \
+        memset(&p->ip4vars, 0x00, sizeof(p->ip4vars));                                             \
+    } while (0)
 
 enum IPV4OptionFlags {
     IPV4_OPT_FLAG_EOL = 0,
index 5c07f418a7c6444ee97608a225ad502013485dee..644a2b2f1fbfd21baa33fdea54d6f692acd1fa51 100644 (file)
@@ -168,11 +168,11 @@ typedef struct TCPVars_
     TCPOpt tfo;         /* tcp fast open */
 } TCPVars;
 
-#define CLEAR_TCP_PACKET(p) {   \
-    (p)->level4_comp_csum = -1; \
-    PACKET_CLEAR_L4VARS((p));   \
-    (p)->tcph = NULL;           \
-}
+#define CLEAR_TCP_PACKET(p)                                                                        \
+    {                                                                                              \
+        PACKET_CLEAR_L4VARS((p));                                                                  \
+        (p)->tcph = NULL;                                                                          \
+    }
 
 void DecodeTCPRegisterTests(void);
 
index a6f13cf08541e4d015e61c6c9176392635751b70..24249508a714176d21232750a6d74e388c503e90 100644 (file)
@@ -46,10 +46,10 @@ typedef struct UDPHdr_
        uint16_t uh_sum;    /* checksum */
 } UDPHdr;
 
-#define CLEAR_UDP_PACKET(p) do {    \
-    (p)->level4_comp_csum = -1;     \
-    (p)->udph = NULL;               \
-} while (0)
+#define CLEAR_UDP_PACKET(p)                                                                        \
+    do {                                                                                           \
+        (p)->udph = NULL;                                                                          \
+    } while (0)
 
 void DecodeUDPV4RegisterTests(void);