summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-06-15 15:31:34 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-06-23 09:25:36 -0400
commitd08d7e1535fe7b47319e67ca31d4b8f64fdea465 (patch)
tree011959444dbfd2b2a5360c107d1fc886cacfb8d0 /src/app
parent6da8c0b4fa9243158c860035c27d2d9bba17a832 (diff)
downloadtor-d08d7e1535fe7b47319e67ca31d4b8f64fdea465.tar.gz
tor-d08d7e1535fe7b47319e67ca31d4b8f64fdea465.zip
addr: Rename last_resolved_addr to be v4 specific
Part of #33233 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/resolve_addr.c28
-rw-r--r--src/app/config/resolve_addr.h4
2 files changed, 16 insertions, 16 deletions
diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c
index fe375848d7..6b66a71009 100644
--- a/src/app/config/resolve_addr.c
+++ b/src/app/config/resolve_addr.c
@@ -20,20 +20,20 @@
#include "lib/net/resolve.h"
/** Last value actually set by resolve_my_address. */
-static uint32_t last_resolved_addr = 0;
+static uint32_t last_resolved_addr_v4 = 0;
-/** Accessor for last_resolved_addr from outside this file. */
+/** Accessor for last_resolved_addr_v4 from outside this file. */
uint32_t
-get_last_resolved_addr(void)
+get_last_resolved_addr_v4(void)
{
- return last_resolved_addr;
+ return last_resolved_addr_v4;
}
-/** Reset last_resolved_addr from outside this file. */
+/** Reset last_resolved_addr_v4 from outside this file. */
void
-reset_last_resolved_addr(void)
+reset_last_resolved_addr_v4(void)
{
- last_resolved_addr = 0;
+ last_resolved_addr_v4 = 0;
}
/**
@@ -257,7 +257,7 @@ resolve_my_address_v4(int warn_severity, const or_options_t *options,
* us up-to-date.
*/
- if (last_resolved_addr && last_resolved_addr != *addr_out) {
+ if (last_resolved_addr_v4 && last_resolved_addr_v4 != *addr_out) {
/* Leave this as a notice, regardless of the requested severity,
* at least until dynamic IP address support becomes bulletproof. */
log_notice(LD_NET,
@@ -269,14 +269,14 @@ resolve_my_address_v4(int warn_severity, const or_options_t *options,
ip_address_changed(0);
}
- if (last_resolved_addr != *addr_out) {
+ if (last_resolved_addr_v4 != *addr_out) {
control_event_server_status(LOG_NOTICE,
"EXTERNAL_ADDRESS ADDRESS=%s METHOD=%s%s%s",
addr_string, method_used,
hostname_used ? " HOSTNAME=" : "",
hostname_used ? hostname_used : "");
}
- last_resolved_addr = *addr_out;
+ last_resolved_addr_v4 = *addr_out;
/*
* And finally, clean up and return success.
@@ -303,11 +303,11 @@ is_local_addr, (const tor_addr_t *addr))
/* It's possible that this next check will hit before the first time
* resolve_my_address actually succeeds. (For clients, it is likely that
* resolve_my_address will never be called at all). In those cases,
- * last_resolved_addr will be 0, and so checking to see whether ip is on
- * the same /24 as last_resolved_addr will be the same as checking whether
- * it was on net 0, which is already done by tor_addr_is_internal.
+ * last_resolved_addr_v4 will be 0, and so checking to see whether ip is
+ * on the same /24 as last_resolved_addr_v4 will be the same as checking
+ * whether it was on net 0, which is already done by tor_addr_is_internal.
*/
- if ((last_resolved_addr & (uint32_t)0xffffff00ul)
+ if ((last_resolved_addr_v4 & (uint32_t)0xffffff00ul)
== (ip & (uint32_t)0xffffff00ul))
return 1;
}
diff --git a/src/app/config/resolve_addr.h b/src/app/config/resolve_addr.h
index 2c8143df5b..6c94fe06ba 100644
--- a/src/app/config/resolve_addr.h
+++ b/src/app/config/resolve_addr.h
@@ -15,8 +15,8 @@ int resolve_my_address_v4(int warn_severity, const or_options_t *options,
uint32_t *addr_out,
const char **method_out, char **hostname_out);
-uint32_t get_last_resolved_addr(void);
-void reset_last_resolved_addr(void);
+uint32_t get_last_resolved_addr_v4(void);
+void reset_last_resolved_addr_v4(void);
MOCK_DECL(int, is_local_addr, (const tor_addr_t *addr));