Commit Graph

3038 Commits

Author SHA1 Message Date
Nick Mathewson 7ce92230eb First attempt at a changelog for 0.2.0 2022-04-01 08:36:59 -04:00
Nick Mathewson 95237e63ce Upgrade async-broadcast => 0.4.0 2022-04-01 08:10:38 -04:00
Nick Mathewson 8393a341e7 Final "cargo update" before 0.2.0 2022-04-01 08:05:38 -04:00
Nick Mathewson 9190dfea77 Upgrade rlimit -> 0.8.0 2022-04-01 08:03:30 -04:00
Nick Mathewson 259622bc3a Merge branch 'dir-munger-v2' into 'main'
Implement a directory munger to simulate pathological cases in arti-testing (v2)

Closes #397

See merge request tpo/core/arti!442
2022-03-31 15:43:28 +00:00
Nick Mathewson 0725e388a5 Re-order attributes so that we can build with Rust 1.53. 2022-03-31 11:11:02 -04:00
Ian Jackson 68b614ade1 Typo fix. 2022-03-31 14:34:11 +00:00
Nick Mathewson e98aa50e72 Directory filtering in arti-testing.
This feature allows us to detect different failing cases for
arti#329 that would otherwise be hard to induce.  It works by
filtering consensus directory objects and/or microdescriptor objects
before introducing them to the directory manager.

Closes #397.
2022-03-31 09:27:27 -04:00
Nick Mathewson b1b7ef00a0 tor-netdoc: Conditionally expose document fields.
This commit uses the `visibility` and `visible` crates to
conditionally make certain structs and their fields public
(respectively).  This is incredibly dangerous to use for anything
besides testing, and I've tried to write the documentation for the
feature accordingly.
2022-03-31 09:27:27 -04:00
Nick Mathewson a461ddc916 Merge branch 'retry_tuning_1' into 'main'
Minor retry tuning to improve behavior under failing conditions.

See merge request tpo/core/arti!439
2022-03-31 12:37:33 +00:00
Nick Mathewson 8a7833dc7e tor-checkable: add experimental api for exposing wrapped objects. 2022-03-31 08:33:27 -04:00
Nick Mathewson 63e366cc8f Reformat tor-checkable/Cargo.toml 2022-03-31 08:33:18 -04:00
Nick Mathewson c5e5fc1553 dirmgr: Use a different idiom in retry loop
Replace the next delay field immediately rather than taking it and
_then_ setting it.  This way, it's never in an incorrect state.
2022-03-31 08:07:50 -04:00
Ian Jackson e6cfbf582e Merge branch 'typos' into 'main'
Fix typo

See merge request tpo/core/arti!441
2022-03-31 10:02:27 +00:00
Dimitris Apostolou ff53886b61
Fix typo 2022-03-30 22:47:33 +03:00
Nick Mathewson 432bb5ce62 Use a lower default for max_retries.
The older default seems (experimentally) to be ridiculously high.
Generally, if we can't build a circuit within a handful attempts,
that circuit has already timed out... unless there is a fast-failure
condition, in which case we're just hammering the network (or our
view of it.)

Found with `arti-testing` for #329.
2022-03-30 14:22:28 -04:00
Nick Mathewson bd798764a4 circmgr: limit circuit attempts when launch_parallelism > 1.
Previously, if we had launch_parallelism > 1, and we were willing to
retry building a circuit max_retries times, then we'd launch up to
max_retries * launch_parallelism circuits before giving up.  Ouch!

With this patch, we try to keep the total number of circuits
planned and attempted to the actual max_retries limit.

Part of #329; found with arti-testing.
2022-03-30 14:14:52 -04:00
Nick Mathewson 6e8c982ab5 dirmgr: fix bugs in algorithm for retrying downloads
The previous algorithm had two flaws:

  * It would wait even after the final attempt, when there were no
    more retries to do.
  * It would fail to wait between attempts if an error occurred.

This refactoring fixes both of these issues, and adds some comments.
2022-03-30 13:56:36 -04:00
Nick Mathewson 849371c1d3 README.md for arti-testing. 2022-03-30 13:41:04 -04:00
Ian Jackson c8d9ae4535 Merge branch 'fallback_status_v2' into 'main'
Refactor FallbackDir handling and implement a retry-after-delay mechanism.

Closes #406 and #220

See merge request tpo/core/arti!433
2022-03-30 16:25:37 +00:00
Ian Jackson 33399bed8b Merge branch 'fallback_status_v2' into main
Manual merge for just this branch as per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/433#note_2791982
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/433#note_2791993
2022-03-30 16:34:01 +01:00
Nick Mathewson 2bb3ba7886 Run cargo fmt one more time for good measure. 2022-03-30 10:41:57 -04:00
Nick Mathewson df3c51c8a0 Use derive_more to derive AsRef. 2022-03-30 10:41:40 -04:00
Nick Mathewson 5233d35223 Reformat tor-guardmgr/Cargo.toml. 2022-03-30 10:41:40 -04:00
Nick Mathewson 1feb7eecac Reformat several Cargo.toml files with 100-char-wide lines. 2022-03-30 10:41:40 -04:00
Nick Mathewson 3e92d30e49 Fix some Rustdoc links. 2022-03-30 10:41:40 -04:00
Nick Mathewson 6282df34fb Refactor FirstHopId into type-differentiated form
The FirstHopId type now records an enum that stores whether the hop
is a guard or a fallback.  This change addresses concerns about
remembering to check the type or source of an Id before passing it
down to the FallbackState or GuardSet.

