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

[or-cvs] backport] Stop assuming every authority is a v1 authority



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv13423/src/or

Modified Files:
      Tag: tor-0_1_1-patches
	config.c main.c or.h routerlist.c 
Log Message:
[backport] Stop assuming every authority is a v1 authority

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.554
retrieving revision 1.554.2.1
diff -u -p -d -r1.554 -r1.554.2.1
--- config.c	10 Apr 2006 08:05:00 -0000	1.554
+++ config.c	10 Apr 2006 21:33:32 -0000	1.554.2.1
@@ -3191,7 +3191,7 @@ parse_dir_server_line(const char *line, 
   char *addrport=NULL, *address=NULL, *nickname=NULL, *fingerprint=NULL;
   uint16_t port;
   char digest[DIGEST_LEN];
-  int supports_v1 = 1; /*XXXX011 change default when clients support v2. */
+  int is_v1_authority = 0;
 
   items = smartlist_create();
   smartlist_split_string(items, line, NULL,
@@ -3210,7 +3210,7 @@ parse_dir_server_line(const char *line, 
   if (!strcmp(smartlist_get(items, 0), "v1")) {
     char *v1 = smartlist_get(items, 0);
     tor_free(v1);
-    supports_v1 = 1;
+    is_v1_authority = 1;
     smartlist_del_keeporder(items, 0);
   }
 
@@ -3242,7 +3242,7 @@ parse_dir_server_line(const char *line, 
   if (!validate_only) {
     log_debug(LD_DIR, "Trusted dirserver at %s:%d (%s)", address, (int)port,
               (char*)smartlist_get(items,1));
-    add_trusted_dir_server(nickname, address, port, digest, supports_v1);
+    add_trusted_dir_server(nickname, address, port, digest, is_v1_authority);
   }
 
   r = 0;

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.639
retrieving revision 1.639.2.1
diff -u -p -d -r1.639 -r1.639.2.1
--- main.c	27 Mar 2006 02:25:34 -0000	1.639
+++ main.c	10 Apr 2006 21:33:32 -0000	1.639.2.1
@@ -826,7 +826,7 @@ run_scheduled_events(time_t now)
     if (options->DirPort && !options->V1AuthoritativeDir) {
       /* XXX actually, we should only do this if we want to advertise
        * our dirport. not simply if we configured one. -RD */
-      if (any_trusted_dir_supports_v1())
+      if (any_trusted_dir_is_v1_authority())
         directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1);
     }
 

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.824.2.1
retrieving revision 1.824.2.2
diff -u -p -d -r1.824.2.1 -r1.824.2.2
--- or.h	10 Apr 2006 19:53:27 -0000	1.824.2.1
+++ or.h	10 Apr 2006 21:33:32 -0000	1.824.2.2
@@ -2364,9 +2364,9 @@ int router_exit_policy_rejects_all(route
 
 void add_trusted_dir_server(const char *nickname,
                             const char *address, uint16_t port,
-                            const char *digest, int supports_v1);
+                            const char *digest, int is_v1_authority);
 void clear_trusted_dir_servers(void);
-int any_trusted_dir_supports_v1(void);
+int any_trusted_dir_is_v1_authority(void);
 networkstatus_t *networkstatus_get_by_digest(const char *digest);
 local_routerstatus_t *router_get_combined_status_by_digest(const char *digest);
 void update_networkstatus_downloads(time_t now);

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.499.2.1
retrieving revision 1.499.2.2
diff -u -p -d -r1.499.2.1 -r1.499.2.2
--- routerlist.c	10 Apr 2006 20:02:12 -0000	1.499.2.1
+++ routerlist.c	10 Apr 2006 21:33:32 -0000	1.499.2.2
@@ -2487,7 +2487,7 @@ router_exit_policy_rejects_all(routerinf
  * <b>address</b> is NULL, add ourself. */
 void
 add_trusted_dir_server(const char *nickname, const char *address,
-                       uint16_t port, const char *digest, int supports_v1)
+                       uint16_t port, const char *digest, int is_v1_authority)
 {
   trusted_dir_server_t *ent;
   uint32_t a;
@@ -2520,7 +2520,7 @@ add_trusted_dir_server(const char *nickn
   ent->addr = a;
   ent->dir_port = port;
   ent->is_running = 1;
-  ent->is_v1_authority = supports_v1;
+  ent->is_v1_authority = is_v1_authority;
   memcpy(ent->digest, digest, DIGEST_LEN);
 
   dlen = 64 + strlen(hostname) + (nickname?strlen(nickname):0);
@@ -2570,7 +2570,7 @@ clear_trusted_dir_servers(void)
 /** Return 1 if any trusted dir server supports v1 directories,
  * else return 0. */
 int
-any_trusted_dir_supports_v1(void)
+any_trusted_dir_is_v1_authority(void)
 {
   if (trusted_dir_servers)
     SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent,