diff options
author | David Goulet <dgoulet@torproject.org> | 2020-06-23 11:19:50 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-06-24 13:51:37 -0400 |
commit | b76325190b3fb2d01fb0c9f0d2ffe76a284d1766 (patch) | |
tree | 783d711aa801a6124bc4acecf0feca9bc82cc5c1 /src/feature/relay/router.c | |
parent | 2f3b4e38888116f434297fb45ac093acd2d01e55 (diff) | |
download | tor-b76325190b3fb2d01fb0c9f0d2ffe76a284d1766.tar.gz tor-b76325190b3fb2d01fb0c9f0d2ffe76a284d1766.zip |
addr: Remove resolve_my_address_v4()
Replace it by find_my_address() everywhere. This changes many parts of the
code that uses it to use a tor_addr_t instead of a plain uint32_t for IPv4.
Many changes to the unit test to also use the new interface.
Part #33233
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/relay/router.c')
-rw-r--r-- | src/feature/relay/router.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 4d5ed3a3e1..fd62a3073a 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -2540,6 +2540,7 @@ void check_descriptor_ipaddress_changed(time_t now) { uint32_t prev, cur; + tor_addr_t addr; const or_options_t *options = get_options(); const char *method = NULL; char *hostname = NULL; @@ -2552,10 +2553,12 @@ check_descriptor_ipaddress_changed(time_t now) /* XXXX ipv6 */ prev = my_ri->addr; - if (resolve_my_address_v4(LOG_INFO, options, &cur, &method, &hostname) < 0) { + if (!find_my_address(options, AF_INET, LOG_INFO, &addr, &method, + &hostname)) { log_info(LD_CONFIG,"options->Address didn't resolve into an IP."); return; } + cur = tor_addr_to_ipv4h(&addr); if (prev != cur) { char *source; |