Making this change required an API change, so that dirmgr can
report success/failure status without actually knowing whether it's
using a fallback or a guard.
2022-03-30 10:41:39 -04:00
Nick Mathewson 13af6134f6 Rename Guard=>FirstHop, GuardId=>FirstHopId
This is preparation for having separate GuardId and FirstHopId types
that distinguish which back-end they index.
2022-03-30 10:40:59 -04:00
Nick Mathewson 9803b645c0 FallbackState: Use itertools::merge_join_by.
This replaces a hand-coded replacement that was probably a little
less efficient.
2022-03-30 10:40:14 -04:00
Nick Mathewson b752c6c771 Fold fallback::Status::reset() into its (only) caller. 2022-03-30 10:40:14 -04:00
Nick Mathewson 9bf2fe3aca Rename FallbackState::lookup_mut => get_mut. 2022-03-30 10:40:14 -04:00
Nick Mathewson b1ccd3c7dc Rename FallbackSet => FallbackState. 2022-03-30 10:40:14 -04:00
Nick Mathewson 951b800988 DirPathBuilder::pick_path: re-order match cases for clarity. 2022-03-30 10:40:14 -04:00
Nick Mathewson 2cf00e63de Refactor select_guard_with_expand to use match and log errors. 2022-03-30 10:40:14 -04:00
Nick Mathewson 578f2925d9 ListKind: Use an exhaustive match to future-proof. 2022-03-30 10:40:14 -04:00
Nick Mathewson c721c8ee53 Clarify documentation about GuardUsable constructors 2022-03-30 10:40:14 -04:00
Nick Mathewson 16ce29ef59 Add a TODO about an unslightly type. 2022-03-30 10:40:14 -04:00
Ian Jackson 82ea251f3c Clean up a rustdoc link 2022-03-30 10:40:14 -04:00
Nick Mathewson b88789d1dd guardmgr::fallback::set: basic unit tests. 2022-03-30 10:40:14 -04:00
Nick Mathewson bdd129f230 Rename ExternalFailure => ExternalActivity. 2022-03-30 10:40:12 -04:00
Nick Mathewson d88e9d676e Replace the fallback directories when they change in the config.
The code here uses a new iterator type, since I couldn't find one of
these on crates.io.  I tried writing the code without it, but it was
harder to follow and test.
2022-03-30 10:39:09 -04:00
Nick Mathewson bfb2353a8f Add status tracking to FallbackDir.
We do this by creating a new FallbackSet type that includes status
information, and updating the GuardMgr APIs to record success and
failure about it when appropriate.  We can use this to mark
FallbackDirs retriable (or not).

With this change, FallbackDir is now stored internally as a Guard in
the GuardMgr crate.  That's fine: the FallbackDir type really only
matters for configuration.
2022-03-30 10:39:09 -04:00
Nick Mathewson ea520898fd Implement Ord for Ed25519Identity. 2022-03-30 10:39:09 -04:00
Nick Mathewson b28863f03d Update semver_status from recent round of movement. 2022-03-30 10:39:09 -04:00
Nick Mathewson e48f4f3a93 dirmgr: do not pass fallbacks to the CircMgr.
This is the final step in allowing the CircMgr to use the GuardMgr's
view of the fallbacks.

Compilation is restored and tests pass.
2022-03-30 10:39:09 -04:00
Nick Mathewson ed6389acc7 circmgr: Use guard-manager's view of the fallbacks when possible.
If we're building a path with the guard manager involved, we now ask
the guard manager to pick our first hop no matter what.  We only
pick from the fallback list ourselves if we're using the API with no
guard manager.

This causes some follow-on changes where we have to remember an
OwnedChanTarget object in a TorPath we've built, and where we gain
the ability to say we're building a path "from nothing extra at
all."  Those are all internal to the crate, though.

Closes #220, by making sure that we use our guards to get a fresh
netdir (if we can) before falling back to any fallbacks, even if our
consensus is old.

Compilation should be fixed in the next commit.
2022-03-30 10:39:09 -04:00
Nick Mathewson 40c8232426 GuardMgr: Return fallback directories when appropriate.
We only do this when we fail to get a regular guard (e.g., because
they're all down), and when we have been asked for a guard for a
one-hop directory.

Most of the change in this commit is plumbing to make all of the
types match up.

As before, compilation may still be broken.
2022-03-30 10:39:09 -04:00
Nick Mathewson 9e31ee0c9b Fix typos in guardmgr/lib.rs 2022-03-30 10:39:09 -04:00
Nick Mathewson a4a5f2163d GuardMgr: some prep work for returning fallbacks as guards.
We need to extend our notion of "the origin of a guard" to include
"somewhere outside the guard list"; we need the ability to return a
FallbackDir as a Guard; and we need to remember a few more pieces of
information in each pending request.

As before, this commit may break compilation; it will be restored soon.
2022-03-30 10:39:09 -04:00
Nick Mathewson 9da43189f3 Turn FallbackList into a real type, and store one in GuardMgr.
The guard manager is responsible for handing out the first hops of
tor circuits, keeping track of their successes and failures, and
remembering their states.  Given that, it makes sense to store this
information here.  It is not yet used; I'll be fixing that in
upcoming commits.

Arguably, this information no longer belongs in the directory
manager: I've added a todo about moving it.

This commit will break compilation on its own in a couple of places;
subsequent commits will fix it up.
2022-03-30 10:39:06 -04:00