summaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_common.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2018-07-31 14:30:17 +1000
committerteor <teor@torproject.org>2019-01-31 07:53:22 +0100
commit6170d3fcf12f4345ec13561d0f444930f2f12e84 (patch)
treece72649a5d7762b437309355104b020ff9f3f705 /src/feature/hs/hs_common.c
parentcdda3dc48457af31a9d1b3df1222d449b736f3b1 (diff)
downloadtor-6170d3fcf12f4345ec13561d0f444930f2f12e84.tar.gz
tor-6170d3fcf12f4345ec13561d0f444930f2f12e84.zip
hs: Onion services put IPv6 addresses in service descriptors
Rewrite service_intro_point_new() to take a node_t. Since node_get_link_specifier_smartlist() supports IPv6 link specifiers, this refactor adds IPv6 addresses to onion service descriptors. Part of 23576, implements 26992.
Diffstat (limited to 'src/feature/hs/hs_common.c')
-rw-r--r--src/feature/hs/hs_common.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c
index ebe49f09a5..5d8f54230f 100644
--- a/src/feature/hs/hs_common.c
+++ b/src/feature/hs/hs_common.c
@@ -1697,6 +1697,12 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
tor_assert(lspecs);
+ if (smartlist_len(lspecs) == 0) {
+ log_fn(LOG_PROTOCOL_WARN, LD_REND, "Empty link specifier list.");
+ /* Return NULL. */
+ goto done;
+ }
+
SMARTLIST_FOREACH_BEGIN(lspecs, const link_specifier_t *, ls) {
switch (link_specifier_get_ls_type(ls)) {
case LS_IPV4:
@@ -1730,6 +1736,12 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
/* Legacy ID is mandatory, and we require IPv4. */
if (!have_v4 || !have_legacy_id) {
+ bool both = !have_v4 && !have_legacy_id;
+ log_fn(LOG_PROTOCOL_WARN, LD_REND, "Missing %s%s%s link specifier%s.",
+ !have_v4 ? "IPv4" : "",
+ both ? " and " : "",
+ !have_legacy_id ? "legacy ID" : "",
+ both ? "s" : "");
goto done;
}
@@ -1748,6 +1760,10 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
* release. */
} else {
/* If we can't reach IPv4, return NULL. */
+ log_fn(LOG_PROTOCOL_WARN, LD_REND,
+ "Received an IPv4 link specifier, "
+ "but the address is not reachable: %s:%u",
+ fmt_addr(&addr_v4), port_v4);
goto done;
}
@@ -1755,7 +1771,7 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
validate:
/* We'll validate now that the address we've picked isn't a private one. If
- * it is, are we allowing to extend to private address? */
+ * it is, are we allowed to extend to private addresses? */
if (!extend_info_addr_is_allowed(&addr_v4)) {
log_fn(LOG_PROTOCOL_WARN, LD_REND,
"Requested address is private and we are not allowed to extend to "