[tor-bugs] #12377 [Tor]: get_interface_address6() behaviour iff all interface addresses are internal

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Jun 11 19:05:23 UTC 2014


#12377: get_interface_address6() behaviour iff all interface addresses are internal
--------------------+----------------------------------
 Reporter:  rl1987  |          Owner:
     Type:  defect  |         Status:  new
 Priority:  normal  |      Milestone:
Component:  Tor     |        Version:  Tor: unspecified
 Keywords:          |  Actual Points:
Parent ID:  #12376  |         Points:
--------------------+----------------------------------
 First, let us assume that all network interfaces for IP host that runs Tor
 instance are internal as judged by `tor_addr_is_internal()` function.

 There is the following code in `get_interface_address6()` function.

 {{{
   /* Try to do this the smart way if possible. */
   if ((addrs = get_interface_addresses_raw(severity))) {
     int rv = -1;
     SMARTLIST_FOREACH_BEGIN(addrs, tor_addr_t *, a) {
       if (family != AF_UNSPEC && family != tor_addr_family(a))
         continue;
       if (tor_addr_is_loopback(a) ||
           tor_addr_is_multicast(a))
         continue;

       tor_addr_copy(addr, a);
       rv = 0;

       /* If we found a non-internal address, declare success.  Otherwise,
        * keep looking. */
       if (!tor_addr_is_internal(a, 0))
         break;
     } SMARTLIST_FOREACH_END(a);

     SMARTLIST_FOREACH(addrs, tor_addr_t *, a, tor_free(a));
     smartlist_free(addrs);
     return rv;
   }

 }}}

 Caller will get the last entry from a interface address smartlist. Is this
 okay?

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


More information about the tor-bugs mailing list