[tor-bugs] #4676 [Tor Relay]: Eliminate "family" field in tor_addr_t

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Thu Dec 8 22:16:48 UTC 2011


#4676: Eliminate "family" field in tor_addr_t
-------------------------+--------------------------------------------------
 Reporter:  nickm        |          Owner:                    
     Type:  enhancement  |         Status:  new               
 Priority:  normal       |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor Relay    |        Version:                    
 Keywords:               |         Parent:                    
   Points:               |   Actualpoints:                    
-------------------------+--------------------------------------------------
 The tor_addr_t structure has a "family" member that stores AF_INET,
 AF_INET6, or AF_UNSPEC.  So in theory we'd need only 3 bits for it... but
 in practice, it bumps up the size of the structure by 4-8 bytes, because
 of alignment issues.

 This excess space matters, because we allocate a whole lot of tor_addr_ts.
 For example, we allocate one for every exit policy entry.

 We can save space here by using the "v4-mapped address" trick of RFC4291,
 and using ::ffff:1.2.3.4 as the representation of 1.2.3.4.  For AF_UNSPEC,
 we can just choose a sentinel value.

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


More information about the tor-bugs mailing list