Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: mary-em/torprojet-tor
base: master
head repository: mary-em/torprojet-tor
compare: b-t24732
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 10 files changed
  • 0 comments
  • 1 contributor
Showing with 43 additions and 315 deletions.
  1. +0 −9 doc/tor.1.txt
  2. +1 −3 src/or/config.c
  3. +8 −10 src/or/connection.c
  4. +0 −105 src/or/nodelist.c
  5. +0 −7 src/or/nodelist.h
  6. +0 −6 src/or/or.h
  7. +24 −90 src/or/policies.c
  8. +0 −5 src/or/policies.h
  9. +5 −10 src/test/test_options.c
  10. +5 −70 src/test/test_policy.c
@@ -1701,15 +1701,6 @@ The following options are useful only for clients (that is, if
in a **Bridge**, proxy, or pluggable transport line will try connecting
over IPv6 even if **ClientUseIPv6** is set to 0. (Default: 0)

[[ClientPreferIPv6DirPort]] **ClientPreferIPv6DirPort** **0**|**1**|**auto**::
If this option is set to 1, Tor prefers a directory port with an IPv6
address over one with IPv4, for direct connections, if a given directory
server has both. (Tor also prefers an IPv6 DirPort if IPv4Client is set to
0.) If this option is set to auto, clients prefer IPv4. Other things may
influence the choice. This option breaks a tie to the favor of IPv6.
(Default: auto) (DEPRECATED: This option has had no effect for some
time.)

[[ClientPreferIPv6ORPort]] **ClientPreferIPv6ORPort** **0**|**1**|**auto**::
If this option is set to 1, Tor prefers an OR port with an IPv6
address over one with IPv4 if a given entry node has both. (Tor also
@@ -268,7 +268,7 @@ static config_var_t option_vars_[] = {
V(ClientDNSRejectInternalAddresses, BOOL,"1"),
V(ClientOnly, BOOL, "0"),
V(ClientPreferIPv6ORPort, AUTOBOOL, "auto"),
V(ClientPreferIPv6DirPort, AUTOBOOL, "auto"),
OBSOLETE("ClientPreferIPv6DirPort"),
V(ClientRejectInternalAddresses, BOOL, "1"),
V(ClientTransportPlugin, LINELIST, NULL),
V(ClientUseIPv6, BOOL, "0"),
@@ -726,8 +726,6 @@ static const config_deprecation_t option_deprecation_notes_[] = {
/* Options deprecated since 0.3.2.2-alpha */
{ "ReachableDirAddresses", "It has no effect on relays, and has had no "
"effect on clients since 0.2.8." },
{ "ClientPreferIPv6DirPort", "It has no effect on relays, and has had no "
"effect on clients since 0.2.8." },
/* End of options deprecated since 0.3.2.2-alpha. */

{ NULL, NULL }
@@ -1872,8 +1872,7 @@ connection_connect_log_client_use_ip_version(const connection_t *conn)
const int must_ipv4 = !fascist_firewall_use_ipv6(options);
const int must_ipv6 = (options->ClientUseIPv4 == 0);
const int pref_ipv6 = (conn->type == CONN_TYPE_OR
? fascist_firewall_prefer_ipv6_orport(options)
: fascist_firewall_prefer_ipv6_dirport(options));
&& fascist_firewall_prefer_ipv6_orport(options));
tor_addr_t real_addr;
tor_addr_make_null(&real_addr, AF_UNSPEC);

@@ -1910,16 +1909,15 @@ connection_connect_log_client_use_ip_version(const connection_t *conn)
/* Check if we couldn't satisfy an address family preference */
if ((!pref_ipv6 && tor_addr_family(&real_addr) == AF_INET6)
|| (pref_ipv6 && tor_addr_family(&real_addr) == AF_INET)) {
log_info(LD_NET, "Outgoing connection to %s doesn't satisfy "
"ClientPreferIPv6%sPort %d, with ClientUseIPv4 %d, and "
log_info(LD_NET, "Outgoing %s connection to %s doesn't satisfy "
"ClientPreferIPv6ORPort %d, with ClientUseIPv4 %d, and "
"fascist_firewall_use_ipv6 %d (ClientUseIPv6 %d and UseBridges "
"%d).",
fmt_addr(&real_addr),
conn->type == CONN_TYPE_OR ? "OR" : "Dir",
conn->type == CONN_TYPE_OR ? options->ClientPreferIPv6ORPort
: options->ClientPreferIPv6DirPort,
options->ClientUseIPv4, fascist_firewall_use_ipv6(options),
options->ClientUseIPv6, options->UseBridges);
conn->type == CONN_TYPE_OR ? "OR" : "Dir",
fmt_addr(&real_addr),
options->ClientPreferIPv6ORPort,
options->ClientUseIPv4, fascist_firewall_use_ipv6(options),
options->ClientUseIPv6, options->UseBridges);
}
}

@@ -1396,26 +1396,6 @@ node_get_declared_family(const node_t *node)
return NULL;
}

/* Does this node have a valid IPv6 address?
* Prefer node_has_ipv6_orport() or node_has_ipv6_dirport() for
* checking specific ports. */
int
node_has_ipv6_addr(const node_t *node)
{
/* Don't check the ORPort or DirPort, as this function isn't port-specific,
* and the node might have a valid IPv6 address, yet have a zero
* ORPort or DirPort.
*/
if (node->ri && tor_addr_is_valid(&node->ri->ipv6_addr, 0))
return 1;
if (node->rs && tor_addr_is_valid(&node->rs->ipv6_addr, 0))
return 1;
if (node->md && tor_addr_is_valid(&node->md->ipv6_addr, 0))
return 1;

return 0;
}

/* Does this node have a valid IPv6 ORPort? */
int
node_has_ipv6_orport(const node_t *node)
@@ -1425,15 +1405,6 @@ node_has_ipv6_orport(const node_t *node)
return tor_addr_port_is_valid_ap(&ipv6_orport, 0);
}

