mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Merge remote-tracking branch 'dgoulet/ticket21269_030_01'
This commit is contained in:
commit
3bfe5dae04
3
changes/feature21269
Normal file
3
changes/feature21269
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor Feature (client):
|
||||||
|
- Enable IPv6 traffic by default on the SocksPort. To disable this, a user
|
||||||
|
will have to specify "NoIPv6Traffic". Closes #21269.
|
@ -6246,6 +6246,7 @@ port_cfg_new(size_t namelen)
|
|||||||
tor_assert(namelen <= SIZE_T_CEILING - sizeof(port_cfg_t) - 1);
|
tor_assert(namelen <= SIZE_T_CEILING - sizeof(port_cfg_t) - 1);
|
||||||
port_cfg_t *cfg = tor_malloc_zero(sizeof(port_cfg_t) + namelen + 1);
|
port_cfg_t *cfg = tor_malloc_zero(sizeof(port_cfg_t) + namelen + 1);
|
||||||
cfg->entry_cfg.ipv4_traffic = 1;
|
cfg->entry_cfg.ipv4_traffic = 1;
|
||||||
|
cfg->entry_cfg.ipv6_traffic = 1;
|
||||||
cfg->entry_cfg.dns_request = 1;
|
cfg->entry_cfg.dns_request = 1;
|
||||||
cfg->entry_cfg.onion_traffic = 1;
|
cfg->entry_cfg.onion_traffic = 1;
|
||||||
cfg->entry_cfg.cache_ipv4_answers = 1;
|
cfg->entry_cfg.cache_ipv4_answers = 1;
|
||||||
@ -6599,7 +6600,7 @@ parse_port_config(smartlist_t *out,
|
|||||||
/* This must be kept in sync with port_cfg_new's defaults */
|
/* This must be kept in sync with port_cfg_new's defaults */
|
||||||
int no_listen = 0, no_advertise = 0, all_addrs = 0,
|
int no_listen = 0, no_advertise = 0, all_addrs = 0,
|
||||||
bind_ipv4_only = 0, bind_ipv6_only = 0,
|
bind_ipv4_only = 0, bind_ipv6_only = 0,
|
||||||
ipv4_traffic = 1, ipv6_traffic = 0, prefer_ipv6 = 0, dns_request = 1,
|
ipv4_traffic = 1, ipv6_traffic = 1, prefer_ipv6 = 0, dns_request = 1,
|
||||||
onion_traffic = 1,
|
onion_traffic = 1,
|
||||||
cache_ipv4 = 1, use_cached_ipv4 = 0,
|
cache_ipv4 = 1, use_cached_ipv4 = 0,
|
||||||
cache_ipv6 = 0, use_cached_ipv6 = 0,
|
cache_ipv6 = 0, use_cached_ipv6 = 0,
|
||||||
|
@ -4129,6 +4129,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
||||||
config_port_invalid = mock_config_line("SOCKSPort",
|
config_port_invalid = mock_config_line("SOCKSPort",
|
||||||
"unix:/tmp/foo/bar NoIPv4Traffic "
|
"unix:/tmp/foo/bar NoIPv4Traffic "
|
||||||
|
"NoIPv6Traffic "
|
||||||
"NoOnionTraffic");
|
"NoOnionTraffic");
|
||||||
ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
|
ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
|
||||||
CONN_TYPE_AP_LISTENER, NULL, 0,
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
||||||
@ -4150,6 +4151,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
||||||
smartlist_clear(slout);
|
smartlist_clear(slout);
|
||||||
config_port_valid = mock_config_line("DNSPort", "127.0.0.1:80 "
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.1:80 "
|
||||||
|
"NoIPv6Traffic "
|
||||||
"NoIPv4Traffic NoOnionTraffic");
|
"NoIPv4Traffic NoOnionTraffic");
|
||||||
ret = parse_port_config(slout, config_port_valid, NULL, "DNS",
|
ret = parse_port_config(slout, config_port_valid, NULL, "DNS",
|
||||||
CONN_TYPE_AP_DNS_LISTENER, NULL, 0,
|
CONN_TYPE_AP_DNS_LISTENER, NULL, 0,
|
||||||
@ -4165,6 +4167,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
// Test failure if we have DNS but no ipv4 and no ipv6
|
// Test failure if we have DNS but no ipv4 and no ipv6
|
||||||
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
||||||
config_port_invalid = mock_config_line("SOCKSPort",
|
config_port_invalid = mock_config_line("SOCKSPort",
|
||||||
|
"NoIPv6Traffic "
|
||||||
"unix:/tmp/foo/bar NoIPv4Traffic");
|
"unix:/tmp/foo/bar NoIPv4Traffic");
|
||||||
ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
|
ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
|
||||||
CONN_TYPE_AP_LISTENER, NULL, 0,
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
||||||
@ -4177,6 +4180,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
||||||
smartlist_clear(slout);
|
smartlist_clear(slout);
|
||||||
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
|
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
|
||||||
|
"NoIPv6Traffic "
|
||||||
"NoDNSRequest NoIPv4Traffic");
|
"NoDNSRequest NoIPv4Traffic");
|
||||||
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
||||||
CONN_TYPE_AP_LISTENER, NULL, 0,
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
||||||
@ -4198,6 +4202,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
||||||
smartlist_clear(slout);
|
smartlist_clear(slout);
|
||||||
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar\" "
|
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar\" "
|
||||||
|
"NoIPv6Traffic "
|
||||||
"NoDNSRequest NoIPv4Traffic");
|
"NoDNSRequest NoIPv4Traffic");
|
||||||
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
||||||
CONN_TYPE_AP_LISTENER, NULL, 0,
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
||||||
@ -4219,6 +4224,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
||||||
smartlist_clear(slout);
|
smartlist_clear(slout);
|
||||||
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar "
|
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar "
|
||||||
|
"NoIPv6Traffic "
|
||||||
"NoDNSRequest NoIPv4Traffic");
|
"NoDNSRequest NoIPv4Traffic");
|
||||||
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
||||||
CONN_TYPE_AP_LISTENER, NULL, 0,
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
||||||
@ -4230,6 +4236,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
||||||
smartlist_clear(slout);
|
smartlist_clear(slout);
|
||||||
config_port_valid = mock_config_line("SOCKSPort", "unix:\"\" "
|
config_port_valid = mock_config_line("SOCKSPort", "unix:\"\" "
|
||||||
|
"NoIPv6Traffic "
|
||||||
"NoDNSRequest NoIPv4Traffic");
|
"NoDNSRequest NoIPv4Traffic");
|
||||||
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
||||||
CONN_TYPE_AP_LISTENER, NULL, 0,
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
||||||
@ -4604,7 +4611,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|||||||
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
||||||
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
|
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
|
||||||
tt_int_op(port_cfg->entry_cfg.ipv4_traffic, 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, 0);
|
tt_int_op(port_cfg->entry_cfg.ipv6_traffic, OP_EQ, 1);
|
||||||
|
|
||||||
// Test failure for a SessionGroup argument with invalid value
|
// Test failure for a SessionGroup argument with invalid value
|
||||||
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user