Commit 691c7171 authored by David Goulet's avatar David Goulet 🤘
Browse files

Revert "IPv6 sybil: consider addresses in the same /64 to be equal."

This reverts commit d07f17f6.

We don't want to consider an entire routable IPv6 network as sybil if more
than 2 relays happen to be on it. For path selection it is very important but
not for selecting relays in the consensus.

Fixes #40243
parent e5a0c739
o Major bugfixes (authority, IPv6):
- Do not consider multiple relays in the same IPv6 network to be sybils.
Sybils are selected based on the /128 now, not the /64. Fixes bug 40243;
bugfix on 0.4.5.1-alpha.
...@@ -4219,8 +4219,7 @@ compare_routerinfo_addrs_by_family(const routerinfo_t *a, ...@@ -4219,8 +4219,7 @@ 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 *addr1 = (family==AF_INET) ? &a->ipv4_addr : &a->ipv6_addr;
const tor_addr_t *addr2 = (family==AF_INET) ? &b->ipv4_addr : &b->ipv6_addr; const tor_addr_t *addr2 = (family==AF_INET) ? &b->ipv4_addr : &b->ipv6_addr;
const int maskbits = (family==AF_INET) ? 32 : 64; return tor_addr_compare(addr1, addr2, CMP_EXACT);
return tor_addr_compare_masked(addr1, addr2, maskbits, CMP_EXACT);
} }
/** Helper for sorting: compares two ipv4 routerinfos first by ipv4 address, /** Helper for sorting: compares two ipv4 routerinfos first by ipv4 address,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment