Przeglądaj źródła

config: Remove AllowSingleHopCircuits option

Deprecated in 0.2.9.2-alpha, this commits changes it as OBSOLETE() and cleans
up the code associated with it.

Partially fixes #22060

Signed-off-by: David Goulet <dgoulet@torproject.org>
David Goulet 7 lat temu
rodzic
commit
fea72571df
5 zmienionych plików z 6 dodań i 29 usunięć
  1. 2 0
      changes/bug22060
  2. 0 5
      doc/tor.1.txt
  3. 1 3
      src/or/config.c
  4. 3 18
      src/or/control.c
  5. 0 3
      src/or/or.h

+ 2 - 0
changes/bug22060

@@ -1,3 +1,5 @@
   o Remove configuration option (confic):
   o Remove configuration option (confic):
     - AllowInvalidNodes was deprecated in 0.2.9.2-alpha and now has been
     - AllowInvalidNodes was deprecated in 0.2.9.2-alpha and now has been
       rendered obsolete. Code has been removed and feature no longer exists.
       rendered obsolete. Code has been removed and feature no longer exists.
+    - AllowSingleHopCircuits was deprecated in 0.2.9.2-alpha and now has been
+      rendered obsolete. Code has been removed and feature no longer exists.

+ 0 - 5
doc/tor.1.txt

@@ -1468,11 +1468,6 @@ The following options are useful only for clients (that is, if
     Like WarnPlaintextPorts, but instead of warning about risky port uses, Tor
     Like WarnPlaintextPorts, but instead of warning about risky port uses, Tor
     will instead refuse to make the connection. (Default: None)
     will instead refuse to make the connection. (Default: None)
 
 
-[[AllowSingleHopCircuits]] **AllowSingleHopCircuits** **0**|**1**::
-    When this option is set, the attached Tor controller can use relays
-    that have the **AllowSingleHopExits** option turned on to build
-    one-hop Tor connections.  (Default: 0)
-
 [[OptimisticData]] **OptimisticData** **0**|**1**|**auto**::
 [[OptimisticData]] **OptimisticData** **0**|**1**|**auto**::
     When this option is set, and Tor is using an exit node that supports
     When this option is set, and Tor is using an exit node that supports
     the feature, it will try optimistically to send data to the exit node
     the feature, it will try optimistically to send data to the exit node

+ 1 - 3
src/or/config.c

@@ -207,7 +207,7 @@ static config_var_t option_vars_[] = {
   V(AllowDotExit,                BOOL,     "0"),
   V(AllowDotExit,                BOOL,     "0"),
   OBSOLETE("AllowInvalidNodes"),
   OBSOLETE("AllowInvalidNodes"),
   V(AllowNonRFC953Hostnames,     BOOL,     "0"),
   V(AllowNonRFC953Hostnames,     BOOL,     "0"),
-  V(AllowSingleHopCircuits,      BOOL,     "0"),
+  OBSOLETE("AllowSingleHopCircuits"),
   V(AllowSingleHopExits,         BOOL,     "0"),
   V(AllowSingleHopExits,         BOOL,     "0"),
   V(AlternateBridgeAuthority,    LINELIST, NULL),
   V(AlternateBridgeAuthority,    LINELIST, NULL),
   V(AlternateDirAuthority,       LINELIST, NULL),
   V(AlternateDirAuthority,       LINELIST, NULL),
@@ -662,8 +662,6 @@ static const config_deprecation_t option_deprecation_notes_[] = {
   /* Deprecated since 0.2.9.2-alpha... */
   /* Deprecated since 0.2.9.2-alpha... */
   { "AllowDotExit", "Unrestricted use of the .exit notation can be used for "
   { "AllowDotExit", "Unrestricted use of the .exit notation can be used for "
     "a wide variety of application-level attacks." },
     "a wide variety of application-level attacks." },
-  { "AllowSingleHopCircuits", "Almost no relays actually allow single-hop "
-    "exits, making this option pointless." },
   { "AllowSingleHopExits", "Turning this on will make your relay easier "
   { "AllowSingleHopExits", "Turning this on will make your relay easier "
     "to abuse." },
     "to abuse." },
   { "ClientDNSRejectInternalAddresses", "Turning this on makes your client "
   { "ClientDNSRejectInternalAddresses", "Turning this on makes your client "

+ 3 - 18
src/or/control.c

@@ -3551,24 +3551,9 @@ handle_control_attachstream(control_connection_t *conn, uint32_t len,
   }
   }
   /* Is this a single hop circuit? */
   /* Is this a single hop circuit? */
   if (circ && (circuit_get_cpath_len(circ)<2 || hop==1)) {
   if (circ && (circuit_get_cpath_len(circ)<2 || hop==1)) {
-    const node_t *node = NULL;
-    char *exit_digest = NULL;
-    if (circ->build_state &&
-        circ->build_state->chosen_exit &&
-        !tor_digest_is_zero(circ->build_state->chosen_exit->identity_digest)) {
-      exit_digest = circ->build_state->chosen_exit->identity_digest;
-      node = node_get_by_id(exit_digest);
-    }
-    /* Do both the client and relay allow one-hop exit circuits? */
-    if (!node ||
-        !node_allows_single_hop_exits(node) ||
-        !get_options()->AllowSingleHopCircuits) {
-      connection_write_str_to_buf(
-      "551 Can't attach stream to this one-hop circuit.\r\n", conn);
-      return 0;
-    }
-    tor_assert(exit_digest);
-    ap_conn->chosen_exit_name = tor_strdup(hex_str(exit_digest, DIGEST_LEN));
+    connection_write_str_to_buf(
+               "551 Can't attach stream to this one-hop circuit.\r\n", conn);
+    return 0;
   }
   }
 
 
   if (circ && hop>0) {
   if (circ && hop>0) {

+ 0 - 3
src/or/or.h

@@ -4120,9 +4120,6 @@ typedef struct {
   /** If true, don't allow relays with AllowSingleHopExits=1 to be used in
   /** If true, don't allow relays with AllowSingleHopExits=1 to be used in
    * circuits that we build. */
    * circuits that we build. */
   int ExcludeSingleHopRelays;
   int ExcludeSingleHopRelays;
-  /** If true, and the controller tells us to use a one-hop circuit, and the
-   * exit allows it, we use it. */
-  int AllowSingleHopCircuits;
 
 
   /** If true, we convert "www.google.com.foo.exit" addresses on the
   /** If true, we convert "www.google.com.foo.exit" addresses on the
    * socks/trans/natd ports into "www.google.com" addresses that
    * socks/trans/natd ports into "www.google.com" addresses that