Merge branch 'bug23952_032' into maint-0.3.2

This commit is contained in:
Nick Mathewson 2017-10-24 08:24:12 -04:00
commit 0d4addfc73
4 changed files with 29 additions and 2 deletions

4
changes/bug23952 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (relay):
- Avoid a BUG warning when receiving a dubious CREATE cell while
an option transition is in progress. Fixes bug 23952; bugfix on
0.3.2.1-alpha.

View File

@ -1030,6 +1030,23 @@ escaped_safe_str(const char *address)
return escaped(address);
}
/**
* The severity level that should be used for warnings of severity
* LOG_PROTOCOL_WARN.
*
* We keep this outside the options, in case somebody needs to use
* LOG_PROTOCOL_WARN while an option transition is happening.
*/
static int protocol_warning_severity_level = LOG_WARN;
/** Return the severity level that should be used for warnings of severity
* LOG_PROTOCOL_WARN. */
int
get_protocol_warning_severity_level(void)
{
return protocol_warning_severity_level;
}
/** List of default directory authorities */
static const char *default_authorities[] = {
@ -1667,6 +1684,11 @@ options_act(const or_options_t *old_options)
return -1;
}
if (options->ProtocolWarnings)
protocol_warning_severity_level = LOG_WARN;
else
protocol_warning_severity_level = LOG_INFO;
if (consider_adding_dir_servers(options, old_options) < 0)
return -1;

View File

@ -31,6 +31,7 @@ const char *safe_str_client(const char *address);
const char *safe_str(const char *address);
const char *escaped_safe_str_client(const char *address);
const char *escaped_safe_str(const char *address);
int get_protocol_warning_severity_level(void);
const char *get_version(void);
const char *get_short_version(void);
setopt_err_t options_trial_assign(config_line_t *list, unsigned flags,

View File

@ -4079,8 +4079,6 @@ typedef struct {
int Sandbox; /**< Boolean: should sandboxing be enabled? */
int SafeSocks; /**< Boolean: should we outright refuse application
* connections that use socks4 or socks5-with-local-dns? */
#define LOG_PROTOCOL_WARN (get_options()->ProtocolWarnings ? \
LOG_WARN : LOG_INFO)
int ProtocolWarnings; /**< Boolean: when other parties screw up the Tor
* protocol, is it a warn or an info in our logs? */
int TestSocks; /**< Boolean: when we get a socks connection, do we loudly
@ -4627,6 +4625,8 @@ typedef struct {
smartlist_t *SchedulerTypes_;
} or_options_t;
#define LOG_PROTOCOL_WARN (get_protocol_warning_severity_level())
/** Persistent state for an onion router, as saved to disk. */
typedef struct {
uint32_t magic_;