[or-cvs] Clean up last patch; implement (mostly) proper handling for...

Nick Mathewson nickm at seul.org
Tue Aug 17 06:06:08 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv22560/src/or

Modified Files:
	or.h routerlist.c routerparse.c 
Log Message:
Clean up last patch; implement (mostly) proper handling for verified/unverified name collisions.

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.407
retrieving revision 1.408
diff -u -d -r1.407 -r1.408
--- or.h	17 Aug 2004 05:13:58 -0000	1.407
+++ or.h	17 Aug 2004 06:06:05 -0000	1.408
@@ -588,7 +588,7 @@
   uint32_t bandwidthcapacity;
   struct exit_policy_t *exit_policy; /**< What streams will this OR permit
                                       * to exit? */
-  int uptime; /**< How many seconds the router claims to have been up */
+  long uptime; /**< How many seconds the router claims to have been up */
   /* local info */
   int is_running; /**< As far as we know, is this OR currently running? */
   time_t status_set_at; /**< When did we last update is_running? */

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- routerlist.c	17 Aug 2004 02:00:36 -0000	1.122
+++ routerlist.c	17 Aug 2004 06:06:05 -0000	1.123
@@ -565,6 +565,23 @@
         routerinfo_free(router);
         return -1;
       }
+    } else if (!strcmp(router->nickname, r->nickname)) {
+      /* nicknames match, keys don't. */
+      if (router->is_verified) {
+        /* The new verified router replaces the old one; remove the
+         * old one.  and carry on to the end of the list, in case
+         * there are more old unverifed routers with this nickname
+         */
+        routerinfo_free(r);
+        smartlist_del_keeporder(routerlist->routers, i--);
+        /* XXXX What do we do about any connections using the old key? */
+      } else if (r->is_verified) {
+        /* Can't replace a verified router with an unverified one. */
+        log_fn(LOG_DEBUG, "Skipping unverified entry for verified router '%s'",
+               router->nickname);
+        routerinfo_free(router);
+        return -1;
+      }
     }
   }
   /* We haven't seen a router with this name before.  Add it to the end of

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- routerparse.c	17 Aug 2004 05:29:41 -0000	1.33
+++ routerparse.c	17 Aug 2004 06:06:05 -0000	1.34
@@ -644,7 +644,6 @@
   smartlist_t *tokens = NULL, *exit_policy_tokens = NULL;
   directory_token_t *tok;
   int t;
-  long lng;
   int ports_set, bw_set;
 
   if (!end) {



More information about the tor-commits mailing list