aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/relay_periodic.c32
-rw-r--r--src/feature/relay/router.c17
-rw-r--r--src/feature/relay/selftest.c10
3 files changed, 29 insertions, 30 deletions
diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c
index 0c056bdeb1..cc346bc3fc 100644
--- a/src/feature/relay/relay_periodic.c
+++ b/src/feature/relay/relay_periodic.c
@@ -208,14 +208,14 @@ reachability_warnings_callback(time_t now, const or_options_t *options)
if (me && !(v4_ok && v6_ok)) {
/* We need to warn that one or more of our ORPorts isn't reachable.
* Determine which, and give a reasonable warning. */
- char *address4 = tor_dup_ip(me->addr);
+ char *address4 = tor_addr_to_str_dup(&me->ipv4_addr);
char *address6 = tor_addr_to_str_dup(&me->ipv6_addr);
if (address4 || address6) {
char *where4=NULL, *where6=NULL;
if (!v4_ok)
- tor_asprintf(&where4, "%s:%d", address4, me->or_port);
+ tor_asprintf(&where4, "%s:%d", address4, me->ipv4_orport);
if (!v6_ok)
- tor_asprintf(&where6, "[%s]:%d", address6, me->or_port);
+ tor_asprintf(&where6, "[%s]:%d", address6, me->ipv6_orport);
const char *opt_and = (!v4_ok && !v6_ok) ? "and" : "";
log_warn(LD_CONFIG,
@@ -231,7 +231,7 @@ reachability_warnings_callback(time_t now, const or_options_t *options)
if (!v4_ok) {
control_event_server_status(LOG_WARN,
"REACHABILITY_FAILED ORADDRESS=%s:%d",
- address4, me->or_port);
+ address4, me->ipv4_orport);
}
if (!v6_ok) {
control_event_server_status(LOG_WARN,
@@ -244,19 +244,17 @@ reachability_warnings_callback(time_t now, const or_options_t *options)
}
if (me && !router_dirport_seems_reachable(options)) {
- char *address = tor_dup_ip(me->addr);
- if (address) {
- log_warn(LD_CONFIG,
- "Your server (%s:%d) has not managed to confirm that its "
- "DirPort is reachable. Relays do not publish descriptors "
- "until their ORPort and DirPort are reachable. Please check "
- "your firewalls, ports, address, /etc/hosts file, etc.",
- address, me->dir_port);
- control_event_server_status(LOG_WARN,
- "REACHABILITY_FAILED DIRADDRESS=%s:%d",
- address, me->dir_port);
- tor_free(address);
- }
+ char *address4 = tor_addr_to_str_dup(&me->ipv4_addr);
+ log_warn(LD_CONFIG,
+ "Your server (%s:%d) has not managed to confirm that its "
+ "DirPort is reachable. Relays do not publish descriptors "
+ "until their ORPort and DirPort are reachable. Please check "
+ "your firewalls, ports, address, /etc/hosts file, etc.",
+ address4, me->ipv4_dirport);
+ control_event_server_status(LOG_WARN,
+ "REACHABILITY_FAILED DIRADDRESS=%s:%d",
+ address4, me->ipv4_dirport);
+ tor_free(address4);
}
}
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index b63950ea13..4f4ba8559b 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2057,9 +2057,9 @@ router_build_fresh_unsigned_routerinfo,(routerinfo_t **ri_out))
ri = tor_malloc_zero(sizeof(routerinfo_t));
ri->cache_info.routerlist_index = -1;
ri->nickname = tor_strdup(options->Nickname);
- ri->addr = addr;
- ri->or_port = router_get_advertised_or_port(options);
- ri->dir_port = router_get_advertised_dir_port(options, 0);
+ tor_addr_from_ipv4h(&ri->ipv4_addr, addr);
+ ri->ipv4_orport = router_get_advertised_or_port(options);
+ ri->ipv4_dirport = router_get_advertised_dir_port(options, 0);
ri->supports_tunnelled_dir_requests =
directory_permits_begindir_requests(options);
ri->cache_info.published_on = time(NULL);
@@ -2105,7 +2105,8 @@ router_build_fresh_unsigned_routerinfo,(routerinfo_t **ri_out))
/* DNS is screwed up; don't claim to be an exit. */
policies_exit_policy_append_reject_star(&ri->exit_policy);
} else {
- policies_parse_exit_policy_from_options(options,ri->addr,&ri->ipv6_addr,
+ policies_parse_exit_policy_from_options(options, &ri->ipv4_addr,
+ &ri->ipv6_addr,
&ri->exit_policy);
}
ri->policy_is_reject_star =
@@ -2608,7 +2609,7 @@ check_descriptor_ipaddress_changed(time_t now)
return;
/* XXXX ipv6 */
- prev = my_ri->addr;
+ prev = tor_addr_to_ipv4h(&my_ri->ipv4_addr);
if (!find_my_address(options, AF_INET, LOG_INFO, &addr, &method,
&hostname)) {
log_info(LD_CONFIG,"options->Address didn't resolve into an IP.");
@@ -2857,7 +2858,7 @@ router_dump_router_to_string(routerinfo_t *router,
proto_line = tor_strdup("");
}
- address = tor_dup_ip(router->addr);
+ address = tor_addr_to_str_dup(&router->ipv4_addr);
if (!address)
goto err;
@@ -2881,8 +2882,8 @@ router_dump_router_to_string(routerinfo_t *router,
"%s%s%s",
router->nickname,
address,
- router->or_port,
- router_should_advertise_dirport(options, router->dir_port),
+ router->ipv4_orport,
+ router_should_advertise_dirport(options, router->ipv4_dirport),
ed_cert_line ? ed_cert_line : "",
extra_or_address ? extra_or_address : "",
router->platform,
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);
}
}