]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Send back CONNECTION_REFUSED on reentry
authorDavid Goulet <dgoulet@torproject.org>
Mon, 1 Feb 2021 17:45:32 +0000 (12:45 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Wed, 3 Feb 2021 13:52:48 +0000 (08:52 -0500)
The TORPROTOCOL reason causes the client to close the circuit which is not
what we want because other valid streams might be on it.

Instead, CONNECTION_REFUSED will leave it open but will not allow more streams
to be attached to it. The client then open a new circuit to the destination.

Closes #40270

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/core/or/connection_edge.c

index b40fa3e567d1ae338b1fa3cbf8914b116348f331..895e73ac1be691b8deaf6ad190602b94356be452 100644 (file)
@@ -4066,7 +4066,7 @@ connection_exit_connect(edge_connection_t *edge_conn)
     log_info(LD_EXIT, "%s:%d tried to connect back to a known relay address. "
                       "Closing.", escaped_safe_str_client(conn->address),
              conn->port);
-    connection_edge_end(edge_conn, END_STREAM_REASON_TORPROTOCOL);
+    connection_edge_end(edge_conn, END_STREAM_REASON_CONNECTREFUSED);
     circuit_detach_stream(circuit_get_by_edge_conn(edge_conn), edge_conn);
     connection_free(conn);
     return;