[or-cvs] New config options to address bug 251:

arma at seul.org arma at seul.org
Sun Feb 19 22:02:04 UTC 2006


Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	config.c directory.c or.h rendclient.c rendservice.c router.c 
Log Message:
New config options to address bug 251:
FetchServerDescriptors and FetchHidServDescriptors for whether
to fetch server info and hidserv info or let the controller do it,
and also PublishServerDescriptor and PublishHidServDescriptors.

Add AllDirActionsPrivate undocumented option -- if you set it, you'll
need the controller to bootstrap you enough to build your first circuits.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.517
retrieving revision 1.518
diff -u -p -d -r1.517 -r1.518
--- config.c	19 Feb 2006 08:31:37 -0000	1.517
+++ config.c	19 Feb 2006 22:02:01 -0000	1.518
@@ -125,6 +125,7 @@ static config_var_t _option_vars[] = {
   VAR("AccountingMaxKB",     UINT,     _AccountingMaxKB,     "0"),
   VAR("AccountingStart",     STRING,   AccountingStart,      NULL),
   VAR("Address",             STRING,   Address,              NULL),
+  VAR("__AllDirActionsPrivate",BOOL,   AllDirActionsPrivate, "0"),
   VAR("AllowUnverifiedNodes",CSV,      AllowUnverifiedNodes,
                                                         "middle,rendezvous"),
   VAR("AssumeReachable",     BOOL,     AssumeReachable,      "0"),
@@ -158,6 +159,8 @@ static config_var_t _option_vars[] = {
   VAR("FascistFirewall",     BOOL,     FascistFirewall,      "0"),
   VAR("FirewallPorts",       CSV,      FirewallPorts,        ""),
   VAR("FastFirstHopPK",      BOOL,     FastFirstHopPK,       "1"),
+  VAR("FetchServerDescriptors",BOOL,   FetchServerDescriptors,"1"),
+  VAR("FetchHidServDescriptors",BOOL,  FetchHidServDescriptors, "1"),
   VAR("Group",               STRING,   Group,                NULL),
   VAR("HardwareAccel",       BOOL,     HardwareAccel,        "0"),
   VAR("HashedControlPassword",STRING,  HashedControlPassword, NULL),
@@ -197,6 +200,8 @@ static config_var_t _option_vars[] = {
   VAR("PathlenCoinWeight",   DOUBLE,   PathlenCoinWeight,    "0.3"),
   VAR("PidFile",             STRING,   PidFile,              NULL),
   VAR("ProtocolWarnings",    BOOL,     ProtocolWarnings,     "0"),
+  VAR("PublishServerDescriptor",BOOL,  PublishServerDescriptor,"1"),
+  VAR("PublishHidServDescriptors",BOOL,PublishHidServDescriptors, "1"),
   VAR("ReachableAddresses",  LINELIST, ReachableAddresses,   NULL),
   VAR("ReachableDirAddresses",LINELIST,ReachableDirAddresses,NULL),
   VAR("ReachableORAddresses",LINELIST, ReachableORAddresses, NULL),

Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.357
retrieving revision 1.358
diff -u -p -d -r1.357 -r1.358
--- directory.c	19 Feb 2006 08:31:37 -0000	1.357
+++ directory.c	19 Feb 2006 22:02:02 -0000	1.358
@@ -111,6 +111,8 @@ dir_policy_permits_address(uint32_t addr
 static int
 purpose_is_private(uint8_t purpose)
 {
+  if (get_options()->AllDirActionsPrivate)
+    return 1;
   if (purpose == DIR_PURPOSE_FETCH_DIR ||
       purpose == DIR_PURPOSE_UPLOAD_DIR ||
       purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
@@ -171,6 +173,10 @@ directory_get_from_dirserver(uint8_t pur
   int need_v2_support = purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
                         purpose == DIR_PURPOSE_FETCH_SERVERDESC;
 
+  if (!options->FetchServerDescriptors &&
+      (need_v1_support || need_v2_support))
+    return;
+
   if (directconn) {
     if (prefer_authority) {
       /* only ask authdirservers, and don't ask myself */

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.795
retrieving revision 1.796
diff -u -p -d -r1.795 -r1.796
--- or.h	19 Feb 2006 08:31:37 -0000	1.795
+++ or.h	19 Feb 2006 22:02:02 -0000	1.796
@@ -1270,6 +1270,13 @@ typedef struct {
                                    * versions? */
   int ClientOnly; /**< Boolean: should we never evolve into a server role? */
   int NoPublish; /**< Boolean: should we never publish a descriptor? */
+  int PublishServerDescriptor; /**< Do we publish our descriptor as normal? */
+  int PublishHidServDescriptors; /**< and our hidden service descriptors? */
+  int FetchServerDescriptors; /**< Do we fetch server descriptors as normal? */
+  int FetchHidServDescriptors; /** and hidden service descriptors? */
+  int AllDirActionsPrivate; /**< Should every directory action be sent
+                             * through a Tor circuit? */
+
   int ConnLimit; /**< Demanded minimum number of simultaneous connections. */
   int _ConnLimit; /**< Maximum allowed number of simultaneous connections. */
   int RunAsDaemon; /**< If true, run in the background. (Unix only) */

Index: rendclient.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/rendclient.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -p -d -r1.105 -r1.106
--- rendclient.c	13 Feb 2006 10:32:59 -0000	1.105
+++ rendclient.c	19 Feb 2006 22:02:02 -0000	1.106
@@ -252,6 +252,8 @@ rend_client_introduction_acked(circuit_t
 void
 rend_client_refetch_renddesc(const char *query)
 {
+  if (!get_options()->FetchHidServDescriptors)
+    return;
   if (connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query)) {
     log_info(LD_REND,"Would fetch a new renddesc here (for %s), but one is "
              "already in progress.", safe_str(query));

Index: rendservice.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -p -d -r1.155 -r1.156
--- rendservice.c	13 Feb 2006 10:32:59 -0000	1.155
+++ rendservice.c	19 Feb 2006 22:02:02 -0000	1.156
@@ -1060,6 +1060,9 @@ rend_consider_services_upload(time_t now
   rend_service_t *service;
   int rendpostperiod = get_options()->RendPostPeriod;
 
+  if (!get_options()->PublishHidServDescriptors)
+    return;
+
   for (i=0; i < smartlist_len(rend_service_list); ++i) {
     service = smartlist_get(rend_service_list, i);
     if (!service->next_upload_time) { /* never been uploaded yet */

Index: router.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -p -d -r1.246 -r1.247
--- router.c	14 Feb 2006 04:33:59 -0000	1.246
+++ router.c	19 Feb 2006 22:02:02 -0000	1.247
@@ -695,6 +695,8 @@ router_upload_dir_desc_to_dirservers(int
     log_warn(LD_GENERAL, "No descriptor; skipping upload");
     return;
   }
+  if (!get_options()->PublishServerDescriptor)
+    return;
   if (!force && !desc_needs_upload)
     return;
   desc_needs_upload = 0;



More information about the tor-commits mailing list