Eliminate "family" field in tor_addr_t
View options
- Truncate descriptions
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.
- Show labels
- Show closed items