From 976a79094bedfffd7adc1ec9537e4060da877cf8 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 16 Jun 2021 15:15:55 +0930 Subject: [PATCH] connectd: fix advertizing for Tor ports. We were accidentally using the port that the tor service was connecting to, not the /torport the user said to use. Fixes: #4597 Reported-by: @openoms Signed-off-by: Rusty Russell Changelog-Fixed: Config: `addr` autotor and statictor /torport arguments now advertized correctly. --- common/wireaddr.h | 3 +++ connectd/tor_autoservice.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/wireaddr.h b/common/wireaddr.h index f45c2cc76..c24e87b74 100644 --- a/common/wireaddr.h +++ b/common/wireaddr.h @@ -125,8 +125,11 @@ struct wireaddr_internal { /* ADDR_INTERNAL_AUTOTOR * ADDR_INTERNAL_STATICTOR */ struct torservice { + /* Where to connect to Tor proxy */ struct wireaddr address; + /* Tor port to use */ u16 port; + /* Blob to use to create tor service */ u8 blob[TOR_V3_BLOBLEN + 1]; } torservice; /* ADDR_INTERNAL_FORPROXY */ diff --git a/connectd/tor_autoservice.c b/connectd/tor_autoservice.c index 0b2e84343..65cb50f22 100644 --- a/connectd/tor_autoservice.c +++ b/connectd/tor_autoservice.c @@ -183,7 +183,7 @@ static struct wireaddr *make_fixed_onion(const tal_t *ctx, name = tal_fmt(tmpctx, "%s.onion", line); onion = tal(ctx, struct wireaddr); - if (!parse_wireaddr(name, onion, local->port, false, NULL)) + if (!parse_wireaddr(name, onion, port, false, NULL)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Tor gave bad onion name '%s'", name); #ifdef SUPERVERBOSE