The function conn_key_hash() is updated to include
a call to hash_finish() and also to make use of a
new hash abstraction - ct_endpoint_hash_add().
Fixes: a489b16854b5 ("conntrack: New userspace connection tracker.")
Signed-off-by: Darrell Ball <[email protected]>
---
lib/conntrack.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/lib/conntrack.c b/lib/conntrack.c
index 9584a0a..146edd7 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -1529,14 +1529,10 @@ static uint32_t
conn_key_hash(const struct conn_key *key, uint32_t basis)
{
uint32_t hsrc, hdst, hash;
- int i;
hsrc = hdst = basis;
-
- for (i = 0; i < sizeof(key->src) / sizeof(uint32_t); i++) {
- hsrc = hash_add(hsrc, ((uint32_t *) &key->src)[i]);
- hdst = hash_add(hdst, ((uint32_t *) &key->dst)[i]);
- }
+ hsrc = ct_endpoint_hash_add(hsrc, &key->src);
+ hdst = ct_endpoint_hash_add(hdst, &key->dst);
/* Even if source and destination are swapped the hash will be the same. */
hash = hsrc ^ hdst;
@@ -1546,7 +1542,7 @@ conn_key_hash(const struct conn_key *key, uint32_t basis)
(uint32_t *) (key + 1) - (uint32_t *) (&key->dst + 1),
hash);
- return hash;
+ return hash_finish(hash, 0);
}
static void
--
1.9.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev