]> git.proxmox.com Git - mirror_ovs.git/commitdiff
conntrack: Add hash_finish() to conn_key_hash().
authorDarrell Ball <dlu998@gmail.com>
Fri, 9 Jun 2017 22:30:44 +0000 (15:30 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 13 Jun 2017 05:08:00 +0000 (22:08 -0700)
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 <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/conntrack.c

index 9584a0a354f9c50ff2ed9a5e669b4e0fcd0c5cf3..146edd7009ed826b3cddc679ff4df1a90c343600 100644 (file)
@@ -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