From 15860c8846a8ebbdecd51e920f983afc49c30c8f Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 13 Jul 2020 14:07:37 -0400 Subject: addr: Use tor_addr_t instead of uint32_t for IPv4 This changes a LOT of code but in the end, behavior is the same. Unfortunately, many functions had to be changed to accomodate but in majority of cases, to become simpler. Functions are also removed specifically those that were there to convert an IPv4 as a host format to a tor_addr_t. Those are not needed anymore. The IPv4 address field has been standardized to "ipv4_addr", the ORPort to "ipv4_orport" (currently IPv6 uses ipv6_orport) and DirPort to "ipv4_dirport". This is related to Sponsor 55 work that adds IPv6 support for relays and this work is needed in order to have a common interface between IPv4 and IPv6. Closes #40043. Signed-off-by: David Goulet --- src/feature/relay/selftest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/feature/relay/selftest.c') diff --git a/src/feature/relay/selftest.c b/src/feature/relay/selftest.c index 77c04abdd7..d24748b297 100644 --- a/src/feature/relay/selftest.c +++ b/src/feature/relay/selftest.c @@ -284,8 +284,8 @@ static void router_do_dirport_reachability_checks(const routerinfo_t *me) { tor_addr_port_t my_dirport; - tor_addr_from_ipv4h(&my_dirport.addr, me->addr); - my_dirport.port = me->dir_port; + tor_addr_copy(&my_dirport.addr, &me->ipv4_addr); + my_dirport.port = me->ipv4_dirport; /* If there is already a pending connection, don't open another one. */ if (!connection_get_by_type_addr_port_purpose( @@ -443,7 +443,7 @@ router_dirport_found_reachable(void) const or_options_t *options = get_options(); if (!can_reach_dir_port && me) { - char *address = tor_dup_ip(me->addr); + char *address = tor_addr_to_str_dup(&me->ipv4_addr); if (!address) return; @@ -454,7 +454,7 @@ router_dirport_found_reachable(void) ready_to_publish(options) ? " Publishing server descriptor." : ""); - if (router_should_advertise_dirport(options, me->dir_port)) { + if (router_should_advertise_dirport(options, me->ipv4_dirport)) { mark_my_descriptor_dirty("DirPort found reachable"); /* This is a significant enough change to upload immediately, * at least in a test network */ @@ -464,7 +464,7 @@ router_dirport_found_reachable(void) } control_event_server_status(LOG_NOTICE, "REACHABILITY_SUCCEEDED DIRADDRESS=%s:%d", - address, me->dir_port); + address, me->ipv4_dirport); tor_free(address); } } -- cgit v1.2.3-54-g00ecf