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

[tor-commits] [tor/maint-0.2.2] Merge remote branch 'arma/bug2510' into maint-0.2.2



commit 0588330c1d66960353c412812d1d073fdb37e310
Merge: b639add cb101c4
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Mar 14 16:14:54 2011 -0400

    Merge remote branch 'arma/bug2510' into maint-0.2.2

 changes/bug2510       |    8 ++++++++
 changes/bug2511       |    6 ++++++
 src/or/circuitbuild.c |   25 +++++++++++++++++++++++++
 src/or/or.h           |    1 +
 src/or/routerlist.c   |   17 ++++++++++++++++-
 5 files changed, 56 insertions(+), 1 deletions(-)

diff --combined src/or/circuitbuild.c
index 6be27d2,d1cb547..a54f232
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@@ -4063,6 -4063,7 +4063,6 @@@ choose_random_entry(cpath_build_state_
    int preferred_min, consider_exit_family = 0;
  
    if (chosen_exit) {
 -    smartlist_add(exit_family, chosen_exit);
      routerlist_add_family(exit_family, chosen_exit);
      consider_exit_family = 1;
    }
@@@ -4085,8 -4086,6 +4085,8 @@@
        r = entry_is_live(entry, need_uptime, need_capacity, 0, &msg);
        if (!r)
          continue; /* down, no point */
 +      if (r == chosen_exit)
 +        continue; /* don't pick the same node for entry and exit */
        if (consider_exit_family && smartlist_isin(exit_family, r))
          continue; /* avoid relays that are family members of our exit */
        if (options->EntryNodes &&
@@@ -4671,6 -4670,29 +4671,29 @@@ fetch_bridge_descriptors(or_options_t *
    SMARTLIST_FOREACH_END(bridge);
  }
  
+ /** If our <b>bridge</b> is configured to be a different address than
+  * the bridge gives in its routerinfo <b>ri</b>, rewrite the routerinfo
+  * we received to use the address we meant to use. Now we handle
+  * multihomed bridges better.
+  */
+ static void
+ rewrite_routerinfo_address_for_bridge(bridge_info_t *bridge, routerinfo_t *ri)
+ {
+   tor_addr_t addr;
+   tor_addr_from_ipv4h(&addr, ri->addr);
+ 
+   if (!tor_addr_compare(&bridge->addr, &addr, CMP_EXACT) &&
+       bridge->port == ri->or_port)
+     return; /* they match, so no need to do anything */
+ 
+   ri->addr = tor_addr_to_ipv4h(&bridge->addr);
+   tor_free(ri->address);
+   ri->address = tor_dup_ip(ri->addr);
+   ri->or_port = bridge->port;
+   log_info(LD_DIR, "Adjusted bridge '%s' to match configured address %s:%d.",
+            ri->nickname, ri->address, ri->or_port);
+ }
+ 
  /** We just learned a descriptor for a bridge. See if that
   * digest is in our entry guard list, and add it if not. */
  void
@@@ -4689,6 -4711,8 +4712,8 @@@ learned_bridge_descriptor(routerinfo_t 
        if (!from_cache)
          download_status_reset(&bridge->fetch_status);
  
+       rewrite_routerinfo_address_for_bridge(bridge, ri);
+ 
        add_an_entry_guard(ri, 1);
        log_notice(LD_DIR, "new bridge descriptor '%s' (%s)", ri->nickname,
                   from_cache ? "cached" : "fresh");
@@@ -4728,8 -4752,7 +4753,8 @@@ any_pending_bridge_descriptor_fetches(v
          conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC &&
          TO_DIR_CONN(conn)->router_purpose == ROUTER_PURPOSE_BRIDGE &&
          !conn->marked_for_close &&
 -        conn->linked && !conn->linked_conn->marked_for_close) {
 +        conn->linked &&
 +        conn->linked_conn && !conn->linked_conn->marked_for_close) {
        log_debug(LD_DIR, "found one: %s", conn->address);
        return 1;
      }
diff --combined src/or/or.h
index 3ce1425,e899f60..910bf8d
--- a/src/or/or.h
+++ b/src/or/or.h
@@@ -2345,9 -2345,6 +2345,9 @@@ typedef struct 
    config_line_t *Logs; /**< New-style list of configuration lines
                          * for logs */
  
 +  int LogMessageDomains; /**< Boolean: Should we log the domain(s) in which
 +                          * each log message occurs? */
 +
    char *DebugLogFile; /**< Where to send verbose log messages. */
    char *DataDirectory; /**< OR only: where to store long-term data. */
    char *Nickname; /**< OR only: nickname of this onion router. */
@@@ -2841,11 -2838,6 +2841,11 @@@
     */
    double CircuitPriorityHalflife;
  
 +  /** Set to true if the TestingTorNetwork configuration option is set.
 +   * This is used so that options_validate() has a chance to realize that
 +   * the defaults have changed. */
 +  int _UsingTestNetworkDefaults;
 +
  } or_options_t;
  
  /** Persistent state for an onion router, as saved to disk. */
@@@ -2877,25 -2869,19 +2877,25 @@@ typedef struct 
     * bandwidth usage. The "Interval" fields hold the granularity, in seconds,
     * of the entries of Values.  The "Values" lists hold decimal string
     * representations of the number of bytes read or written in each
 -   * interval. */
 +   * interval. The "Maxima" list holds decimal strings describing the highest
 +   * rate achieved during the interval.
 +   */
    time_t      BWHistoryReadEnds;
    int         BWHistoryReadInterval;
    smartlist_t *BWHistoryReadValues;
 +  smartlist_t *BWHistoryReadMaxima;
    time_t      BWHistoryWriteEnds;
    int         BWHistoryWriteInterval;
    smartlist_t *BWHistoryWriteValues;
 +  smartlist_t *BWHistoryWriteMaxima;
    time_t      BWHistoryDirReadEnds;
    int         BWHistoryDirReadInterval;
    smartlist_t *BWHistoryDirReadValues;
 +  smartlist_t *BWHistoryDirReadMaxima;
    time_t      BWHistoryDirWriteEnds;
    int         BWHistoryDirWriteInterval;
    smartlist_t *BWHistoryDirWriteValues;
 +  smartlist_t *BWHistoryDirWriteMaxima;
  
    /** Build time histogram */
    config_line_t * BuildtimeHistogram;
@@@ -3513,6 -3499,7 +3513,7 @@@ typedef enum was_router_added_t 
    ROUTER_NOT_IN_CONSENSUS = -3,
    ROUTER_NOT_IN_CONSENSUS_OR_NETWORKSTATUS = -4,
    ROUTER_AUTHDIR_REJECTS = -5,
+   ROUTER_WAS_NOT_WANTED = -6
  } was_router_added_t;
  
  /********************************* routerparse.c ************************/

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits