diff options
author | David Goulet <dgoulet@torproject.org> | 2020-10-20 11:10:48 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-10-27 10:43:42 -0400 |
commit | 695957511b95d5b6cbe4a13d30b591aed572c9e5 (patch) | |
tree | de400416d83bfb1dcedc23ca45a428461f203dab | |
parent | 50f44afeb4e2222518b64f022ca74f3fa31f8819 (diff) | |
download | tor-695957511b95d5b6cbe4a13d30b591aed572c9e5.tar.gz tor-695957511b95d5b6cbe4a13d30b591aed572c9e5.zip |
hs: Always note the virtual port in the ident
Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r-- | src/feature/hs/hs_common.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c index cbcb672140..24d34144e4 100644 --- a/src/feature/hs/hs_common.c +++ b/src/feature/hs/hs_common.c @@ -887,12 +887,14 @@ hs_set_conn_addr_port(const smartlist_t *ports, edge_connection_t *conn) chosen_port = smartlist_choose(matching_ports); smartlist_free(matching_ports); if (chosen_port) { - if (!(chosen_port->is_unix_addr)) { - /* save the original destination before we overwrite it */ - if (conn->hs_ident) { - conn->hs_ident->orig_virtual_port = TO_CONN(conn)->port; - } + /* Remember, v2 doesn't use an hs_ident. */ + if (conn->hs_ident) { + /* There is always a connection identifier at this point. Regardless of a + * Unix or TCP port, note the virtual port. */ + conn->hs_ident->orig_virtual_port = chosen_port->virtual_port; + } + if (!(chosen_port->is_unix_addr)) { /* Get a non-AF_UNIX connection ready for connection_exit_connect() */ tor_addr_copy(&TO_CONN(conn)->addr, &chosen_port->real_addr); TO_CONN(conn)->port = chosen_port->real_port; |