diff options
Diffstat (limited to 'src/app/config')
-rw-r--r-- | src/app/config/config.c | 1 | ||||
-rw-r--r-- | src/app/config/or_options_st.h | 4 | ||||
-rw-r--r-- | src/app/config/resolve_addr.c | 7 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index 7d147ef456..9e7d1179ba 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -315,6 +315,7 @@ static const config_var_t option_vars_[] = { VAR("AccountingRule", STRING, AccountingRule_option, "max"), V(AccountingStart, STRING, NULL), V(Address, LINELIST, NULL), + V(AddressDisableIPv6, BOOL, "0"), OBSOLETE("AllowDotExit"), OBSOLETE("AllowInvalidNodes"), V(AllowNonRFC953Hostnames, BOOL, "0"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 07126cc6ce..68be5711ce 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -75,6 +75,10 @@ struct or_options_t { * options is accepted as in IPv4 and IPv6. */ struct config_line_t *Address; + /** Boolean: If set, disable IPv6 address resolution, IPv6 ORPorts, IPv6 + * reachability checks, and publishing an IPv6 ORPort in its descriptor. */ + int AddressDisableIPv6; + char *PidFile; /**< Where to store PID of Tor process. */ struct routerset_t *ExitNodes; /**< Structure containing nicknames, digests, diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c index ba1c854d77..d23e39b62d 100644 --- a/src/app/config/resolve_addr.c +++ b/src/app/config/resolve_addr.c @@ -632,6 +632,13 @@ find_my_address(const or_options_t *options, int family, int warn_severity, if (method_out) *method_out = NULL; if (hostname_out) *hostname_out = NULL; + /* If an IPv6 is requested, check if IPv6 address discovery is disabled and + * if so we always return a failure. It is done here so we don't populate + * the resolve cache or do any DNS resolution. */ + if (family == AF_INET6 && options->AddressDisableIPv6) { + return false; + } + /* * Step 1: Discover address by attempting 3 different methods consecutively. */ |