diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-09-23 12:06:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-09-23 12:06:38 -0400 |
commit | d07f17f67685d75fec8a851b3ae3d157c1e31aa3 (patch) | |
tree | 3995456a21e280807d3c16b5d3f13dc2aefe6cad | |
parent | 1be9e84b9c8d104dbdad84dde865e8d2395e67b8 (diff) | |
download | tor-d07f17f67685d75fec8a851b3ae3d157c1e31aa3.tar.gz tor-d07f17f67685d75fec8a851b3ae3d157c1e31aa3.zip |
IPv6 sybil: consider addresses in the same /64 to be equal.
-rw-r--r-- | src/feature/dirauth/dirvote.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c index b5ad9d99f2..2b837cce57 100644 --- a/src/feature/dirauth/dirvote.c +++ b/src/feature/dirauth/dirvote.c @@ -4219,7 +4219,8 @@ compare_routerinfo_addrs_by_family(const routerinfo_t *a, { const tor_addr_t *addr1 = (family==AF_INET) ? &a->ipv4_addr : &a->ipv6_addr; const tor_addr_t *addr2 = (family==AF_INET) ? &b->ipv4_addr : &b->ipv6_addr; - return tor_addr_compare(addr1, addr2, CMP_EXACT); + const int maskbits = (family==AF_INET) ? 32 : 64; + return tor_addr_compare_masked(addr1, addr2, maskbits, CMP_EXACT); } /** Helper for sorting: compares two ipv4 routerinfos first by ipv4 address, |