summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2018-09-14 21:37:36 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2018-09-15 16:52:36 +0300
commit8f085841ef40f00bbc2bb146a2d555aba527738f (patch)
tree96deb3c31c9559bf97230b53c0bd86229ecf6a16 /src/core
parente44e6a1857ff8ad39d3e298b512e8c8a1e513c99 (diff)
downloadtor-8f085841ef40f00bbc2bb146a2d555aba527738f.tar.gz
tor-8f085841ef40f00bbc2bb146a2d555aba527738f.zip
Encode the 32-bit Global Identifier as 2 x 16-bit in the IPv6 address.
Without this patch we would encode the IPv6 address' last part as ::ffffffff instead of ::ffff:ffff when the GID is UINT32_MAX. See: https://bugs.torproject.org/4700
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/connection_edge.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 891e922171..62d12f4986 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -623,8 +623,10 @@ export_hs_client_circuit_id_haproxy(const edge_connection_t *edge_conn,
}
/* Build the string */
- tor_asprintf(&buf, "PROXY TCP6 %s:%x %s %d %d\r\n",
- src_ipv6_prefix, gid, dst_ipv6, src_port, dst_port);
+ tor_asprintf(&buf, "PROXY TCP6 %s:%x:%x %s %d %d\r\n",
+ src_ipv6_prefix,
+ gid >> 16, gid & 0x0000ffff,
+ dst_ipv6, src_port, dst_port);
connection_buf_add(buf, strlen(buf), conn);