tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit f57ce632fe3d391e62d288c0b8acd0001bf670df
parent 78bc52c47c8d7c3747ea3335b571fd98a15a47b1
Author: David Goulet <dgoulet@torproject.org>
Date:   Mon,  6 Jul 2020 09:40:03 -0400

addr: Rename and make resolved_addr_set_last() function public

Rename the static function update_resolved_cache() to resolved_addr_set_last()
and make it public.

We are about to use it in order to record any suggested address from a NETINFO
cell.

Related to #40022

Signed-off-by: David Goulet <dgoulet@torproject.org>

Diffstat:
Msrc/app/config/resolve_addr.c | 10+++++-----
Msrc/app/config/resolve_addr.h | 2++
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c @@ -370,7 +370,7 @@ get_address_from_interface(const or_options_t *options, int warn_severity, return FN_RET_OK; } -/** @brief Update the last resolved address cache using the given address. +/** @brief Set the last resolved address cache using the given address. * * A log notice is emitted if the given address has changed from before. Not * emitted on first resolve. @@ -386,9 +386,9 @@ get_address_from_interface(const or_options_t *options, int warn_severity, * @param hostname_used Which hostname was used. If none were used, it is * NULL. (for logging and control port). */ -static void -update_resolved_cache(const tor_addr_t *addr, const char *method_used, - const char *hostname_used) +void +resolved_addr_set_last(const tor_addr_t *addr, const char *method_used, + const char *hostname_used) { /** Have we done a first resolve. This is used to control logging. */ static bool have_resolved_once[IDX_SIZE] = { false, false, false }; @@ -561,7 +561,7 @@ find_my_address(const or_options_t *options, int family, int warn_severity, /* * Step 2: Update last resolved address cache and inform the control port. */ - update_resolved_cache(&my_addr, method_used, hostname_used); + resolved_addr_set_last(&my_addr, method_used, hostname_used); if (method_out) { *method_out = method_used; diff --git a/src/app/config/resolve_addr.h b/src/app/config/resolve_addr.h @@ -17,6 +17,8 @@ bool find_my_address(const or_options_t *options, int family, void resolved_addr_get_last(int family, tor_addr_t *addr_out); void resolved_addr_reset_last(int family); +void resolved_addr_set_last(const tor_addr_t *addr, const char *method_used, + const char *hostname_used); MOCK_DECL(bool, is_local_to_resolve_addr, (const tor_addr_t *addr));