aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirclient
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-07-17 10:34:30 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-07-20 14:54:13 -0400
commit433a1949e87190f1732ea426ed359c93f28cb578 (patch)
treecb61eaecc95424ead97b82bd30396deb8a9db1e5 /src/feature/dirclient
parent0b89eba7d55839c4b746bbe5efd8fe1531592bf7 (diff)
downloadtor-433a1949e87190f1732ea426ed359c93f28cb578.tar.gz
tor-433a1949e87190f1732ea426ed359c93f28cb578.zip
relay: Handle dir address suggestion with new interface
We now use relay_address_new_suggestion() when a suggested address is received from a directory. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/dirclient')
-rw-r--r--src/feature/dirclient/dirclient.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c
index bc4162cf52..7a026d3c52 100644
--- a/src/feature/dirclient/dirclient.c
+++ b/src/feature/dirclient/dirclient.c
@@ -2106,7 +2106,13 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
if (conn->dirconn_direct) {
char *guess = http_get_header(headers, X_ADDRESS_HEADER);
if (guess) {
- router_new_address_suggestion(guess, conn);
+ tor_addr_t addr;
+ if (tor_addr_parse(&addr, guess) < 0) {
+ log_debug(LD_DIR, "Malformed X-Your-Address-Is header %s. Ignoring.",
+ escaped(guess));
+ } else {
+ relay_address_new_suggestion(&addr, &TO_CONN(conn)->addr, NULL);
+ }
tor_free(guess);
}
}