1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

add value 0 to disable unique-range-size

This commit is contained in:
Jeff Becker 2021-02-19 17:29:39 -05:00
parent f7424b8bbe
commit a3585caa70
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05

View file

@ -996,8 +996,14 @@ namespace llarp
DefaultUniqueCIDR,
ClientOnly,
[=](int arg) {
if (arg > 32 or arg < 4)
if (arg == 0)
{
m_UniqueHopsNetmaskSize = arg;
}
else if (arg > 32 or arg < 4)
{
throw std::invalid_argument{"[paths]:unique-range-size must be between 4 and 32"};
}
m_UniqueHopsNetmaskSize = arg;
},
Comment{"Netmask for router path selection; each router must be from a distinct IP subnet "
@ -1022,6 +1028,8 @@ namespace llarp
bool
PeerSelectionConfig::Acceptable(const std::set<RouterContact>& rcs) const
{
if (m_UniqueHopsNetMask == 0)
return true;
const auto netmask = netmask_ipv6_bits(96 + m_UniqueHopsNetmaskSize);
std::set<IPRange> seenRanges;
for (const auto& hop : rcs)