/* Does this node have a valid IPv6 DirPort? */
int
node_has_ipv6_dirport(const node_t *node)
{
tor_addr_port_t ipv6_dirport;
node_get_pref_ipv6_dirport(node, &ipv6_dirport);
return tor_addr_port_is_valid_ap(&ipv6_dirport, 0);
}

/** Return 1 if we prefer the IPv6 address and OR TCP port of
* <b>node</b>, else 0.
*
@@ -1542,38 +1513,6 @@ node_get_pref_ipv6_orport(const node_t *node, tor_addr_port_t *ap_out)
}
}

/** Return 1 if we prefer the IPv6 address and Dir TCP port of
* <b>node</b>, else 0.
*
* We prefer the IPv6 address if the router has an IPv6 address,
* and we can use IPv6 addresses, and:
* i) the router has no IPv4 Dir address.
* or
* ii) our preference is for IPv6 Dir addresses.
*
* If there is no node, use fascist_firewall_prefer_ipv6_dirport().
*/
int
node_ipv6_dir_preferred(const node_t *node)
{
const or_options_t *options = get_options();
tor_addr_port_t ipv4_addr;
node_assert_ok(node);

/* node->ipv6_preferred is set from fascist_firewall_prefer_ipv6_orport(),
* so we can't use it to determine DirPort IPv6 preference.
* This means that bridge clients will use IPv4 DirPorts by default.
*/
node_get_prim_dirport(node, &ipv4_addr);
if (!fascist_firewall_use_ipv6(options)) {
return 0;
} else if (!tor_addr_port_is_valid_ap(&ipv4_addr, 0)
|| fascist_firewall_prefer_ipv6_dirport(get_options())) {
return node_has_ipv6_dirport(node);
}
return 0;
}

/** Copy the primary (IPv4) Dir port (IP address and TCP port) for <b>node</b>
* into *<b>ap_out</b>. */
void
@@ -1592,50 +1531,6 @@ node_get_prim_dirport(const node_t *node, tor_addr_port_t *ap_out)

