patch to add a NoPublish configuration option

Geoffrey Goodell goodell at cassandra.eecs.harvard.edu
Thu Apr 14 08:16:02 UTC 2005


Please consider this patch, which creates a NoPublish configuration
option.  Presently, NoPublish is identical in function to ClientOnly,
but the goal is different.  In particular, NoPublish does not mean "I am
not a server"; instead, NoPublish means "I will not publish a
descriptor".  Eventually, ClientOnly should be modified to prevent Tor
from acting as a server even if an external means (a controller,
perhaps) pushes around the descriptor in such a manner as to obviate
direct publication.  However, this is not my concern for now.

Geoff
-------------- next part --------------
Common subdirectories: or/.deps and or.patch/.deps
Common subdirectories: or/CVS and or.patch/CVS
diff -u or/config.c or.patch/config.c
--- or/config.c	2005-04-14 04:10:34.000000000 -0400
+++ or.patch/config.c	2005-04-14 03:51:38.000000000 -0400
@@ -128,6 +128,7 @@
   VAR("FirewallPorts",       CSV,      FirewallPorts,        "80,443"),
   VAR("MyFamily",            STRING,   MyFamily,             NULL),
   VAR("NodeFamily",          LINELIST, NodeFamilies,         NULL),
+  VAR("NoPublish",           BOOL,     NoPublish,            "0"),
   VAR("Group",               STRING,   Group,                NULL),
   VAR("HashedControlPassword",STRING,  HashedControlPassword, NULL),
   VAR("HttpProxy",           STRING,   HttpProxy,            NULL),
@@ -1330,6 +1331,11 @@
     result = -1;
   }
 
+  if (options->AuthoritativeDir && options->NoPublish) {
+    log(LOG_WARN, "Running as authoritative directory, but NoPublish also set.");
+    result = -1;
+  }
+
   if (options->ConnLimit <= 0) {
     log(LOG_WARN, "ConnLimit must be greater than 0, but was set to %d",
         options->ConnLimit);
diff -u or/or.h or.patch/or.h
--- or/or.h	2005-04-14 04:12:02.000000000 -0400
+++ or.patch/or.h	2005-04-14 03:52:34.000000000 -0400
@@ -1010,6 +1010,7 @@
   int DirPort; /**< Port to listen on for directory connections. */
   int AuthoritativeDir; /**< Boolean: is this an authoritative directory? */
   int ClientOnly; /**< Boolean: should we never evolve into a server role? */
+  int NoPublish; /**< Boolean: should we never publish a descriptor? */
   int ConnLimit; /**< Requested maximum number of simultaneous connections. */
   int _ConnLimit; /**< Actual maximum number of simultaneous connections. */
   int IgnoreVersion; /**< If true, run no matter what versions of Tor the
diff -u or/router.c or.patch/router.c
--- or/router.c	2005-04-14 04:10:35.000000000 -0400
+++ or.patch/router.c	2005-04-14 04:08:20.000000000 -0400
@@ -472,18 +472,23 @@
   return (options->SocksPort != 0 || options->SocksBindAddress);
 }
 
-/** Decide if we're a publishable server or just a client. We are a server if:
+/** Decide if we're a publishable server.  We are a publishable server if:
+ * - We don't have the ClientOnly option set
+ * and
+ * - We don't have the NoPublish option set
+ * and
+ * - We have ORPort set
+ * and
+ * - We believe we are reachable from the outside; or
  * - We have the AuthoritativeDirectory option set.
- * or
- * - We don't have the ClientOnly option set; and
- * - We have ORPort set; and
- * - We believe we are reachable from the outside.
  */
 static int decide_if_publishable_server(time_t now) {
   or_options_t *options = get_options();
 
   if (options->ClientOnly)
     return 0;
+  if (options->NoPublish)
+    return 0;
   if (!server_mode(options))
     return 0;
   if (options->AuthoritativeDir)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.torproject.org/pipermail/tor-dev/attachments/20050414/401964ff/attachment.pgp>


More information about the tor-dev mailing list