[tor-bugs] #18529 [Tor]: Fix duplicate check for "only allow internal addresses if we are on a network with nonstandard authorities"

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Mar 11 16:25:42 UTC 2016


#18529: Fix duplicate check for "only allow internal addresses if we are on a
network with nonstandard authorities"
-------------------------+--------------------------------
     Reporter:  nickm    |      Owner:
         Type:  defect   |     Status:  new
     Priority:  Low      |  Milestone:  Tor: 0.2.???
    Component:  Tor      |    Version:  Tor: 0.2.8.1-alpha
     Severity:  Trivial  |   Keywords:  easy, refactor
Actual Points:           |  Parent ID:
       Points:  small    |   Reviewer:
      Sponsor:           |
-------------------------+--------------------------------
 We have this code in config.c:
 {{{
   if (tor_addr_is_internal(&myaddr, 0)) {
     /* make sure we're ok with publishing an internal IP */
     if (!options->DirAuthorities && !options->AlternateDirAuthority) {
       /* if they are using the default authorities, disallow internal IPs
        * always. */
       log_fn(warn_severity, LD_CONFIG,
              "Address '%s' resolves to private IP address '%s'. "
              "Tor servers that use the default DirAuthorities must have "
              "public IP addresses.", hostname, addr_string);
       tor_free(addr_string);
       return -1;
     }
 ...
 }}}

 And we now have this code in router.c (since #17153):
 {{{
         /* Like IPv4, if the relay is configured using the default
          * authorities, disallow internal IPs. Otherwise, allow them. */
         const int default_auth = (!options->DirAuthorities &&
                                   !options->AlternateDirAuthority);
         if (! tor_addr_is_internal(&p->addr, 0) || ! default_auth) {
           ipv6_orport = p;
           break;
 ...
 }}}

 These two checks are similar and I'd prefer that they be merged when
 possible.

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


More information about the tor-bugs mailing list