Explorar el Código

more minor cleanups

svn:r8630
Roger Dingledine hace 19 años
padre
commit
f2bd0e2f16
Se han modificado 9 ficheros con 27 adiciones y 36 borrados
  1. 5 1
      ChangeLog
  2. 3 3
      doc/path-spec.txt
  3. 1 1
      src/common/log.c
  4. 4 4
      src/common/util.c
  5. 8 20
      src/or/circuitbuild.c
  6. 2 2
      src/or/config.c
  7. 2 3
      src/or/directory.c
  8. 1 1
      src/or/relay.c
  9. 1 1
      src/or/routerlist.c

+ 5 - 1
ChangeLog

@@ -176,9 +176,13 @@ Changes in version 0.1.2.2-alpha - 2006-10-??
     - Be clearer that the *ListenAddress directives can be repeated
     - Be clearer that the *ListenAddress directives can be repeated
       multiple times.
       multiple times.
 
 
-    (stopped at r8536)
+    (stopped at r8571)
     - Build correctly for use on OS X platforms with case-sensitive
     - Build correctly for use on OS X platforms with case-sensitive
       filesystems.
       filesystems.
+    - Bugfix: when we tunnel our dir fetches via tor, don't believe
+      the X-Forwarded-For header.
+    - stop trying to hammer router_rebuild_descriptor() when we don't
+      have a public address we like yet.
 
 
 
 
 Changes in version 0.1.2.1-alpha - 2006-08-27
 Changes in version 0.1.2.1-alpha - 2006-08-27

+ 3 - 3
doc/path-spec.txt

@@ -160,11 +160,11 @@ of their choices.
    For circuits that do not need to be not "fast", when choosing among
    For circuits that do not need to be not "fast", when choosing among
    multiple candidates for a path element, we choose randomly.
    multiple candidates for a path element, we choose randomly.
 
 
-   For "fast" circuits, we a given router as an exit with probability
+   For "fast" circuits, we pick a given router as an exit with probability
    proportional to its advertised bandwidth [the smaller of the 'rate' and
    proportional to its advertised bandwidth [the smaller of the 'rate' and
    'observed' arguments to the "bandwidth" element in its descriptor].  If a
    'observed' arguments to the "bandwidth" element in its descriptor].  If a
-   router's advertised bandwidth is greater than MAX_BELIEVEABLE_BANDWIDTH
-   (1.5 MB/sec), we clip to that value.
+   router's advertised bandwidth is greater than MAX_BELIEVABLE_BANDWIDTH
+   (1.5 MB/s), we clip to that value.
 
 
    For non-exit positions on "fast" circuits, we pick routers as above, but
    For non-exit positions on "fast" circuits, we pick routers as above, but
    we weight the clipped advertised bandwidth of Exit-flagged nodes depending
    we weight the clipped advertised bandwidth of Exit-flagged nodes depending

+ 1 - 1
src/common/log.c

@@ -618,7 +618,7 @@ configure_libevent_logging(void)
 {
 {
   event_set_log_callback(libevent_logging_callback);
   event_set_log_callback(libevent_logging_callback);
 }
 }
