From: Victor Julien Date: Fri, 22 Mar 2024 09:02:16 +0000 (+0100) Subject: decode: don't clear computed csums twice X-Git-Tag: suricata-8.0.0-beta1~1561 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=561b81dd9eed61c98089d4d931326b5f728c694a;p=thirdparty%2Fsuricata.git decode: don't clear computed csums twice Already done in a generic way by PACKET_RESET_CHECKSUMS. --- diff --git a/src/decode-icmpv4.h b/src/decode-icmpv4.h index 1f4f486298..5cd6280887 100644 --- a/src/decode-icmpv4.h +++ b/src/decode-icmpv4.h @@ -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 diff --git a/src/decode-icmpv6.h b/src/decode-icmpv6.h index 412d9c5fa3..06be88bc46 100644 --- a/src/decode-icmpv6.h +++ b/src/decode-icmpv6.h @@ -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); diff --git a/src/decode-ipv4.h b/src/decode-ipv4.h index cb0734aa4c..b0fd1256f1 100644 --- a/src/decode-ipv4.h +++ b/src/decode-ipv4.h @@ -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, diff --git a/src/decode-tcp.h b/src/decode-tcp.h index 5c07f418a7..644a2b2f1f 100644 --- a/src/decode-tcp.h +++ b/src/decode-tcp.h @@ -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); diff --git a/src/decode-udp.h b/src/decode-udp.h index a6f13cf085..24249508a7 100644 --- a/src/decode-udp.h +++ b/src/decode-udp.h @@ -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);