Make routerinfo_t and routerstatus_t addresses immutable; store overrides in node_t
See this comment in rewrite_node_address_for_bridge
:
/* XXXX overridden addresses should really live in the node_t, so that the
* routerinfo_t and the microdesc_t can be immutable. But we can only
* do that safely if we know that no function that connects to an OR
* does so through an address from any source other than node_get_addr().
*/
Here's how we can do that, in several phases.
-
Add an "override orport" tor_addrport_t in node_t which, if set, overrides the advertised ports. Make rewrite_node_address_for_bridge() overrwrite that in addition to the stuff it already overwrites.
-
Make the various node_get*_addr() look at that field.
-
Rename ri->addr, ri->port, md->addr, and md->port, possibly combining them to use the tor_addrport_t structure. This will break everything that uses them. As we fix those compilation errors, make sure that everything using them to decide where to connect uses node_get*_addr() instead -- specifically, one of the functions modified in 2 above.
-
Remove the extra logic in rewrite_node_address_for_bridge().