]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Have node_get_pref_orport() return an IPv6 OR port when UseBridges is set.
authorLinus Nordberg <linus@torproject.org>
Wed, 19 Sep 2012 15:15:40 +0000 (17:15 +0200)
committerLinus Nordberg <linus@torproject.org>
Wed, 19 Sep 2012 15:18:06 +0000 (17:18 +0200)
We used to never return an IPv6 address unless ClientUseIPv6 was
set. We should allow clients running with bridges use IPv6 OR ports
even without setting ClientUseIPv6. Configuring an IPv6 address in a
Bridge line should imply that.

Fixes th second part of #6757.

changes/6757 [new file with mode: 0644]
src/or/nodelist.c

diff --git a/changes/6757 b/changes/6757
new file mode 100644 (file)
index 0000000..6b17f95
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (client):
+    - Make clients running with IPv6 bridges connect over IPv6 again,
+      even without setting new config options ClientUseIPv6 and
+      ClientPreferIPv6ORPort.
+      Fixes bug 6757; bugfix on 0.2.4.1-alpha.
index c357bc04741f21371097adff52da01518caad737..421db8edc0ee9da1a1baff471712f923e1eda0ee 100644 (file)
@@ -873,18 +873,23 @@ 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)
 {
+  const or_options_t *options = get_options();
   tor_assert(ap_out);
 
   /* Cheap implementation of config option ClientUseIPv6 -- simply
-     don't prefer IPv6 when ClientUseIPv6 is not set. (See #4455 for
-     more on this subject.) Note that this filter is too strict since
-     we're hindering not only clients! Erring on the safe side
-     shouldn't be a problem though. XXX move this check to where
-     outgoing connections are made? -LN */
-  if (get_options()->ClientUseIPv6 == 1 && node_ipv6_preferred(node))
+     don't prefer IPv6 when ClientUseIPv6 is not set and we're not a
+     client running with bridges. See #4455 for more on this subject.
+
+     Note that this filter is too strict since we're hindering not
+     only clients! Erring on the safe side shouldn't be a problem
+     though. XXX move this check to where outgoing connections are
+     made? -LN */
+  if ((options->ClientUseIPv6 || options->UseBridges) &&
+      node_ipv6_preferred(node)) {
     node_get_pref_ipv6_orport(node, ap_out);
-  else
+  } else {
     node_get_prim_orport(node, ap_out);
+  }
 }
 
 /** Copy the preferred IPv6 OR port (IP address and TCP port) for