]> source.dussan.org Git - rspamd.git/commitdiff
Exclude ports from ip address hash
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Dec 2015 12:48:45 +0000 (12:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Dec 2015 12:48:45 +0000 (12:48 +0000)
src/libutil/addr.c

index 1da69e114122295f1a8ed0e4bfcb4f22973d9b9b..185f6a2bcb6efc1a7e8b6b46fad19a4716c0ada6 100644 (file)
@@ -1293,7 +1293,15 @@ rspamd_inet_address_hash (gconstpointer a)
                XXH64_update (&st, addr->u.un, sizeof (*addr->u.un));
        }
        else {
-               XXH64_update (&st, &addr->u.in.addr, addr->slen);
+               /* We ignore port part here */
+               if (addr->af == AF_INET) {
+                       XXH64_update (&st, &addr->u.in.addr.s4.sin_addr,
+                                       sizeof (addr->u.in.addr.s4.sin_addr));
+               }
+               else {
+                       XXH64_update (&st, &addr->u.in.addr.s6.sin6_addr,
+                                       sizeof (addr->u.in.addr.s6.sin6_addr));
+               }
        }
 
        return XXH64_digest (&st);