Browse Source

add a 'bridge' flag for dirserver config entries

svn:r10128
Roger Dingledine 18 years ago
parent
commit
f8a8b27dd2
5 changed files with 19 additions and 8 deletions
  1. 5 3
      doc/tor.1.in
  2. 6 3
      src/or/config.c
  3. 4 1
      src/or/or.h
  4. 1 0
      src/or/router.c
  5. 3 1
      src/or/routerlist.c

+ 5 - 3
doc/tor.1.in

@@ -150,9 +150,11 @@ for current ("v2")-style directories, unless the "no-v2" flag is given.  If the
 authority for old-style (v1) directories as well.  (Only directory mirrors
 authority for old-style (v1) directories as well.  (Only directory mirrors
 care about this.)  Tor will use this server as an authority for hidden
 care about this.)  Tor will use this server as an authority for hidden
 service information if the "hs" flag is set, or if the "v1" flag is set and
 service information if the "hs" flag is set, or if the "v1" flag is set and
-the "no-hs" flag is \fBnot\fP set.  If a flag "orport=\fBport\fR" is given,
-Tor will use the given port when opening encrypted tunnels to the
-dirserver.
+the "no-hs" flag is \fBnot\fP set.  Tor will use this authority as a bridge
+authoritative directory if the "bridge" flag is set.  Lastly, if a flag
+"orport=\fBport\fR" is given, Tor will use the given port when opening
+encrypted tunnels to the dirserver.
+
 If no \fBdirserver\fP line is given, Tor will use the default
 If no \fBdirserver\fP line is given, Tor will use the default
 directory servers.  NOTE: this option is intended
 directory servers.  NOTE: this option is intended
 for setting up a private Tor network with its own directory authorities.  If
 for setting up a private Tor network with its own directory authorities.  If

+ 6 - 3
src/or/config.c

@@ -3444,7 +3444,8 @@ parse_dir_server_line(const char *line, int validate_only)
   uint16_t dir_port = 0, or_port = 0;
   uint16_t dir_port = 0, or_port = 0;
   char digest[DIGEST_LEN];
   char digest[DIGEST_LEN];
   int is_v1_authority = 0, is_hidserv_authority = 0,
   int is_v1_authority = 0, is_hidserv_authority = 0,
-    is_not_hidserv_authority = 0, is_v2_authority = 1;
+    is_not_hidserv_authority = 0, is_v2_authority = 1,
+    is_bridge_authority = 0;
 
 
   items = smartlist_create();
   items = smartlist_create();
   smartlist_split_string(items, line, NULL,
   smartlist_split_string(items, line, NULL,
@@ -3469,6 +3470,8 @@ parse_dir_server_line(const char *line, int validate_only)
       is_hidserv_authority = 1;
       is_hidserv_authority = 1;
     } else if (!strcasecmp(flag, "no-hs")) {
     } else if (!strcasecmp(flag, "no-hs")) {
       is_not_hidserv_authority = 1;
       is_not_hidserv_authority = 1;
+    } else if (!strcasecmp(flag, "bridge")) {
+      is_bridge_authority = 1;
     } else if (!strcasecmp(flag, "no-v2")) {
     } else if (!strcasecmp(flag, "no-v2")) {
       is_v2_authority = 0;
       is_v2_authority = 0;
     } else if (!strcasecmpstart(flag, "orport=")) {
     } else if (!strcasecmpstart(flag, "orport=")) {
@@ -3519,8 +3522,8 @@ parse_dir_server_line(const char *line, int validate_only)
               (int)dir_port,
               (int)dir_port,
               (char*)smartlist_get(items,1));
               (char*)smartlist_get(items,1));
     add_trusted_dir_server(nickname, address, dir_port, or_port, digest,
     add_trusted_dir_server(nickname, address, dir_port, or_port, digest,
-                           is_v1_authority,
-                           is_v2_authority, is_hidserv_authority);
+                           is_v1_authority, is_v2_authority,
+                           is_bridge_authority, is_hidserv_authority);
 
 
   }
   }
 
 

