commit 49d7feb8a0ecf7e3bc54c5cd7e0d2a96decdf08e
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Thu Oct 13 09:17:41 2016 -0400
Tweak patch for 18529.
- function doesn't need to be inline.
- rename function
- Make documentation more pedantically correct
- Remove needless "? 1 : 0."
---
src/or/config.c | 10 +++++++++-
src/or/config.h | 10 +---------
src/or/router.c | 2 +-
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/or/config.c b/src/or/config.c
index bef81ab..166f232 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2312,6 +2312,14 @@ reset_last_resolved_addr(void)
last_resolved_addr = 0;
}
+/* Return true if <b>options</b> is using the default authorities, and false
+ * if any authority-related option has been overridden. */
+int
+using_default_dir_authorities(const or_options_t *options)
+{
+ return (!options->DirAuthorities && !options->AlternateDirAuthority);
+}
+
/**
* Attempt getting our non-local (as judged by tor_addr_is_internal()
* function) IP address using following techniques, listed in
@@ -2471,7 +2479,7 @@ resolve_my_address(int warn_severity, const or_options_t *options,
addr_string = tor_dup_ip(addr);
if (tor_addr_is_internal(&myaddr, 0)) {
/* make sure we're ok with publishing an internal IP */
- if (is_default_dir_authorities(options)) {
+ if (using_default_dir_authorities(options)) {
/* if they are using the default authorities, disallow internal IPs
* always. */
log_fn(warn_severity, LD_CONFIG,
diff --git a/src/or/config.h b/src/or/config.h
index 1b40efc..8942932 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -76,7 +76,7 @@ MOCK_DECL(char *,
#define get_datadir_fname_suffix(sub1, suffix) \
get_datadir_fname2_suffix((sub1), NULL, (suffix))
-inline int is_default_dir_authorities(const or_options_t *options);
+int using_default_dir_authorities(const or_options_t *options);
int check_or_create_data_subdir(const char *subdir);
int write_to_data_subdir(const char* subdir, const char* fname,
@@ -149,14 +149,6 @@ smartlist_t *get_options_from_transport_options_line(const char *line,
const char *transport);
smartlist_t *get_options_for_server_transport(const char *transport);
-/* Check if we are using default authorities */
-inline int
-is_default_dir_authorities(const or_options_t *options)
-{
- return (!options->DirAuthorities &&
- !options->AlternateDirAuthority) ? 1 : 0;
-}
-
#ifdef CONFIG_PRIVATE
#define CL_PORT_NO_STREAM_OPTIONS (1u<<0)
diff --git a/src/or/router.c b/src/or/router.c
index 287bc16..1ac8351 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2093,7 +2093,7 @@ router_build_fresh_descriptor(routerinfo_t **r, extrainfo_t **e)
tor_addr_family(&p->addr) == AF_INET6) {
/* Like IPv4, if the relay is configured using the default
* authorities, disallow internal IPs. Otherwise, allow them. */
- const int default_auth = is_default_dir_authorities(options);
+ const int default_auth = using_default_dir_authorities(options);
if (! tor_addr_is_internal(&p->addr, 0) || ! default_auth) {
ipv6_orport = p;
break;