diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-14 12:48:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-14 12:48:45 +0000 |
commit | 3275d56ba6dd235e9b79b498ec7ea05fe466205d (patch) | |
tree | 8ddbdb841b2efe0f260ef565f5bc989e7331d07b /src/libutil/addr.c | |
parent | 61330ef453ae1eb997b2567928587d3c71daf87f (diff) | |
download | rspamd-3275d56ba6dd235e9b79b498ec7ea05fe466205d.tar.gz rspamd-3275d56ba6dd235e9b79b498ec7ea05fe466205d.zip |
Exclude ports from ip address hash
Diffstat (limited to 'src/libutil/addr.c')
-rw-r--r-- | src/libutil/addr.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libutil/addr.c b/src/libutil/addr.c index 1da69e114..185f6a2bc 100644 --- a/src/libutil/addr.c +++ b/src/libutil/addr.c @@ -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); |