[tor-bugs] #33898 [Core Tor/Tor]: Stop modifying addr on connections, and delete real_addr

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Apr 14 01:56:09 UTC 2020


#33898: Stop modifying addr on connections, and delete real_addr
-------------------------------+-------------------------------------------
     Reporter:  teor           |      Owner:  nickm
         Type:  defect         |     Status:  assigned
     Priority:  High           |  Milestone:  Tor: 0.4.4.x-final
    Component:  Core Tor/Tor   |    Version:
     Severity:  Normal         |   Keywords:  ipv6, technical-debt, prop311
Actual Points:                 |  Parent ID:  #33048
       Points:  1              |   Reviewer:
      Sponsor:  Sponsor55-can  |
-------------------------------+-------------------------------------------
 In connection_or_check_canonicity(), we overwrite conn.addr with the
 canonical address of the relay in the consensus. That makes accurate
 logging impossible.

 And so we also need channel.real_addr, to store the actual address of the
 remote peer. And for some reason, we also have conn.address, a string copy
 of the peer's canonical address and port.

 This is... a mess.

 Here's the high-level interface I'd like to see:
 * use a function to format a connection or channel addresses for loogging
 * use exactly as many address and port variables as needed in connection
 and channel (no extras!)
 * qualify each address and port variable's name with its purpose

 For example, here's one possible design:
 * delete addr, port, address, and real_addr
 * add remote_ap, a tor_addr_port_t that is the remote address and port of
 the TCP connection to the remote peer
 * implement connection_describe(), which:
   * formats remote_ap,
   * formats is_canonical (and any other useful info), and
   * calls node_describe() to format the canonical IPv4 and IPv6 addresses
 and ports of the remote peer.

 If we need separate variables or functions for channels, we can use a
 similar design. (But ideally, re-using as many functions and variables as
 possible.)

 This is important for Sponsor 55: getting accurate connection information
 will make diagnosing bugs much easier.

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


More information about the tor-bugs mailing list