For the DoS mitigation subsystem (legacy/trac#24902 (moved)), we need a way to lookup the connection address and quickly know if it is a known relay or not. This is also needed for legacy/trac#2667 (moved) which would prevent Exit to reenter the network.
nickm has started a branch to have IP addresses with bloom filter: address_set_029.
Next step is to use that and bridge it with the nodelist so we can lookup an IP address and learn if it is known or not (not get the node_t back, that would require more work and probably lose in performance).
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
I've written unit tests for both using address_set_t and the integration with the nodelist.
Quick thing though, I've renamed addressset.c to address_set.c because that triple 's' was kind of intense and difficult to brain-parse on what it is exactly. Furthermore, the namespace for this file is address_set_* so that just makes sense I think.
Also, if we ever store an AF_UNSPEC address, these lines should probably hash the constant:
{{{
case AF_UNSPEC:
return 0x4e4d5342;
}}}
For consistency, we should hash the constant in both the keyed and unkeyed versions of the function.
Not sure here... First, I don't think it should ever be called with AF_UNSPEC but apart from that, imo we want to save CPU cycles as much as possible since this is called very very often. Hashing a constant value will just make us be less efficient without any gain. I would probably go for a comment explaining why we do return that value or wrap it in some macro with a semantic that describes it as a "hash value".
And I believe the goal behind having a constant value for the AF_UNSPEC here is that if we ever store one or a billion of those, the function is to return quickly "yes we do have an unspecified address". I honestly don't see a use case for that apart from very efficiently ignoring any of them if they ever go through that function.
To give my rationale for making the AF_UNSPEC change: I think it's harmless to have AF_UNSPEC be a constant in the current usage, but it's fragile. When we promise a keyed hash, we ought to implement one, or we might find ourselves surprised later on.