Relay does not pick the right IP addr of local node when multiple interfaces are available
My laptop has two network interfaces: eth0, statically configured, in use when I'm wired in my office; and ppp0, dynamically configured, when I'm abroad and use a 3G wireless interface.
When I'm on eth0 (LAN), the tor relay works regularly. When I'm on the ppp0 (3G wireless), the tor relay works too but the ORPort and DirPort are not reachable from the outside, because the relay still picks the IP address associated to eth0 instead of ppp0.
This problem affects both on the stable release (0.2.2.35) and the latest git snapshot (and probably many other releases).
With the stable release, I've tracked the bug down to src/or/config.c:resolve_my_address(), a rather messy piece of code which mistakenly resolves via hostname rather than picking the IP address based on the actual route default. I had to rewrite that function almost from scratch, and now it works.
With the latest snapshot, same problem in src/or/config.c:resolve_my_address(), plus another issue in src/common/address.c:get_interface_address6(): here a list of all net devices available is built, but then the first valid one is picked, regardless of it being the one in use or not (on my laptop it always chooses eth0). Solved by disabling the list of net devices, thus falling back to the default "discovery" mechanism (the only one implemented in the stable release).
I have patches, if needed.