[tor-bugs] #17949 [Tor]: Make loopback address search more accurate (was: Make loopback address search more efficient)

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Feb 10 23:38:28 UTC 2016


#17949: Make loopback address search more accurate
------------------------------------+------------------------------------
 Reporter:  teor                    |          Owner:  rl1987
     Type:  enhancement             |         Status:  needs_revision
 Priority:  Medium                  |      Milestone:  Tor: 0.2.8.x-final
Component:  Tor                     |        Version:
 Severity:  Normal                  |     Resolution:
 Keywords:  easy TorCoreTeam201602  |  Actual Points:
Parent ID:  #17991                  |         Points:  medium
  Sponsor:                          |
------------------------------------+------------------------------------
Changes (by teor):

 * status:  needs_review => needs_revision


Comment:

 Replying to [comment:17 nickm]:
 > Hm. This makes a big pile of changes throughout the code, and adds an
 extra flag argument to get_interface_address6_list, which all callers must
 get right.  It doesn't actually seem to make loopback detection more
 efficient, except by avoiding some allocations. Also, I don't know any
 reason to think that loopback lookup is actually performance-critical.
 >
 > teor, rl1987 -- Are you sure this is a win?

 These changes fix bugs in the current loopback detection code. (Sorry, the
 ticket summary is badly worded.) The previous code avoided returning
 loopback addresses. But need to know local loopback addresses for #17901
 and IPv6 localhost support (#11360 and #17835).

 The patch checks that loopback addresses are 127/8 or ::1, which is
 halfway there.

 But the patch doesn't actually check that the addresses returned are on a
 loopback interface:
 > getifaddrs returns struct ifaddrs with ifa_flags which has IFF_LOOPBACK
 > ioctl(.,SIOCGIFCONF,.) returns struct ifreq with ifr_flags which has
 IFF_LOOPBACK
 > GetAdaptersAddresses (Win32) returns IP_ADAPTER_ADDRESSES with IfType
 which has IF_TYPE_SOFTWARE_LOOPBACK

 So once it's modified to do that, it's a definite win.

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


More information about the tor-bugs mailing list