1. 04 Sep, 2012 3 commits
    • Linus Nordberg's avatar
      Clients connect to public relays over IPv6. · e04e1a2e
      Linus Nordberg authored and Nick Mathewson's avatar Nick Mathewson committed
      Add ClientUseIPv6 and ClientPreferIPv6ORPort configuration options.
      
      Use "preferred OR port" for all entry nodes, not only for bridges.
      
      Mark bridges with "prefer IPv6 OR port" if an IPv6 address is
      configured in Bridge line and ClientPreferIPv6ORPort is set.
      
      Mark relays with "prefer IPv6 OR port" if an IPv6 address is found in
      descriptor and ClientPreferIPv6ORPort is set.
      
      Filter "preferred OR port" through the ClientUseIPv6 config option. We
      might want to move this test to where actual connection is being set
      up once we have a fall back mechanism in place.
      
      Have only non-servers pick an IPv6 address for the first hop: We
      don't want relays to connect over IPv6 yet. (IPv6 has never been used
      for second or third hops.)
      
      Implements ticket 5535.
      e04e1a2e
    • Linus Nordberg's avatar
      Clear the ipv6_preferred flag like the others. · d6ad00a0
      Linus Nordberg authored and Nick Mathewson's avatar Nick Mathewson committed
      I'm not entirely sure that this is meningful but I'm pretty sure it's
      not harmful. Seems like the logical thing to do.
      d6ad00a0
    • Linus Nordberg's avatar
      Fix a comment. · c76a3328
      Linus Nordberg authored and Nick Mathewson's avatar Nick Mathewson committed
      c76a3328
  2. 27 Aug, 2012 1 commit
  3. 23 Aug, 2012 1 commit
    • Linus Nordberg's avatar
      Move ipv6_preferred from routerinfo_t to node_t. · 3410a46e
      Linus Nordberg authored
      Move extend_info_from_router() from circuitbuild.c to router.c and
      make it static.
      
      Add get_configured_bridge_by_orports_digest() and have
      get_configured_bridge_by_routerinfo() and
      node_is_a_configured_bridge() use it. We now consider all OR ports of
      a bridge when looking for it.
      
      Move node_get_*_orport to nodelist.c.
      
      Fix a cut'n'paste error in header of nodelist.h.
      
      Add node_assert_ok().
      
      Add router_get_all_orports(). It's duplicating code from
      node_get_all_orports(). Worth fixing at the cost of complicating the
      API slightly?
      3410a46e
  4. 19 Jul, 2012 4 commits
  5. 23 Jun, 2012 1 commit
    • Nick Mathewson's avatar
      Catch a few more K&R violations with make check-spaces · a6688c57
      Nick Mathewson authored
      We now catch bare {s that should be on the previous line with a do,
      while, if, or for, and elses that should share a line with their
      preceding }.
      
      That is,
          if (foo)
          {
      and
          if (foo) {
            ...
          }
          else
      
      are now detected.
      
      We should think about maybe making Tor uncrustify-clean some day,
      but configuring uncrustify is an exercise in bizarreness, and
      reformatting huge gobs of Tor is always painful.
      a6688c57
  6. 05 Jun, 2012 1 commit
  7. 18 Jan, 2012 1 commit
    • Nick Mathewson's avatar
      Rename nonconformant identifiers. · 26e789fb
      Nick Mathewson authored
      Fixes bug 4893.
      
      These changes are pure mechanical, and were generated with this
      perl script:
      
        /usr/bin/perl -w -i.bak -p
      
        s/crypto_pk_env_t/crypto_pk_t/g;
        s/crypto_dh_env_t/crypto_dh_t/g;
        s/crypto_cipher_env_t/crypto_cipher_t/g;
        s/crypto_digest_env_t/crypto_digest_t/g;
      
        s/aes_free_cipher/aes_cipher_free/g;
        s/crypto_free_cipher_env/crypto_cipher_free/g;
        s/crypto_free_digest_env/crypto_digest_free/g;
        s/crypto_free_pk_env/crypto_pk_free/g;
      
        s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g;
        s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g;
        s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g;
        s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g;
      
        s/crypto_new_cipher_env/crypto_cipher_new/g;
        s/crypto_new_digest_env/crypto_digest_new/g;
        s/crypto_new_digest256_env/crypto_digest256_new/g;
        s/crypto_new_pk_env/crypto_pk_new/g;
      
        s/crypto_create_crypto_env/crypto_cipher_new/g;
      
        s/connection_create_listener/connection_listener_new/g;
        s/smartlist_create/smartlist_new/g;
        s/transport_create/transport_new/g;
      26e789fb
  8. 30 Nov, 2011 5 commits
  9. 28 Sep, 2011 2 commits
  10. 07 Jul, 2011 1 commit
    • Nick Mathewson's avatar
      Make nodelist_purge avoid orphaned microdescs in rs-less nodes · a4d339cf
      Nick Mathewson authored
      We have an invariant that a node_t should have an md only if it has
      a routerstatus.  nodelist_purge tried to preserve this by removing
      all nodes without a routerstatus or a routerinfo.  But this left
      nodes with a routerinfo and a microdesc untouched, even if they had
      a routerstatus.
      
      Bug found by frosty_un.
      a4d339cf
  11. 14 Jun, 2011 1 commit
    • Nick Mathewson's avatar
      Make the get_options() return const · 47c8433a
      Nick Mathewson authored
      This lets us make a lot of other stuff const, allows the compiler to
      generate (slightly) better code, and will make me get slightly fewer
      patches from folks who stick mutable stuff into or_options_t.
      
      const: because not every input is an output!
      47c8433a
  12. 08 Jun, 2011 1 commit
  13. 12 May, 2011 1 commit
    • Nick Mathewson's avatar
      Track where microdescs are referenced to prevent free errs · 4ba9f3e3
      Nick Mathewson authored
      On IRC, wanoskarnet notes that if we ever do microdesc_free() on a
      microdesc that's in the nodelist, we're in trouble.  Also, we're in
      trouble if we free one that's still in the microdesc_cache map.
      
      This code adds a flag to microdesc_t to note where the microdesc is
      referenced from, and checks those flags from microdesc_free().  I
      don't believe we have any errors here now, but if we introduce some
      later, let's log and recover from them rather than introducing
      heisenbugs later on.
      
      Addresses bug 3153.
      4ba9f3e3
  14. 11 May, 2011 2 commits
  15. 03 Jan, 2011 1 commit
  16. 21 Oct, 2010 2 commits
  17. 14 Oct, 2010 2 commits
  18. 05 Oct, 2010 1 commit
  19. 01 Oct, 2010 8 commits
    • Nick Mathewson's avatar
      More debugging code for node_t branch · b9f2ccbd
      Nick Mathewson authored
      b9f2ccbd
    • Nick Mathewson's avatar
    • Nick Mathewson's avatar
      Implement a few more node-based functions · b5341314
      Nick Mathewson authored
      Some of these functions only work for routerinfo-based nodes, and as
      such are only usable for advisory purposes.  Fortunately, our uses
      of them are compatible with this limitation.
      b5341314
    • Nick Mathewson's avatar
      Implement node-based router family code · f9ea242a
      Nick Mathewson authored
      Also, make the NodeFamily option into a list of routersets.  This
      lets us git rid of router_in_nickname_list (or whatever it was
      called) without porting it to work with nodes, and also lets people
      specify country codes and IP ranges in NodeFamily
      f9ea242a
    • Nick Mathewson's avatar
      Rename routerstatus_t.is_running to is_flagged_running · 45f1e4d5
      Nick Mathewson authored
      This was the only flag in routerstatus_t that we would previously
      change in a routerstatus_t in a consensus. We no longer have reason
      to do so -- and probably never did -- as you can now confirm more
      easily than you could have done by grepping for is_running before
      this patch.
      
      The name change is to emphasize that the routerstatus_t is_running
      flag is only there to tell you whether the consensus says it's
      running, not whether it *you* think it's running.
      45f1e4d5
    • Nick Mathewson's avatar
      Initial conversion to use node_t throughout our codebase. · 26e89742
      Nick Mathewson authored
      A node_t is an abstraction over routerstatus_t, routerinfo_t, and
      microdesc_t.  It should try to present a consistent interface to all
      of them.  There should be a node_t for a server whenever there is
        * A routerinfo_t for it in the routerlist
        * A routerstatus_t in the current_consensus.
      (note that a microdesc_t alone isn't enough to make a node_t exist,
      since microdescriptors aren't usable on their own.)
      
      There are three ways to get a node_t right now: looking it up by ID,
      looking it up by nickname, and iterating over the whole list of
      microdescriptors.
      
      All (or nearly all) functions that are supposed to return "a router"
      -- especially those used in building connections and circuits --
      should return a node_t, not a routerinfo_t or a routerstatus_t.
      
      A node_t should hold all the *mutable* flags about a node.  This
      patch moves the is_foo flags from routerinfo_t into node_t.  The
      flags in routerstatus_t remain, but they get set from the consensus
      and should not change.
      
      Some other highlights of this patch are:
      
        * Looking up routerinfo and routerstatus by nickname is now
          unified and based on the "look up a node by nickname" function.
          This tries to look only at the values from current consensus,
          and not get confused by the routerinfo_t->is_named flag, which
          could get set for other weird reasons.  This changes the
          behavior of how authorities (when acting as clients) deal with
          nodes that have been listed by nickname.
      
        * I tried not to artificially increase the size of the diff here
          by moving functions around.  As a result, some functions that
          now operate on nodes are now in the wrong file -- they should
          get moved to nodelist.c once this refactoring settles down.
          This moving should happen as part of a patch that moves
          functions AND NOTHING ELSE.
      
        * Some old code is now left around inside #if 0/1 blocks, and
          should get removed once I've verified that I don't want it
          sitting around to see how we used to do things.
      
      There are still some unimplemented functions: these are flagged
      with "UNIMPLEMENTED_NODELIST()."  I'll work on filling in the
      implementation here, piece by piece.
      
      I wish this patch could have been smaller, but there did not seem to
      be any piece of it that was independent from the rest.  Moving flags
      forces many functions that once returned routerinfo_t * to return
      node_t *, which forces their friends to change, and so on.
      26e89742
    • Nick Mathewson's avatar
      6dd7f85b
    • Nick Mathewson's avatar
      Implement a basic node and nodelist type · fe309e7a
      Nick Mathewson authored
      The node_t type is meant to serve two key functions:
      
        1) Abstracting difference between routerinfo_t and microdesc_t
           so that clients can use microdesc_t instead of routerinfo_t.
      
        2) Being a central place to hold mutable state about nodes
           formerly held in routerstatus_t and routerinfo_t.
      
      This patch implements a nodelist type that holds a node for every
      router that we would consider using.
      fe309e7a