[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10139: record the router purpose at each step of the circuit path. (tor/trunk/src/or)



Author: arma
Date: 2007-05-08 06:11:53 -0400 (Tue, 08 May 2007)
New Revision: 10139

Modified:
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/or.h
Log:
record the router purpose at each step of the circuit path.
i have the feeling this will come in handy.


Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2007-05-08 10:01:33 UTC (rev 10138)
+++ tor/trunk/src/or/circuitbuild.c	2007-05-08 10:11:53 UTC (rev 10139)
@@ -1732,9 +1732,19 @@
   info->onion_key = crypto_pk_dup_key(r->onion_pkey);
   info->addr = r->addr;
   info->port = r->or_port;
+  info->router_purpose = r->purpose;
   return info;
 }
 
+/** What router purpose is <b>digest</b>?
+ * It's a general purpose router unless it's on our bridges list.
+ */
+static uint8_t
+get_router_purpose_from_digest(char *digest) {
+  (void)digest;
+  return ROUTER_PURPOSE_GENERAL; /* XXX020 */
+}
+
 /** Allocate and return a new extend_info_t that can be used to build a
  * circuit to or through the router <b>r</b>. */
 extend_info_t *
@@ -1748,6 +1758,7 @@
   info->onion_key = NULL; /* routerstatus doesn't know this */
   info->addr = s->addr;
   info->port = s->or_port;
+  info->router_purpose = get_router_purpose_from_digest(info->identity_digest);
   return info;
 }
 

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-05-08 10:01:33 UTC (rev 10138)
+++ tor/trunk/src/or/or.h	2007-05-08 10:11:53 UTC (rev 10139)
@@ -1118,11 +1118,13 @@
   unsigned int is_bad_exit:1; /**< Do we think this exit is censored, borked,
                                * or otherwise nasty? */
 
-/** Tor can use this desc for circuit-building. */
+/** Tor can use this router for general positions in circuits. */
 #define ROUTER_PURPOSE_GENERAL 0
-/** Tor should avoid using this desc for circuit-building. */
+/** Tor should avoid using this router for circuit-building. */
 #define ROUTER_PURPOSE_CONTROLLER 1
-  uint8_t purpose; /** Should Tor use this desc for circuit-building? */
+/** Tor should use this router only for bridge positions in circuits. */
+#define ROUTER_PURPOSE_BRIDGE 1
+  uint8_t purpose; /** What positions in a circuit is this router good for? */
 
   /* The below items are used only by authdirservers for
    * reachability testing. */
@@ -1297,6 +1299,7 @@
   char identity_digest[DIGEST_LEN]; /**< Hash of this router's identity key. */
   uint32_t addr; /**< IP address in host order. */
   uint16_t port; /**< OR port. */
+  uint8_t router_purpose; /**< General, controller, or bridge. */
   crypto_pk_env_t *onion_key; /**< Current onionskin key. */
 } extend_info_t;