[master] 3be6559 fix a leftover from vslp times - overlooked increment by one for crc32

Nils Goroll nils.goroll at uplex.de
Mon Sep 12 20:03:13 CEST 2016


commit 3be6559fff8dd80ddbbff95718f97976f8187de0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Sep 12 20:01:45 2016 +0200

    fix a leftover from vslp times - overlooked increment by one for crc32

diff --git a/bin/varnishtest/tests/d00017.vtc b/bin/varnishtest/tests/d00017.vtc
index d92cad5..808e23b 100644
--- a/bin/varnishtest/tests/d00017.vtc
+++ b/bin/varnishtest/tests/d00017.vtc
@@ -136,9 +136,9 @@ logexpect l1 -v v1 -g raw -d 1 {
 
 	expect 0 =    CLI   Loaded
 
-	expect * =    Debug {^shard: lookup key 68b902f8 idx 29 host 0}
-	expect * =    Debug {^shard: lookup key 39dc4614 idx 20 host 1}
-	expect * =    Debug {^shard: lookup key c7793506 idx 59 host 2}
+	expect * =    Debug {^shard: lookup key 68b902f7 idx 29 host 0}
+	expect * =    Debug {^shard: lookup key 39dc4613 idx 20 host 1}
+	expect * =    Debug {^shard: lookup key c7793505 idx 59 host 2}
 } -start
 
 client c1 {
diff --git a/lib/libvmod_directors/shard_hash.c b/lib/libvmod_directors/shard_hash.c
index 59f57e7..30ebd7d 100644
--- a/lib/libvmod_directors/shard_hash.c
+++ b/lib/libvmod_directors/shard_hash.c
@@ -46,12 +46,7 @@
 static uint32_t __match_proto__(hash_func)
 shard_hash_crc32(VCL_STRING s)
 {
-	uint32_t crc;
-	crc = crc32(~0U, (const unsigned char*)s, strlen(s));
-	crc ^= ~0U;
-	crc++;
-
-	return (crc);
+	return (crc32_l(s, strlen(s)));
 }
 
 static uint32_t __match_proto__(hash_func)



More information about the varnish-commit mailing list