[tor-bugs] #25183 [Core Tor/Tor]: Implement a way to tell if an IP address is a known relay

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Feb 12 15:21:49 UTC 2018


#25183: Implement a way to tell if an IP address is a known relay
-------------------------------------------------+-------------------------
 Reporter:  dgoulet                              |          Owner:  dgoulet
     Type:  defect                               |         Status:
                                                 |  needs_revision
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.3.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-relay, tor-dos, 029-backport,    |  Actual Points:
  031-backport, 032-backport                     |
Parent ID:  #24902                               |         Points:
 Reviewer:  dgoulet                              |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by dgoulet):

 Replying to [comment:7 teor]:
 > 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, 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.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25183#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list