[tor-bugs] #28525 [Core Tor/Tor]: Make tor_addr_is_internal_() aware of RFC 6598 (Carrier Grade NAT/Large Scale NAT) IPv4 Ranges

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Feb 28 02:46:35 UTC 2019


#28525: Make tor_addr_is_internal_() aware of RFC 6598 (Carrier Grade NAT/Large
Scale NAT) IPv4 Ranges
-----------------------------------------+---------------------------------
 Reporter:  neel                         |          Owner:  neel
     Type:  enhancement                  |         Status:  needs_revision
 Priority:  Medium                       |      Milestone:  Tor:
                                         |  unspecified
Component:  Core Tor/Tor                 |        Version:
 Severity:  Normal                       |     Resolution:
 Keywords:  ipv6, 040-deferred-20190220  |  Actual Points:
Parent ID:                               |         Points:
 Reviewer:  nickm                        |        Sponsor:
-----------------------------------------+---------------------------------
Changes (by teor):

 * status:  needs_review => needs_revision


Comment:

 Replying to [comment:17 nickm]:
 > looks okay to me.  I'd like Teor to take one last look too, if they're
 free.  Then let's merge!

 I don't think this patch changes Tor's behaviour at all:
 * Tor previously returned 0 for RFC6598 addresses.
 * This patch adds a new check for RFC6598 addresses, and then changes the
 calling code to pass IP_LISTEN_EXTERNAL, so that RFC6598 addresses always
 return 0 anyway.

 Here's what I think the patch should do:
 * When connecting, RFC6598 addresses are like internal addresses, because
 they are not publicly routable, so tor can not connect to relay ports on
 these addresses
 * When listening, RFC6598 addresses are like external addresses, because
 other people might be able to access them, so tor should not listen to
 client ports on these addresses
 In short, RFC6598 addresses should be treated just like 0.0.0.0.

 After we make that code change, here's how we can make
 tor_addr_is_internal_() easier to understand:
 * document the return value of the function for localhost or local
 networks in RFC1918 or RFC4193 or RFC4291
 * document the return value of the function for 0.0.0.0 and RFC6598
 addresses:
   * when for_listening is set
   * when for_listening is not set
 * explain *why* 0.0.0.0 and RFC6598 addresses are treated differently when
 for_listening is set (see my explanation above)

 After we make these changes, I don't think IP_LISTEN_INTERNAL will ever be
 used in Tor. So we should remove IP_LISTEN_INTERNAL and
 IP_LISTEN_EXTERNAL, and just go back to passing 0 or 1.

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


More information about the tor-bugs mailing list