aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-01-20 10:47:49 -0500
committerDavid Goulet <dgoulet@torproject.org>2020-01-20 10:47:49 -0500
commitff93133403fa927eedc424dfb00557fcaab6aede (patch)
tree01a1a678749a415e2d027f2572147f820f4f837d
parentca8b90a843b404799550fb88f8542040698d2a94 (diff)
parent6898131b41fe7c2ddf90a74c1793a15c41337940 (diff)
downloadtor-ff93133403fa927eedc424dfb00557fcaab6aede.tar.gz
tor-ff93133403fa927eedc424dfb00557fcaab6aede.zip
Merge branch 'tor-github/pr/1675'
-rw-r--r--changes/ticket326376
-rw-r--r--doc/tor.1.txt24
-rw-r--r--src/app/config/config.c3
-rw-r--r--src/core/mainloop/connection.c2
-rw-r--r--src/test/test_config.c2
5 files changed, 25 insertions, 12 deletions
diff --git a/changes/ticket32637 b/changes/ticket32637
new file mode 100644
index 0000000000..253f445c89
--- /dev/null
+++ b/changes/ticket32637
@@ -0,0 +1,6 @@
+ o Minor features (IPv6, client):
+ - Make Tor clients tell dual-stack exits that they prefer IPv6
+ connections. This change is equivalent to setting the PreferIPv6 flag
+ on SOCKSPorts (and most other listener ports). Tor Browser has been
+ setting this flag for some time, and we want to remove a client
+ distinguisher at exits. Closes ticket 32637.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 456176cbfb..a5108df805 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -1703,7 +1703,9 @@ The following options are useful only for clients (that is, if
connections via SOCKS. Set it to "auto" to have Tor pick a port for
you. This directive can be specified multiple times to bind
to multiple addresses/ports. If a unix domain socket is used, you may
- quote the path using standard C escape sequences.
+ quote the path using standard C escape sequences. Most flags are off by
+ default, except where specified. Flags that are on by default can be
+ disabled by putting "No" before the flag name.
(Default: 9050) +
+
NOTE: Although this option allows you to specify an IP address
@@ -1757,14 +1759,16 @@ The following options are useful only for clients (that is, if
Other recognized __flags__ for a SocksPort are:
**NoIPv4Traffic**;;
Tell exits to not connect to IPv4 addresses in response to SOCKS
- requests on this connection.
- **IPv6Traffic**;;
- Tell exits to allow IPv6 addresses in response to SOCKS requests on
- this connection, so long as SOCKS5 is in use. (SOCKS4 can't handle
- IPv6.)
- **PreferIPv6**;;
+ requests on this connection. (Allowing IPv4 is the default.)
+ **NoIPv6Traffic**;;
+ Tell exits to not connect to IPv6 addresses in response to SOCKS
+ requests on this connection. This option is only relevant when SOCKS5
+ is in use, because SOCKS4 can't handle IPv6. (Allowing IPv6 is the
+ default.)
+ **NoPreferIPv6**;;
Tells exits that, if a host has both an IPv4 and an IPv6 address,
- we would prefer to connect to it via IPv6. (IPv4 is the default.)
+ we would prefer to connect to it via IPv4. (IPv6 is the default in
+ recent versions of Tor.)
**NoDNSRequest**;;
Do not ask exits to resolve DNS addresses in SOCKS5 requests. Tor will
connect to IPv4 addresses, IPv6 addresses (if IPv6Traffic is set) and
@@ -1802,11 +1806,11 @@ The following options are useful only for clients (that is, if
**UseDNSCache**;;
Tells the client to use any cached DNS answers we have when making
requests via this connection.
- **PreferIPv6Automap**;;
+ **NoPreferIPv6Automap**;;
When serving a hostname lookup request on this port that
should get automapped (according to AutomapHostsOnResolve),
if we could return either an IPv4 or an IPv6 answer, prefer
- an IPv6 answer. (On by default.)
+ an IPv4 answer. (Tor prefers IPv6 by default.)
**PreferSOCKSNoAuth**;;
Ordinarily, when an application offers both "username/password
authentication" and "no authentication" to Tor via SOCKS5, Tor
diff --git a/src/app/config/config.c b/src/app/config/config.c
index bc65977b20..bbf984ad08 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -5886,6 +5886,7 @@ port_cfg_new(size_t namelen)
port_cfg_t *cfg = tor_malloc_zero(sizeof(port_cfg_t) + namelen + 1);
cfg->entry_cfg.ipv4_traffic = 1;
cfg->entry_cfg.ipv6_traffic = 1;
+ cfg->entry_cfg.prefer_ipv6 = 1;
cfg->entry_cfg.dns_request = 1;
cfg->entry_cfg.onion_traffic = 1;
cfg->entry_cfg.prefer_ipv6_virtaddr = 1;
@@ -6133,7 +6134,7 @@ port_parse_config(smartlist_t *out,
/* This must be kept in sync with port_cfg_new's defaults */
int no_listen = 0, no_advertise = 0, all_addrs = 0,
bind_ipv4_only = 0, bind_ipv6_only = 0,
- ipv4_traffic = 1, ipv6_traffic = 1, prefer_ipv6 = 0, dns_request = 1,
+ ipv4_traffic = 1, ipv6_traffic = 1, prefer_ipv6 = 1, dns_request = 1,
onion_traffic = 1,
cache_ipv4 = 0, use_cached_ipv4 = 0,
cache_ipv6 = 0, use_cached_ipv6 = 0,
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index f0ebce9bbb..223428a8f6 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -1516,7 +1516,7 @@ connection_listener_new(const struct sockaddr *listensockaddr,
if (type != CONN_TYPE_AP_LISTENER) {
lis_conn->entry_cfg.ipv4_traffic = 1;
lis_conn->entry_cfg.ipv6_traffic = 1;
- lis_conn->entry_cfg.prefer_ipv6 = 0;
+ lis_conn->entry_cfg.prefer_ipv6 = 1;
}
if (connection_add(conn) < 0) { /* no space, forget it */
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 9e14e2e25a..ee277104fb 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -4158,6 +4158,8 @@ test_config_parse_port_config__ports__ports_given(void *data)
/* Test entry port defaults as initialised in port_parse_config */
tt_int_op(port_cfg->entry_cfg.dns_request, OP_EQ, 1);
tt_int_op(port_cfg->entry_cfg.ipv4_traffic, OP_EQ, 1);
+ tt_int_op(port_cfg->entry_cfg.ipv6_traffic, OP_EQ, 1);
+ tt_int_op(port_cfg->entry_cfg.prefer_ipv6, OP_EQ, 1);
tt_int_op(port_cfg->entry_cfg.onion_traffic, OP_EQ, 1);
tt_int_op(port_cfg->entry_cfg.cache_ipv4_answers, OP_EQ, 0);
tt_int_op(port_cfg->entry_cfg.prefer_ipv6_virtaddr, OP_EQ, 1);