Commit Diff
Diff:
4667e76dbdc2409441098ed55e813abd46d27f62
5545c2c427d4a4de9531b591c070b896acd452ec
Commit:
5545c2c427d4a4de9531b591c070b896acd452ec
Tree:
94ca10fe617ac383ad8d4d709082767714009fc4
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Wed May 7 16:18:57 2014 UTC
Message:
* fix hash algorithm...thank you to the chinese who made me aware there was a problem, and sorry for the limitation on service!
blob - ca6ea1da0e410c4b5a4b5f5e223de9a273658aa6
blob + f366150f1143cc9d315a93e3e3e39b22c627638b
--- ratelimit.c
+++ ratelimit.c
@@ -130,10 +130,10 @@ static u_int16_t
hash_rrlimit(u_int16_t *ip, int size)
{
u_int64_t total = 0;
- int i;
+ int i, j;
- for (i = 0; i < size; i += 2) {
- total += (u_int64_t)ip[i];
+ for (i = 0, j = 0; i < size; i += 2) {
+ total += (u_int64_t)ip[j++];
}
total %= 0xffff;
repomaster@centroid.eu