summaryrefslogtreecommitdiff
path: root/src/feature/hs
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2018-09-12 15:52:41 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2018-09-15 16:32:24 +0300
commit6069185bcc61fe797582b9b9826a5d52e4aabb22 (patch)
tree369b19c41c33df2d9c7bb25f8c69cf0f1d36f459 /src/feature/hs
parent5d34a8cbbb8ac4b6edd6800e10b5cb6dba1dcbcb (diff)
downloadtor-6069185bcc61fe797582b9b9826a5d52e4aabb22.tar.gz
tor-6069185bcc61fe797582b9b9826a5d52e4aabb22.zip
Save original virtual port in edge conn HS ident.
Diffstat (limited to 'src/feature/hs')
-rw-r--r--src/feature/hs/hs_common.c5
-rw-r--r--src/feature/hs/hs_ident.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c
index 12405a79cb..c36892e0f8 100644
--- a/src/feature/hs/hs_common.c
+++ b/src/feature/hs/hs_common.c
@@ -882,6 +882,11 @@ hs_set_conn_addr_port(const smartlist_t *ports, edge_connection_t *conn)
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;
+ }
+
/* 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;
diff --git a/src/feature/hs/hs_ident.h b/src/feature/hs/hs_ident.h
index 92d15b0523..ab87d16d17 100644
--- a/src/feature/hs/hs_ident.h
+++ b/src/feature/hs/hs_ident.h
@@ -111,6 +111,10 @@ typedef struct hs_ident_edge_conn_t {
* in the onion address. */
ed25519_public_key_t identity_pk;
+ /* The original virtual port that was used by the client to access the onion
+ * service, regardless of the internal port forwarding that might have
+ * happened on the service-side. */
+ uint16_t orig_virtual_port;
/* XXX: Client authorization. */
} hs_ident_edge_conn_t;