Skip to content
Snippets Groups Projects
  1. Jun 07, 2023
  2. Jan 18, 2022
  3. Nov 09, 2021
  4. Oct 20, 2021
  5. May 11, 2021
  6. Apr 13, 2021
  7. Mar 17, 2021
    • George Kadianakis's avatar
      Implement backbone of overload statistics. · 0a5ecb33
      George Kadianakis authored
      - Implement overload statistics structure.
      - Implement function that keeps track of overload statistics.
      - Implement function that writes overload statistics to descriptor.
      - Unittest for the whole logic.
      0a5ecb33
  8. Mar 12, 2021
  9. Feb 22, 2021
  10. Feb 10, 2021
    • David Goulet's avatar
      relay: Don't look at omit flag when building descriptor · 5138a9c3
      David Goulet authored
      
      That comes from 685c4866 which added that
      check correctly except for when we build a descriptor.
      
      We already omit the IPv6 address, if we need to, when we encode the descriptor
      but we need to keep the actual discovered address in the descriptor so we can
      notice future IP changes and be able to assess that we are not publishable as
      long as we don't specifically set the omit flag.
      
      This lead to also having tor noticing that our IP changed from <nothing> (no
      IPv6 in the descriptor) to a discovered one which would trigger every minute.
      
      Fixes #40279, #40288
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      5138a9c3
  11. Feb 08, 2021
  12. Jan 27, 2021
  13. Jan 14, 2021
    • David Goulet's avatar
      relay: Don't flag that we published if descriptor build fails · 743a5ef2
      David Goulet authored
      
      In case building the descriptor would fail, we could still flag that we did in
      fact publish the descriptors leading to no more attempt at publishing it which
      in turn makes the relay silent for some hours and not try to rebuild the
      descriptor later.
      
      This has been spotted with #40231 because the operator used a localhost
      address for the ORPort and "AssumeReachable 1" leading to this code path where
      the descriptor failed to build but all conditions to "can I publish" were met.
      
      Related to #40231
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      743a5ef2
  14. Dec 21, 2020
    • Karsten Loesing's avatar
      Fix timestamp parser in new load_stats_file. · 5dd6304f
      Karsten Loesing authored and Nick Mathewson's avatar Nick Mathewson committed
      The previous parser only considered stats files _starting_ with the
      timestamp tag, not stats files having the timestamp tag in a later
      position. While this applies to all current stats files, a future
      stats file might look differently. Better to fix the function now than
      be surprised in another 9 years from now.
      
      This commit also adds a test case for such future stats, and it fixes
      stats file paths in newly added unit tests.
      5dd6304f
    • David Goulet's avatar
      relay: Report the entire content of a stats file · c934fced
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      It turns out that 9 years ago, we stopped appending data into stats file and
      rather overwrite everytime we have new stats (see commit
      a6a127c8)
      
      The load_stats_file() function was still thinking that we could have the same
      line many times in the file which turns out to be false since 9 years ago.
      However, that did not cause problem until IPv6 connection stats came along
      which introduced a new line in conn-stats: "ipv6-conn-bi-direct ...".
      
      Before, that file contained a single line starting with the tag
      "conn-bi-direct".  That very tag appears also in the IPv6 tag (see above) so
      the load_stats_file() function would consider that the IPv6 line as the last
      tag to be appeneded to the file and fail to report the line above (for IPv4).
      It would actually truncate the IPv6 line and report it (removing the "ipv6-"
      part).
      
      In other words, "conn-bi-direct" was not reported and instead
      "ipv6-conn-bi-direct" was used without the "ipv6-" part.
      
      This commit refactors the entire function so that now it looks for a
      "timestamp tag" to validate and then if everything is fine, returns the entire
      content of the file. The refactor simplifies the function, adds logging in
      case of failures and modernize it in terms of coding standard.
      
      Unit tests are also added that makes sure the loaded content matches the
      entire file if timestamp validation passes.
      
      Fixes #40226
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      c934fced
  15. Dec 09, 2020
  16. Nov 17, 2020
    • David Goulet's avatar
      relay: Launch dummy circuit only when descriptor build fails · bc5f26ff
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      First, this commit moves the launch_dummy_circuit_as_needed() function into
      relay_find_addr.c and renames it to relay_addr_learn_from_dirauth(). This is
      an attempt to centralize anything relate with address discovery in the right
      module.
      
      Second, when building a descriptor and we fail to discover our address,
      immediately launch a dummy circuit to an authority in an attempt to learn our
      descriptor.
      
      It is still only done every 20 minutes even though the descriptor build is
      done every minute. We ought to avoid load on the authority and if we can't
      learn in the first place our address from them, chances are more things are
      wrong.
      
      Related to #40071
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      bc5f26ff
    • David Goulet's avatar
      relay: Look at our cache when looking for an IP change · a5538a36
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      Regularly, tor looks if its IP has changed. It does the entire auto discovery
      process again. However, it is possible that it does not find anything.
      
      Instead of thinking the IP changed to an unknown address, look at our cache
      and see if that value has changed.
      
      The reason for this is because if tor gets its address as a suggestion from a
      directory authority, it is because the auto discovery failed and thus that
      address should be consider for the IP change check.
      
      Related to #40071
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      a5538a36
  17. Nov 03, 2020
  18. Oct 27, 2020
  19. Oct 01, 2020
  20. Sep 22, 2020
    • Nick Mathewson's avatar
      Fix warnings when using two unusual options together. · 88d99fc1
      Nick Mathewson authored
      The option `--enable-all-bugs-are-fatal` when used with
      `--disable-module-relay` caused GCC to warn about functions that
      it thought should be labeled noreturn.
      
      I've tried a couple of approaches, but disabling the warning on
      these functions seems to be the best approach.
      
      Fixed #40129; bugfix on 0.4.4.1-alpha.
      88d99fc1
  21. Aug 25, 2020
    • Nick Mathewson's avatar
      Validate address more carefully when checking self-reachability · 75772ea0
      Nick Mathewson authored
      Previously, we would treat *any* incoming circuit on a non-local
      channel as meaning that our ORPort was reachable.  With this patch,
      we make sure that the address that the peer _says_ we have is the
      same as the one we're trying to advertise right now.
      
      Closes 20165. Bugfix on 4f5192b2 in 0.1.0.1-rc, when
      reachability self-tests were first introduced.
      75772ea0
  22. Aug 14, 2020
  23. Jul 30, 2020
  24. Jul 24, 2020
  25. Jul 23, 2020
  26. Jul 22, 2020
  27. Jul 21, 2020
    • David Goulet's avatar
      relay: Change router_can_extend_over_ipv6() to look at configured port · 28c1b604
      David Goulet authored
      
      In routerconf_find_ipv6_or_ap(), we check if the returned ORPort is internal
      but not for listening. This means that IPv6 [::] is considered internal.
      
      Thus, we can't use it, we have to look directly at the configured address and
      port and if they are valid, we do consider that we have a valid IPv6 ORPort
      and that we can thus extend in IPv6.
      
      Related #33246
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      28c1b604
    • Nick Mathewson's avatar
      Rename router_get_advertised_*() functions. · 088100d6
      Nick Mathewson authored
      These now (or_port and dir_port) now have "find" names, since they
      look at the portcfg first, then at the actual ports from the
      listeners.
      
      This is an automated commit, generated by this command:
      
      ./scripts/maint/rename_c_identifier.py \
              router_get_advertised_or_port routerconf_find_or_port \
              router_get_advertised_ipv6_or_ap routerconf_find_ipv6_or_ap \
              router_has_advertised_ipv6_orport routerconf_has_ipv6_orport \
              router_get_advertised_dir_port routerconf_find_dir_port
      088100d6
    • Nick Mathewson's avatar
    • Nick Mathewson's avatar
      Rename get_primary_dir_port() · 39146383
      Nick Mathewson authored
      Also, remove get_primary_or_port() -- nothing used it.
      39146383
    • Nick Mathewson's avatar
      Rename get_first_advertised_{addr,port}_by_type_af(). · fda9d7f5
      Nick Mathewson authored
      Rationale: these don't actually give the first advertised
      address/port, but instead give us the first such port that we are
      _configured_ to advertise.  Putting them in a portconf_ namespace
      therefore makes sense.
      
      Similarly, there are no other functions that get the first
      configured advertised addr/port, so the "by_type_af()" part is needless.
      
      This is an automated commit, generated by this command:
      
      ./scripts/maint/rename_c_identifier.py \
              get_first_advertised_addr_by_type_af portconf_get_first_advertised_addr \
              get_first_advertised_port_by_type_af portconf_get_first_advertised_port
      fda9d7f5
    • David Goulet's avatar
      relay: Don't publish IPv6 if found ORPort is 0 · fbee4d25
      David Goulet authored
      
      The ORPort can be IPv4Only which means that even if we can auto discover an
      IPv6 address, we should not publish it because it would have an ORPort of 0.
      
      Fixes #40054
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      fbee4d25
  28. Jul 20, 2020
Loading