diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-12-01 11:30:53 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-01 11:30:53 -0500 |
commit | d4d4a4b2dd95ce0cb8db6fc0074f0ac66d659469 (patch) | |
tree | 7b60851e38b155d3030bbffde55a762b8681973b /src/app | |
parent | c63d951e7f093f3a97748f96314b669d0cd1da54 (diff) | |
parent | d020124138cc0d16e685bfd35dd388a4db7f68af (diff) | |
download | tor-d4d4a4b2dd95ce0cb8db6fc0074f0ac66d659469.tar.gz tor-d4d4a4b2dd95ce0cb8db6fc0074f0ac66d659469.zip |
Merge remote-tracking branch 'tor-github/pr/527'
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/config/config.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index 90eae50fdd..d907b07136 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -157,6 +157,10 @@ #include "core/or/connection_st.h" #include "core/or/port_cfg_st.h" +#ifdef __FreeBSD__ +#include <sys/sysctl.h> +#endif + #ifdef HAVE_SYSTEMD # if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse @@ -3382,6 +3386,23 @@ options_validate(or_options_t *old_options, or_options_t *options, if (ContactInfo && !string_is_utf8(ContactInfo, strlen(ContactInfo))) REJECT("ContactInfo config option must be UTF-8."); +#ifdef __FreeBSD__ + if (server_mode(options)) { + int random_id_state; + size_t state_size = sizeof(random_id_state); + + if (sysctlbyname("net.inet.ip.random_id", &random_id_state, + &state_size, NULL, 0)) { + log_warn(LD_CONFIG, + "Failed to figure out if IP ids are randomized."); + } else if (random_id_state == 0) { + log_warn(LD_CONFIG, "Looks like IP ids are not randomized. " + "Please consider setting the net.inet.ip.random_id sysctl, " + "so your relay makes it harder to figure out how busy it is."); + } + } +#endif + /* Special case on first boot if no Log options are given. */ if (!options->Logs && !options->RunAsDaemon && !from_setconf) { if (quiet_level == 0) |