(This only makes sense for entry nodes: (directory) guards, bridges, fallbacks, authorities - all other relays are referred to by their IPv4 addresses.)
According to teor comments, only entry nodes should be concerned by it.
I've run an IPv6 client (ClientUseIPv4 0 UseMicrodescriptors 0) and I can't find any log of entry points using an IPv4 address.
However, other nodes are referred to by their IPv4 addresses.
An example:
[debug] onion_extend_cpath(): Chose router $A6EDA578BA3CA94AB207841DBD468B0FF991643B~FalkensteinTor01 at 2a01:4f8:1c17:4216::1 for hop #1 (exit is inwaiting)[debug] onion_extend_cpath(): Chose router $AC153580D1DE33051AFC975C7108BCD31CBBC9A1~spaghetti2 at 176.31.181.71 for hop #2 (exit is inwaiting)[debug] onion_extend_cpath(): Chose router $18BFF1DEAA073003108CFDA2C0DE970D8F604478~inwaiting at 178.175.138.98 for hop #3 (exit is inwaiting)
[info] add_an_entry_guard(): Chose %s as new entry guard
I think the function: add_an_entry_guard() has been deleted somewhere between the versions 0.2.3 and 0.2.4 .
Is there any other function with the same bug?
Ok, then they should all be modified so they can use IPv6.
In particular, each of the first 3 functions takes a struct with an IPv4 and IPv6 address, and so it should report both, if they are present.
Do you think it would be better to be able to show both addresses?
By now, the buffer used has space for this output format:
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at [ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]"
But I think the functions only return strings in one of the following formats (please confirm this if you can):
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at ffff:ffff:ffff:ffff:ffff:ffff"or"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at 255.255.255.255"
We could add a separator and show both addresses, something like (increasing the buffer size by 2):
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at [ffff:ffff:ffff:ffff:ffff:ffff | 255.255.255.255]"
And we could let the caller decide what address it want as output (only IPv4, only IPv6 or both), letting "only IPv4" as default.
Do you think it would be better to be able to show both addresses?
By now, the buffer used has space for this output format:
{{{
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at
[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]"
}}}
This legacy format prints the last 4 bytes of the IPv6 address like an IPv4 address, it is never used in Tor.
But I think the functions only return strings in one of the following formats (please confirm this if you can):
{{{
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFxxxxxxxxxxxxxxxxxxx at ffff:ffff:ffff:ffff:ffff:ffff"
or
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFxxxxxxxxxxxxxxxxxxx at 255.255.255.255"
}}}
An IPv6 address has 128 bits, yours is 32 bits short.
We are trying to always print IPv6 addresses between brackets.
We could add a separator and show both addresses, something like (increasing the buffer size by 2):
{{{
"$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at
[ffff:ffff:ffff:ffff:ffff:ffff | 255.255.255.255]"
}}}
The IPv6 address should be last, and in brackets.
The IPv4 address should not be in brackets.
I suggest using "or", to match "at".
And we could let the caller decide what address it want as output (only IPv4, only IPv6 or both), letting "only IPv4" as default.
We should always print all the addresses that are present.