From 344ea14695a7fcd8726e7deb01873837d05b9e2d Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 2 Nov 2010 17:15:15 +0100 Subject: [PATCH] Change mpm hash_size config setting highest to higher as highest wasn't the... highest. Max was higher. Leaving highest as an alias to higher for backwards compatibility. --- src/util-mpm-b2g.c | 4 ++-- src/util-mpm-b2g.h | 2 +- src/util-mpm-b2gc.c | 4 ++-- src/util-mpm-b2gc.h | 2 +- src/util-mpm-b2gm.c | 4 ++-- src/util-mpm-b2gm.h | 2 +- src/util-mpm-b3g.c | 6 +++--- src/util-mpm-b3g.h | 4 ++-- src/util-mpm.c | 18 +++++++++++------- src/util-mpm.h | 2 +- suricata.yaml | 2 +- 11 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/util-mpm-b2g.c b/src/util-mpm-b2g.c index ceb36c892e..d41570f03c 100644 --- a/src/util-mpm-b2g.c +++ b/src/util-mpm-b2g.c @@ -739,8 +739,8 @@ static void B2gGetConfig() case HASHSIZE_HIGH: b2g_hash_shift = B2G_HASHSHIFT_HIGH; break; - case HASHSIZE_HIGHEST: - b2g_hash_shift = B2G_HASHSHIFT_HIGHEST; + case HASHSIZE_HIGHER: + b2g_hash_shift = B2G_HASHSHIFT_HIGHER; break; case HASHSIZE_MAX: b2g_hash_shift = B2G_HASHSHIFT_MAX; diff --git a/src/util-mpm-b2g.h b/src/util-mpm-b2g.h index ae78edadde..2d22b0ef58 100644 --- a/src/util-mpm-b2g.h +++ b/src/util-mpm-b2g.h @@ -28,7 +28,7 @@ #include "util-bloomfilter.h" #define B2G_HASHSHIFT_MAX 8 -#define B2G_HASHSHIFT_HIGHEST 7 +#define B2G_HASHSHIFT_HIGHER 7 #define B2G_HASHSHIFT_HIGH 6 #define B2G_HASHSHIFT_MEDIUM 5 #define B2G_HASHSHIFT_LOW 4 diff --git a/src/util-mpm-b2gc.c b/src/util-mpm-b2gc.c index 5c6ae39833..ee710be8e9 100644 --- a/src/util-mpm-b2gc.c +++ b/src/util-mpm-b2gc.c @@ -883,8 +883,8 @@ static void B2gcGetConfig() case HASHSIZE_HIGH: b2gc_hash_shift = B2GC_HASHSHIFT_HIGH; break; - case HASHSIZE_HIGHEST: - b2gc_hash_shift = B2GC_HASHSHIFT_HIGHEST; + case HASHSIZE_HIGHER: + b2gc_hash_shift = B2GC_HASHSHIFT_HIGHER; break; case HASHSIZE_MAX: b2gc_hash_shift = B2GC_HASHSHIFT_MAX; diff --git a/src/util-mpm-b2gc.h b/src/util-mpm-b2gc.h index 5713ccc886..f72e389b74 100644 --- a/src/util-mpm-b2gc.h +++ b/src/util-mpm-b2gc.h @@ -28,7 +28,7 @@ #include "util-bloomfilter.h" #define B2GC_HASHSHIFT_MAX 8 -#define B2GC_HASHSHIFT_HIGHEST 7 +#define B2GC_HASHSHIFT_HIGHER 7 #define B2GC_HASHSHIFT_HIGH 6 #define B2GC_HASHSHIFT_MEDIUM 5 #define B2GC_HASHSHIFT_LOW 4 diff --git a/src/util-mpm-b2gm.c b/src/util-mpm-b2gm.c index f304455f35..3440bc675a 100644 --- a/src/util-mpm-b2gm.c +++ b/src/util-mpm-b2gm.c @@ -791,8 +791,8 @@ static void B2gmGetConfig() case HASHSIZE_HIGH: b2gm_hash_shift = B2GM_HASHSHIFT_HIGH; break; - case HASHSIZE_HIGHEST: - b2gm_hash_shift = B2GM_HASHSHIFT_HIGHEST; + case HASHSIZE_HIGHER: + b2gm_hash_shift = B2GM_HASHSHIFT_HIGHER; break; case HASHSIZE_MAX: b2gm_hash_shift = B2GM_HASHSHIFT_MAX; diff --git a/src/util-mpm-b2gm.h b/src/util-mpm-b2gm.h index 94dd2a5fed..5b1316bf85 100644 --- a/src/util-mpm-b2gm.h +++ b/src/util-mpm-b2gm.h @@ -28,7 +28,7 @@ #include "util-bloomfilter.h" #define B2GM_HASHSHIFT_MAX 8 -#define B2GM_HASHSHIFT_HIGHEST 7 +#define B2GM_HASHSHIFT_HIGHER 7 #define B2GM_HASHSHIFT_HIGH 6 #define B2GM_HASHSHIFT_MEDIUM 5 #define B2GM_HASHSHIFT_LOW 4 diff --git a/src/util-mpm-b3g.c b/src/util-mpm-b3g.c index a76135aaee..5154c459ac 100644 --- a/src/util-mpm-b3g.c +++ b/src/util-mpm-b3g.c @@ -699,9 +699,9 @@ void B3gGetConfig() b3g_hash_shift = B3G_HASHSHIFT_HIGH; b3g_hash_shift2 = B3G_HASHSHIFT_HIGH2; break; - case HASHSIZE_HIGHEST: - b3g_hash_shift = B3G_HASHSHIFT_HIGHEST; - b3g_hash_shift2 = B3G_HASHSHIFT_HIGHEST2; + case HASHSIZE_HIGHER: + b3g_hash_shift = B3G_HASHSHIFT_HIGHER; + b3g_hash_shift2 = B3G_HASHSHIFT_HIGHER2; break; case HASHSIZE_MAX: b3g_hash_shift = B3G_HASHSHIFT_MAX; diff --git a/src/util-mpm-b3g.h b/src/util-mpm-b3g.h index dd9a35a216..60107ac5f3 100644 --- a/src/util-mpm-b3g.h +++ b/src/util-mpm-b3g.h @@ -29,8 +29,8 @@ #define B3G_HASHSHIFT_MAX 8 #define B3G_HASHSHIFT_MAX2 5 -#define B3G_HASHSHIFT_HIGHEST 7 -#define B3G_HASHSHIFT_HIGHEST2 4 +#define B3G_HASHSHIFT_HIGHER 7 +#define B3G_HASHSHIFT_HIGHER2 4 #define B3G_HASHSHIFT_HIGH 6 #define B3G_HASHSHIFT_HIGH2 3 #define B3G_HASHSHIFT_MEDIUM 5 diff --git a/src/util-mpm.c b/src/util-mpm.c index baa2242a1a..4ab4572b02 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -401,17 +401,21 @@ uint32_t MpmGetHashSize(const char *conf_val) SCEnter(); uint32_t hash_value = HASHSIZE_LOW; - if(strncmp(conf_val, "lowest", 6) == 0) { + if(strcmp(conf_val, "lowest") == 0) { hash_value = HASHSIZE_LOWEST; - } else if(strncmp(conf_val, "low", 3) == 0) { + } else if(strcmp(conf_val, "low") == 0) { hash_value = HASHSIZE_LOW; - } else if(strncmp(conf_val, "medium", 6) == 0) { + } else if(strcmp(conf_val, "medium") == 0) { hash_value = HASHSIZE_MEDIUM; - } else if(strncmp(conf_val, "high", 4) == 0) { + } else if(strcmp(conf_val, "high") == 0) { hash_value = HASHSIZE_HIGH; - } else if(strncmp(conf_val, "highest", 7) == 0) { - hash_value = HASHSIZE_HIGHEST; - } else if(strncmp(conf_val, "max", 3) == 0) { + /* "highest" is supported in 1.0 to 1.0.2, so we keep supporting + * it for backwards compatibility */ + } else if(strcmp(conf_val, "highest") == 0) { + hash_value = HASHSIZE_HIGHER; + } else if(strcmp(conf_val, "higher") == 0) { + hash_value = HASHSIZE_HIGHER; + } else if(strcmp(conf_val, "max") == 0) { hash_value = HASHSIZE_MAX; } diff --git a/src/util-mpm.h b/src/util-mpm.h index 4ef97c21be..eeb93c7152 100644 --- a/src/util-mpm.h +++ b/src/util-mpm.h @@ -40,7 +40,7 @@ pattern matcher algorithms */ #define HASHSIZE_HIGH 16384 /**< High hash size for the multi pattern matcher algorithms */ -#define HASHSIZE_HIGHEST 32768 /**< Highest hash size for the multi +#define HASHSIZE_HIGHER 32768 /**< Higher hash size for the multi pattern matcher algorithms */ #define HASHSIZE_MAX 65536 /**< Max hash size for the multi pattern matcher algorithms */ diff --git a/suricata.yaml b/suricata.yaml index 34c335b68c..b99e4c7063 100644 --- a/suricata.yaml +++ b/suricata.yaml @@ -161,7 +161,7 @@ cuda: mpm-algo: b2gc # The memory settings for hash size of these algorithms can vary from lowest -# (2048) - low (4096) - medium (8192) - high (16384) - highest (32768) - max +# (2048) - low (4096) - medium (8192) - high (16384) - higher (32768) - max # (65536). The bloomfilter sizes of these algorithms can vary from low (512) - # medium (1024) - high (2048). #