commit d07f17f67685d75fec8a851b3ae3d157c1e31aa3 Author: Nick Mathewson nickm@torproject.org Date: Wed Sep 23 12:06:38 2020 -0400
IPv6 sybil: consider addresses in the same /64 to be equal. --- src/feature/dirauth/dirvote.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
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,
tor-commits@lists.torproject.org