IPv4-mapped IPV6 addresses fail badly
Originally discovered when debugging signal-cli via torsocks: torsocks#40009 (comment 2803952)
I can now reproduce without torsocks:
The following command, connecting to facebook's ipv6 address via tor, works as expected:
$ curl -k -L --preproxy socks5://localhost:9050 https://[2a03:2880:f134:83:face:b00c:0:25de]
Without tor, we can also connect to facebook's ipv4 address via ipv6, using a IPv4-mapped IPv6 address:
$ curl -k -L --preproxy https://[::ffff:31.13.93.35]
However if we try to do that using tor, the connection attempt hangs in curl. In the tor log we see it repeatedly trying and failing to build a path:
$ curl -k -L --preproxy socks5://localhost:9050 https://[::ffff:31.13.93.35]
With tor running as:
tor --SocksPort "ip6-localhost:9050 IPv6Traffic" --SocksPort "localhost:9050 IPv6Traffic" --Log "debug" --SafeLogging 0 --ClientUseIPv6 1
We get lines like:
May 17 15:38:04.000 [info] connection_ap_process_end_not_open(): Address '[::ffff:31.13.93.35]' refused due to 'exit policy failed'. Considering retrying.
May 17 15:38:04.000 [debug] addr_policy_append_reject_addr(): Adding a reject ExitPolicy 'reject ::ffff:31.13.93.35:*'
Full tor log: tor-v6-mapped.log.gz
Edited by Jim Newsome