#undef RETURN_IPV4_AP

/** Copy the preferred Dir port (IP address and TCP port) for
* <b>node</b> into *<b>ap_out</b>. */
void
node_get_pref_dirport(const node_t *node, tor_addr_port_t *ap_out)
{
tor_assert(ap_out);

if (node_ipv6_dir_preferred(node)) {
node_get_pref_ipv6_dirport(node, ap_out);
} else {
/* the primary DirPort is always on IPv4 */
node_get_prim_dirport(node, ap_out);
}
}

/** Copy the preferred IPv6 Dir port (IP address and TCP port) for
* <b>node</b> into *<b>ap_out</b>. */
void
node_get_pref_ipv6_dirport(const node_t *node, tor_addr_port_t *ap_out)
{
node_assert_ok(node);
tor_assert(ap_out);

/* Check ri first, because rewrite_node_address_for_bridge() updates
* node->ri with the configured bridge address.
* Prefer rs over md for consistency with the fascist_firewall_* functions.
* Check if the address or port are valid, and try another alternative
* if they are not. */

/* Assume IPv4 and IPv6 dirports are the same */
if (node->ri && tor_addr_port_is_valid(&node->ri->ipv6_addr,
node->ri->dir_port, 0)) {
tor_addr_copy(&ap_out->addr, &node->ri->ipv6_addr);
ap_out->port = node->ri->dir_port;
} else if (node->rs && tor_addr_port_is_valid(&node->rs->ipv6_addr,
node->rs->dir_port, 0)) {
tor_addr_copy(&ap_out->addr, &node->rs->ipv6_addr);
ap_out->port = node->rs->dir_port;
} else {
tor_addr_make_null(&ap_out->addr, AF_INET6);
ap_out->port = 0;
}
}

/** Return true iff <b>md</b> has a curve25519 onion key.
* Use node_has_curve25519_onion_key() instead of calling this directly. */
static int
@@ -71,19 +71,12 @@ int node_supports_ed25519_hs_intro(const node_t *node);
int node_supports_v3_rendezvous_point(const node_t *node);
const uint8_t *node_get_rsa_id_digest(const node_t *node);

int node_has_ipv6_addr(const node_t *node);
int node_has_ipv6_orport(const node_t *node);
int node_has_ipv6_dirport(const node_t *node);
/* Deprecated - use node_ipv6_or_preferred or node_ipv6_dir_preferred */
#define node_ipv6_preferred(node) node_ipv6_or_preferred(node)
int node_ipv6_or_preferred(const node_t *node);
void node_get_prim_orport(const node_t *node, tor_addr_port_t *ap_out);
void node_get_pref_orport(const node_t *node, tor_addr_port_t *ap_out);
void node_get_pref_ipv6_orport(const node_t *node, tor_addr_port_t *ap_out);
int node_ipv6_dir_preferred(const node_t *node);
void node_get_prim_dirport(const node_t *node, tor_addr_port_t *ap_out);
void node_get_pref_dirport(const node_t *node, tor_addr_port_t *ap_out);
void node_get_pref_ipv6_dirport(const node_t *node, tor_addr_port_t *ap_out);
int node_has_curve25519_onion_key(const node_t *node);
const curve25519_public_key_t *node_get_curve25519_onion_key(
const node_t *node);
@@ -4289,12 +4289,6 @@ typedef struct {
* prefer IPv4. Use node_ipv6_or_preferred() instead of accessing this value
* directly. */
int ClientPreferIPv6ORPort;
/** If true, prefer an IPv6 directory port over an IPv4 one for direct
* directory connections. If auto, bridge clients prefer IPv6, and other
* clients prefer IPv4. Use fascist_firewall_prefer_ipv6_dirport() instead of
* accessing this value directly. */
int ClientPreferIPv6DirPort;

/** The length of time that we think a consensus should be fresh. */
int V3AuthVotingInterval;
/** The length of time we think it will take to distribute votes. */

No commit comments for this range