-/** Ignore any libevent log message that contains <b>msg</b> */
+/** Ignore any libevent log message that contains <b>msg</b>. */
 void
 void
 suppress_libevent_log_msg(const char *msg)
 suppress_libevent_log_msg(const char *msg)
 {
 {

+ 4 - 4
src/common/util.c

@@ -532,7 +532,7 @@ tor_parse_long(const char *s, int base, long min, long max,
   CHECK_STRTOX_RESULT();
   CHECK_STRTOX_RESULT();
 }
 }
 
 
-/** As tor_parse_log, but return an unsigned long */
+/** As tor_parse_log, but return an unsigned long. */
 unsigned long
 unsigned long
 tor_parse_ulong(const char *s, int base, unsigned long min,
 tor_parse_ulong(const char *s, int base, unsigned long min,
                 unsigned long max, int *ok, char **next)
                 unsigned long max, int *ok, char **next)
@@ -964,7 +964,7 @@ parse_iso_time(const char *cp, time_t *t)
   unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
   unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
   if (sscanf(cp, "%u-%u-%u %u:%u:%u", &year, &month,
   if (sscanf(cp, "%u-%u-%u %u:%u:%u", &year, &month,
                 &day, &hour, &minute, &second) < 6) {
                 &day, &hour, &minute, &second) < 6) {
-    log_warn(LD_GENERAL, "ISO time time was unparseable"); return -1;
+    log_warn(LD_GENERAL, "ISO time was unparseable"); return -1;
   }
   }
   if (year < 1970 || month < 1 || month > 12 || day < 1 || day > 31 ||
   if (year < 1970 || month < 1 || month > 12 || day < 1 || day > 31 ||
           hour > 23 || minute > 59 || second > 61) {
           hour > 23 || minute > 59 || second > 61) {
@@ -1246,7 +1246,7 @@ write_chunks_to_file_impl(const char *fname, const smartlist_t *chunks,
 }
 }
 
 
 /* Given a smartlist of sized_chunk_t, write them atomically to a file
 /* Given a smartlist of sized_chunk_t, write them atomically to a file
- * <b>fname</b>, overwriting or creating the file as necessary.  */
+ * <b>fname</b>, overwriting or creating the file as necessary. */
 int
 int
 write_chunks_to_file(const char *fname, const smartlist_t *chunks, int bin)
 write_chunks_to_file(const char *fname, const smartlist_t *chunks, int bin)
 {
 {
@@ -1254,7 +1254,7 @@ write_chunks_to_file(const char *fname, const smartlist_t *chunks, int bin)
   return write_chunks_to_file_impl(fname, chunks, flags);
   return write_chunks_to_file_impl(fname, chunks, flags);
 }
 }
 
 
-/** As write_str_to_file, but does not assume a NUL-terminated *
+/** As write_str_to_file, but does not assume a NUL-terminated
  * string. Instead, we write <b>len</b> bytes, starting at <b>str</b>. */
  * string. Instead, we write <b>len</b> bytes, starting at <b>str</b>. */
 int
 int
 write_bytes_to_file(const char *fname, const char *str, size_t len,
 write_bytes_to_file(const char *fname, const char *str, size_t len,

+ 8 - 20
src/or/circuitbuild.c

@@ -49,8 +49,7 @@ static int circuit_deliver_create_cell(circuit_t *circ,
                                        uint8_t cell_type, char *payload);
                                        uint8_t cell_type, char *payload);
 static int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit);
 static int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit);
 static crypt_path_t *onion_next_hop_in_cpath(crypt_path_t *cpath);
 static crypt_path_t *onion_next_hop_in_cpath(crypt_path_t *cpath);
-static int onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
-                              cpath_build_state_t *state);
+static int onion_extend_cpath(origin_circuit_t *circ);
 static int count_acceptable_routers(smartlist_t *routers);
 static int count_acceptable_routers(smartlist_t *routers);
 static int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
 static int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
 
 