+ 4 - 1
src/or/or.h

@@ -3011,6 +3011,8 @@ typedef struct trusted_dir_server_t {
   /** True iff this server is an authority for the newer ("v2") directory
   /** True iff this server is an authority for the newer ("v2") directory
    * protocol. */
    * protocol. */
   unsigned int is_v2_authority:1;
   unsigned int is_v2_authority:1;
+  /** True iff this server is an authority for bridge relays. */
+  unsigned int is_bridge_authority:1;
   /** True iff this server is an authority for hidden services. */
   /** True iff this server is an authority for hidden services. */
   unsigned int is_hidserv_authority:1;
   unsigned int is_hidserv_authority:1;
   /** True iff this server has accepted the most recent server descriptor
   /** True iff this server has accepted the most recent server descriptor
@@ -3115,7 +3117,8 @@ int router_exit_policy_rejects_all(routerinfo_t *router);
 void add_trusted_dir_server(const char *nickname, const char *address,
 void add_trusted_dir_server(const char *nickname, const char *address,
                             uint16_t dir_port, uint16_t or_port,
                             uint16_t dir_port, uint16_t or_port,
                             const char *digest, int is_v1_authority,
                             const char *digest, int is_v1_authority,
-                            int is_v2_authority, int is_hidserv_authority);
+                            int is_v2_authority, int is_bridge_authority,
+                            int is_hidserv_authority);
 void clear_trusted_dir_servers(void);
 void clear_trusted_dir_servers(void);
 int any_trusted_dir_is_v1_authority(void);
 int any_trusted_dir_is_v1_authority(void);
 networkstatus_t *networkstatus_get_by_digest(const char *digest);
 networkstatus_t *networkstatus_get_by_digest(const char *digest);

+ 1 - 0
src/or/router.c

@@ -378,6 +378,7 @@ init_keys(void)
                            digest,
                            digest,
                            options->V1AuthoritativeDir, /* v1 authority */
                            options->V1AuthoritativeDir, /* v1 authority */
                            options->V2AuthoritativeDir, /* v2 authority */
                            options->V2AuthoritativeDir, /* v2 authority */
+                           options->BridgeAuthoritativeDir, /* bridge auth */
                            options->HSAuthoritativeDir /*hidserv authority*/);
                            options->HSAuthoritativeDir /*hidserv authority*/);
   }
   }
   return 0; /* success */
   return 0; /* success */

+ 3 - 1
src/or/routerlist.c

@@ -3264,7 +3264,8 @@ void
 add_trusted_dir_server(const char *nickname, const char *address,
 add_trusted_dir_server(const char *nickname, const char *address,
                        uint16_t dir_port, uint16_t or_port,
                        uint16_t dir_port, uint16_t or_port,
                        const char *digest, int is_v1_authority,
                        const char *digest, int is_v1_authority,
-                       int is_v2_authority, int is_hidserv_authority)
+                       int is_v2_authority, int is_bridge_authority,
+                       int is_hidserv_authority)
 {
 {
   trusted_dir_server_t *ent;
   trusted_dir_server_t *ent;
   uint32_t a;
   uint32_t a;
@@ -3300,6 +3301,7 @@ add_trusted_dir_server(const char *nickname, const char *address,
   ent->is_running = 1;
   ent->is_running = 1;
   ent->is_v1_authority = is_v1_authority;
   ent->is_v1_authority = is_v1_authority;
   ent->is_v2_authority = is_v2_authority;
   ent->is_v2_authority = is_v2_authority;
+  ent->is_bridge_authority = is_bridge_authority;
   ent->is_hidserv_authority = is_hidserv_authority;
   ent->is_hidserv_authority = is_hidserv_authority;
   memcpy(ent->digest, digest, DIGEST_LEN);
   memcpy(ent->digest, digest, DIGEST_LEN);