From bb7abbd6ec117b8740da7a43f66a20565e2b987f Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 6 Mar 2020 09:54:25 +0100 Subject: [PATCH] detect: extend PrefilterPacketHeaderValue to 16 bytes --- src/detect-engine-prefilter-common.c | 5 +++-- src/detect-engine-prefilter-common.h | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/detect-engine-prefilter-common.c b/src/detect-engine-prefilter-common.c index 4c9e4f5e03..323f479f5b 100644 --- a/src/detect-engine-prefilter-common.c +++ b/src/detect-engine-prefilter-common.c @@ -31,7 +31,7 @@ typedef struct PrefilterPacketHeaderHashCtx_ { static uint32_t PrefilterPacketHeaderHashFunc(HashListTable *ht, void *data, uint16_t datalen) { PrefilterPacketHeaderCtx *ctx = data; - uint64_t hash = ctx->v1.u64 + ctx->type + ctx->value; + uint64_t hash = ctx->v1.u64[0] + ctx->v1.u64[1] + ctx->type + ctx->value; hash %= ht->array_size; return hash; } @@ -41,7 +41,8 @@ static char PrefilterPacketHeaderCompareFunc(void *data1, uint16_t len1, { PrefilterPacketHeaderHashCtx *ctx1 = data1; PrefilterPacketHeaderHashCtx *ctx2 = data2; - return (ctx1->v1.u64 == ctx2->v1.u64 && + return (ctx1->v1.u64[0] == ctx2->v1.u64[0] && + ctx1->v1.u64[1] == ctx2->v1.u64[1] && ctx1->type == ctx2->type && ctx1->value == ctx2->value); } diff --git a/src/detect-engine-prefilter-common.h b/src/detect-engine-prefilter-common.h index b8f317f148..b2bd461e2e 100644 --- a/src/detect-engine-prefilter-common.h +++ b/src/detect-engine-prefilter-common.h @@ -19,10 +19,10 @@ #define __DETECT_ENGINE_PREFILTER_COMMON_H__ typedef union { - uint8_t u8[8]; - uint16_t u16[4]; - uint32_t u32[2]; - uint64_t u64; + uint8_t u8[16]; + uint16_t u16[8]; + uint32_t u32[4]; + uint64_t u64[2]; } PrefilterPacketHeaderValue; #define PREFILTER_EXTRA_MATCH_UNUSED 0