summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2009-05-12 19:48:08 +0200
committerSebastian Hahn <sebastian@torproject.org>2009-05-12 20:00:00 +0200
commita28215a150818b11e128f5f5aeb44e53a40d5af7 (patch)
tree249f9a9bd483a8c5aa88bacef2e17d7b66dc66c2
parent88d81ead83ded22db7eaf8090edd9ee0937b2dd5 (diff)
downloadtor-a28215a150818b11e128f5f5aeb44e53a40d5af7.tar.gz
tor-a28215a150818b11e128f5f5aeb44e53a40d5af7.zip
Warn when hibernation and low-port on non-windows is configured
This addresses the first part of bug 918. Users are now warned when they try to use hibernation in combination with a port below 1024 when they're not on Windows. We don't want to die here, because people might run Tor as root, use a capabilities system or some other platform that will allow them to re-attach low ports. Wording suggested by Marian
-rw-r--r--src/or/config.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 35f5134f15..71dd391664 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3013,6 +3013,18 @@ options_validate(or_options_t *old_options, or_options_t *options,
REJECT("TransPort and TransListenAddress are disabled in this build.");
#endif
+#ifndef MS_WINDOWS
+ if (options->AccountingMax &&
+ (options->DirPort < 1024 || options->ORPort < 1024))
+ log(LOG_WARN, LD_CONFIG,
+ "You have set AccountingMax to use hibernation. You have also "
+ "chosen a low DirPort or OrPort. This combination can make Tor stop "
+ "working when it tries to re-attach the port after a period of "
+ "hibernation. Please choose a different port or turn off "
+ "hibernation unless you know this combination will work on your "
+ "platform.");
+#endif
+
if (options->ExcludeExitNodes || options->ExcludeNodes) {
options->_ExcludeExitNodesUnion = routerset_new();
routerset_union(options->_ExcludeExitNodesUnion,options->ExcludeExitNodes);