@@ -263,7 +262,7 @@ onion_populate_cpath(origin_circuit_t *circ)
 {
 {
   int r;
   int r;
 again:
 again:
-  r = onion_extend_cpath(circ->_base.purpose, &circ->cpath, circ->build_state);
+  r = onion_extend_cpath(circ);
   if (r < 0) {
   if (r < 0) {
     log_info(LD_CIRC,"Generating cpath hop failed.");
     log_info(LD_CIRC,"Generating cpath hop failed.");
     return -1;
     return -1;
@@ -1632,24 +1631,13 @@ onion_next_hop_in_cpath(crypt_path_t *cpath)
  * based on <b>state</b>. Append the hop info to head_ptr.
  * based on <b>state</b>. Append the hop info to head_ptr.
  */
  */
 static int
 static int
-onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
-                   cpath_build_state_t *state)
+onion_extend_cpath(origin_circuit_t *circ)
 {
 {
-  int cur_len;
-  crypt_path_t *cpath;
+  uint8_t purpose = circ->_base.purpose;
+  cpath_build_state_t *state = circ->build_state;
+  int cur_len = circuit_get_cpath_len(circ);
   extend_info_t *info = NULL;
   extend_info_t *info = NULL;
 
 
-  tor_assert(head_ptr);
-
-  if (!*head_ptr) {
-    cur_len = 0;
-  } else {
-    cur_len = 1;
-    for (cpath = *head_ptr; cpath->next != *head_ptr; cpath = cpath->next) {
-      ++cur_len;
-    }
-  }
-
   if (cur_len >= state->desired_path_len) {
   if (cur_len >= state->desired_path_len) {
     log_debug(LD_CIRC, "Path is complete: %d steps long",
     log_debug(LD_CIRC, "Path is complete: %d steps long",
               state->desired_path_len);
               state->desired_path_len);
@@ -1667,7 +1655,7 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
       info = extend_info_from_router(r);
       info = extend_info_from_router(r);
   } else {
   } else {
     routerinfo_t *r =
     routerinfo_t *r =
-      choose_good_middle_server(purpose, state, *head_ptr, cur_len);
+      choose_good_middle_server(purpose, state, circ->cpath, cur_len);
     if (r)
     if (r)
       info = extend_info_from_router(r);
       info = extend_info_from_router(r);
   }
   }
@@ -1681,7 +1669,7 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
   log_debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
   log_debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
             info->nickname, cur_len+1, build_state_get_exit_nickname(state));
             info->nickname, cur_len+1, build_state_get_exit_nickname(state));
 
 
-  onion_append_hop(head_ptr, info);
+  onion_append_hop(&circ->cpath, info);
   extend_info_free(info);
   extend_info_free(info);
   return 0;
   return 0;
 }
 }

+ 2 - 2
src/or/config.c

@@ -3467,8 +3467,8 @@ write_configuration_file(const char *fname, or_options_t *options)
     log_notice(LD_CONFIG, "Renaming old configuration file to \"%s\"", fn_tmp);
     log_notice(LD_CONFIG, "Renaming old configuration file to \"%s\"", fn_tmp);
     if (rename(fname, fn_tmp) < 0) {
     if (rename(fname, fn_tmp) < 0) {
       log_warn(LD_FS,
       log_warn(LD_FS,
-             "Couldn't rename configuration file \"%s\" to \"%s\": %s",
-             fname, fn_tmp, strerror(errno));
+               "Couldn't rename configuration file \"%s\" to \"%s\": %s",
+               fname, fn_tmp, strerror(errno));
       tor_free(fn_tmp);
       tor_free(fn_tmp);
       goto err;
       goto err;
     }
     }

+ 2 - 3
src/or/directory.c

@@ -1160,7 +1160,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
         break;
         break;
       default:
       default:
         log_warn(LD_GENERAL,
         log_warn(LD_GENERAL,
-             "http status %d (%s) reason unexpected while uploding "
+             "http status %d (%s) reason unexpected while uploading "
              "descriptor to server '%s:%d').",
              "descriptor to server '%s:%d').",
              status_code, escaped(reason), conn->_base.address,
              status_code, escaped(reason), conn->_base.address,
              conn->_base.port);
              conn->_base.port);
@@ -1197,8 +1197,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
         break;
         break;
       default:
       default:
         log_warn(LD_REND,"http status %d (%s) response unexpected while "
         log_warn(LD_REND,"http status %d (%s) response unexpected while "
-                 "fetching hidden service descriptor (server "
-                 "'%s:%d').",
+                 "fetching hidden service descriptor (server '%s:%d').",
                  status_code, escaped(reason), conn->_base.address,
                  status_code, escaped(reason), conn->_base.address,
                  conn->_base.port);
                  conn->_base.port);
         break;
         break;

+ 1 - 1
src/or/relay.c

@@ -590,7 +590,7 @@ connection_edge_end_reason_socks5_response(int reason)
       return SOCKS5_NET_UNREACHABLE;
       return SOCKS5_NET_UNREACHABLE;
     default:
     default:
       log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized; "
       log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized; "
-               "sending generic socks error.",reason);
+               "sending generic socks error.", reason);
       return SOCKS5_GENERAL_ERROR;
       return SOCKS5_GENERAL_ERROR;
   }
   }
 }
 }

+ 1 - 1
src/or/routerlist.c

@@ -3481,7 +3481,7 @@ routers_update_status_from_networkstatus(smartlist_t *routers,
       router->is_fast = rs->status.is_fast;
       router->is_fast = rs->status.is_fast;
       router->is_stable = rs->status.is_stable;
       router->is_stable = rs->status.is_stable;
       router->is_possible_guard = rs->status.is_possible_guard;
       router->is_possible_guard = rs->status.is_possible_guard;
-      router->is_exit =  rs->status.is_exit;
+      router->is_exit = rs->status.is_exit;
     }
     }
     if (router->is_running && ds) {
     if (router->is_running && ds) {
       ds->n_networkstatus_failures = 0;
       ds->n_networkstatus_failures = 0;