mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Merge remote-tracking branch 'ffmancera/github/bug24573'
This commit is contained in:
commit
7a60600411
7
changes/ticket24573
Normal file
7
changes/ticket24573
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
o Minor bugfixes (IPv6 preferences on bridges):
|
||||||
|
- Tor now always sets IPv6 preferences for bridges, even if there is only
|
||||||
|
router information or router status and warns about them. Fixes bug
|
||||||
|
24573; bugfix on c213f277cde in 0.2.8.2-alpha.
|
||||||
|
- Tor now sets IPv6 address in rs as well as it's set the one in ri. Closes
|
||||||
|
ticket 24572; bugfix on 9e9edf71f7d in 0.2.4.5-alpha.
|
||||||
|
Patch by "ffmancera".
|
@ -719,7 +719,6 @@ rewrite_node_address_for_bridge(const bridge_info_t *bridge, node_t *node)
|
|||||||
if (node->ri) {
|
if (node->ri) {
|
||||||
routerinfo_t *ri = node->ri;
|
routerinfo_t *ri = node->ri;
|
||||||
tor_addr_from_ipv4h(&addr, ri->addr);
|
tor_addr_from_ipv4h(&addr, ri->addr);
|
||||||
|
|
||||||
if ((!tor_addr_compare(&bridge->addr, &addr, CMP_EXACT) &&
|
if ((!tor_addr_compare(&bridge->addr, &addr, CMP_EXACT) &&
|
||||||
bridge->port == ri->or_port) ||
|
bridge->port == ri->or_port) ||
|
||||||
(!tor_addr_compare(&bridge->addr, &ri->ipv6_addr, CMP_EXACT) &&
|
(!tor_addr_compare(&bridge->addr, &ri->ipv6_addr, CMP_EXACT) &&
|
||||||
@ -777,16 +776,58 @@ rewrite_node_address_for_bridge(const bridge_info_t *bridge, node_t *node)
|
|||||||
routerstatus_t *rs = node->rs;
|
routerstatus_t *rs = node->rs;
|
||||||
tor_addr_from_ipv4h(&addr, rs->addr);
|
tor_addr_from_ipv4h(&addr, rs->addr);
|
||||||
|
|
||||||
if (!tor_addr_compare(&bridge->addr, &addr, CMP_EXACT) &&
|
if ((!tor_addr_compare(&bridge->addr, &addr, CMP_EXACT) &&
|
||||||
bridge->port == rs->or_port) {
|
bridge->port == rs->or_port) ||
|
||||||
|
(!tor_addr_compare(&bridge->addr, &rs->ipv6_addr, CMP_EXACT) &&
|
||||||
|
bridge->port == rs->ipv6_orport)) {
|
||||||
/* they match, so no need to do anything */
|
/* they match, so no need to do anything */
|
||||||
} else {
|
} else {
|
||||||
rs->addr = tor_addr_to_ipv4h(&bridge->addr);
|
if (tor_addr_family(&bridge->addr) == AF_INET) {
|
||||||
rs->or_port = bridge->port;
|
rs->addr = tor_addr_to_ipv4h(&bridge->addr);
|
||||||
log_info(LD_DIR,
|
rs->or_port = bridge->port;
|
||||||
"Adjusted bridge routerstatus for '%s' to match "
|
log_info(LD_DIR,
|
||||||
"configured address %s.",
|
"Adjusted bridge routerstatus for '%s' to match "
|
||||||
rs->nickname, fmt_addrport(&bridge->addr, rs->or_port));
|
"configured address %s.",
|
||||||
|
rs->nickname, fmt_addrport(&bridge->addr, rs->or_port));
|
||||||
|
/* set IPv6 preferences even if there is no ri */
|
||||||
|
} else if (tor_addr_family(&bridge->addr) == AF_INET6) {
|
||||||
|
tor_addr_copy(&rs->ipv6_addr, &bridge->addr);
|
||||||
|
rs->ipv6_orport = bridge->port;
|
||||||
|
log_info(LD_DIR,
|
||||||
|
"Adjusted bridge routerstatus for '%s' to match configured"
|
||||||
|
" address %s.",
|
||||||
|
rs->nickname, fmt_addrport(&rs->ipv6_addr, rs->ipv6_orport));
|
||||||
|
} else {
|
||||||
|
log_err(LD_BUG, "Address family not supported: %d.",
|
||||||
|
tor_addr_family(&bridge->addr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options->ClientPreferIPv6ORPort == -1) {
|
||||||
|
/* Mark which address to use based on which bridge_t we got. */
|
||||||
|
node->ipv6_preferred = (tor_addr_family(&bridge->addr) == AF_INET6 &&
|
||||||
|
!tor_addr_is_null(&node->rs->ipv6_addr));
|
||||||
|
} else {
|
||||||
|
/* Mark which address to use based on user preference */
|
||||||
|
node->ipv6_preferred = (fascist_firewall_prefer_ipv6_orport(options) &&
|
||||||
|
!tor_addr_is_null(&node->rs->ipv6_addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* XXXipv6 we lack support for falling back to another address for
|
||||||
|
the same relay, warn the user */
|
||||||
|
if (!tor_addr_is_null(&rs->ipv6_addr)) {
|
||||||
|
tor_addr_port_t ap;
|
||||||
|
node_get_pref_orport(node, &ap);
|
||||||
|
log_notice(LD_CONFIG,
|
||||||
|
"Bridge '%s' has both an IPv4 and an IPv6 address. "
|
||||||
|
"Will prefer using its %s address (%s) based on %s.",
|
||||||
|
rs->nickname,
|
||||||
|
node->ipv6_preferred ? "IPv6" : "IPv4",
|
||||||
|
fmt_addrport(&ap.addr, ap.port),
|
||||||
|
options->ClientPreferIPv6ORPort == -1 ?
|
||||||
|
"the configured Bridge address" :
|
||||||
|
"ClientPreferIPv6ORPort");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user