From 3c8baa77a1d2f5a0235adc48ad5650340683e8ee Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 19 Aug 2016 20:21:04 -0400 Subject: [PATCH] Log a warning when Testing options are deprecated. --- src/or/config.c | 8 +++++++- src/or/confparse.c | 2 +- src/or/confparse.h | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/or/config.c b/src/or/config.c index a94e9595d6..941393a603 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -545,7 +545,7 @@ static const config_var_t testing_tor_network_defaults[] = { "0, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"), V(ClientBootstrapConsensusMaxDownloadTries, UINT, "80"), V(ClientBootstrapConsensusAuthorityOnlyMaxDownloadTries, UINT, "80"), - V(ClientDNSRejectInternalAddresses, BOOL,"0"), + V(ClientDNSRejectInternalAddresses, BOOL,"0"), // deprecated in 0.2.9.2-alpha V(ClientRejectInternalAddresses, BOOL, "0"), V(CountPrivateBandwidth, BOOL, "1"), V(ExitPolicyRejectPrivate, BOOL, "0"), @@ -4924,6 +4924,12 @@ options_init_from_string(const char *cf_defaults, const char *cf, tor_assert(new_var); tor_assert(old_var); old_var->initvalue = new_var->initvalue; + + if ((config_find_deprecation(&options_format, new_var->name))) { + log_warn(LD_GENERAL, "Testing options override the deprecated " + "option %s. Is that intentional?", + new_var->name); + } } /* Clear newoptions and re-initialize them with new defaults. */ diff --git a/src/or/confparse.c b/src/or/confparse.c index e9d56455f0..efcf4f981e 100644 --- a/src/or/confparse.c +++ b/src/or/confparse.c @@ -184,7 +184,7 @@ config_free_lines(config_line_t *front) /** If key is a deprecated configuration option, return the message * explaining why it is deprecated (which may be an empty string). Return NULL * if it is not deprecated. The key field must be fully expanded. */ -static const char * +const char * config_find_deprecation(const config_format_t *fmt, const char *key) { if (BUG(fmt == NULL) || BUG(key == NULL)) diff --git a/src/or/confparse.h b/src/or/confparse.h index cf92ac4dc1..8d915d266b 100644 --- a/src/or/confparse.h +++ b/src/or/confparse.h @@ -127,6 +127,8 @@ int config_assign(const config_format_t *fmt, void *options, unsigned flags, char **msg); config_var_t *config_find_option_mutable(config_format_t *fmt, const char *key); +const char *config_find_deprecation(const config_format_t *fmt, + const char *key); const config_var_t *config_find_option(const config_format_t *fmt, const char *key);