aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-07-14 13:02:21 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-07-20 14:54:13 -0400
commit75a2e7fcb7092790c81db91861f526208612fa2a (patch)
treedfbbde62e0fbd9ce627221f8a7d8990721d2eb16 /src/feature/control
parent1a347b4790719d6ae1576c0b023dac343b65e5a1 (diff)
downloadtor-75a2e7fcb7092790c81db91861f526208612fa2a.tar.gz
tor-75a2e7fcb7092790c81db91861f526208612fa2a.zip
control: GETINFO address/ use new find address API
At the moment, this command only returns the IPv4. Do so by using the new relay_find_addr_to_publish(). New commands to return IPv4 and IPv6 will be done with the work in tor#40039. Related to #40025 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/control')
-rw-r--r--src/feature/control/control_getinfo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/feature/control/control_getinfo.c b/src/feature/control/control_getinfo.c
index daf71f04c9..c489dfa865 100644
--- a/src/feature/control/control_getinfo.c
+++ b/src/feature/control/control_getinfo.c
@@ -132,12 +132,12 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
} else if (!strcmp(question, "features/names")) {
*answer = tor_strdup("VERBOSE_NAMES EXTENDED_EVENTS");
} else if (!strcmp(question, "address")) {
- uint32_t addr;
- if (router_pick_published_address(get_options(), &addr, 0) < 0) {
+ tor_addr_t addr;
+ if (!relay_find_addr_to_publish(get_options(), AF_INET, false, &addr)) {
*errmsg = "Address unknown";
return -1;
}
- *answer = tor_dup_ip(addr);
+ *answer = tor_addr_to_str_dup(&addr);
tor_assert_nonfatal(*answer);
} else if (!strcmp(question, "traffic/read")) {
tor_asprintf(answer, "%"PRIu64, (get_bytes_read()));