host: convert host hash to use lookup3.c

remotes/origin/HEAD
Victor Julien 14 years ago
parent c10370907a
commit cfd4d07dd0

@ -38,6 +38,8 @@
#include "detect-tag.h" #include "detect-tag.h"
#include "detect-engine-threshold.h" #include "detect-engine-threshold.h"
#include "util-hash-lookup3.h"
static Host *HostGetUsedHost(void); static Host *HostGetUsedHost(void);
/** queue with spare hosts */ /** queue with spare hosts */
@ -286,11 +288,11 @@ uint32_t HostGetKey(Address *a) {
uint32_t key; uint32_t key;
if (a->family == AF_INET) { if (a->family == AF_INET) {
key = (host_config.hash_rand + a->addr_data32[0]) % host_config.hash_size; uint32_t hash = hashword(&a->addr_data32[0], 1, host_config.hash_rand);
key = hash % host_config.hash_size;
} else if (a->family == AF_INET6) { } else if (a->family == AF_INET6) {
key = (host_config.hash_rand + a->addr_data32[0] + \ uint32_t hash = hashword(a->addr_data32, 4, host_config.hash_rand);
a->addr_data32[1] + a->addr_data32[2] + \ key = hash % host_config.hash_size;
a->addr_data32[3]) % host_config.hash_size;
} else } else
key = 0; key = 0;

Loading…
Cancel
Save