Commit Graph

2235 Commits

Author SHA1 Message Date
Nick Mathewson 36f6a61f05 Remove some XXXs about zeroizing from tor-proto.
There is now a ticket about this issue in general, at arti#254.
2021-12-07 11:21:48 -05:00
eta a3f2e32485 Merge branch 'bug183a_redux' into 'main'
Squash, refactor, and test !139 (Don't use same family as exit when picking a guard)

Closes #183

See merge request tpo/core/arti!173
2021-12-07 16:01:30 +00:00
eta 85bb40a002 Merge branch 'safe_mul_dur_f64' into 'main'
Use a panic-free function to multiply timeouts.

See merge request tpo/core/arti!175
2021-12-07 15:47:18 +00:00
eta 45b96579b8 Merge branch 'preemptive-config' into 'main'
Allow configurability on preemptive circuits

Closes #245

See merge request tpo/core/arti!164
2021-12-07 15:04:42 +00:00
Neel Chauhan 0e9c2d274e Allow configurability on preemptive circuits 2021-12-07 15:04:41 +00:00
Nick Mathewson d6f628c6b7 Use a panic-free function to multiply timeouts.
Previously we used Duration::mul_f64, which panics if its output is
out-of-range.  That shouldn't actually be possible for the values
we're giving it, but probably it's better to just multiply in a safe
way.

This resolves a couple of XXXXs and therefore relates to #231.
2021-12-06 16:00:17 -05:00
Nick Mathewson d33d7f7fdd tor-netdir: Use reproducible RNG in tests.
The rand crate's documentation says it's not okay to rely on StdRng
having reproducible output.  So instead, let's switch to ChaCha12Rng
instead (which is what StrRng currently uses).
2021-12-06 15:11:03 -05:00
Nick Mathewson 31b385c5b2 Resolve roughly half of the XXXXs.
We want to only use TODO in the codebase for non-blockers, and open
tickets for anything that is a bigger blocker than a TODO.  These
XXXXs seem like definite non-blockers to me.

Part of arti#231.
2021-12-06 15:11:03 -05:00
Nick Mathewson 2909f8f077 Tests for new family-related functions. 2021-12-06 11:26:30 -05:00
Nick Mathewson 2c2f774bd1 Move the "real families" code into tor-netdir.
Just as `in_same_family` is a member of Relay, so the function for
getting all the real family members of a relay should belong in the
same crate.

This change also removes the `family()` accessor: it gives the _claimed_ family rather
 than the _acknlowedged_ family, and is therefore a bit dangerous.

 There's still a hole in this logic; I've noted it in the Limitations
section.  If we get a microdescriptor for a relay in between creating
and using  the guard restriction, it might be omitted from the family
list.
2021-12-06 10:48:27 -05:00
Nick Mathewson cfc31dadd4 Use hashset _inside_ GuardRestriction.
This approach saves us from a linear search when picking guards.
2021-12-06 09:44:56 -05:00
Nick Mathewson e25c2d991e Start a TROUBLESHOOTING.md with known compilation issues. 2021-12-06 09:35:06 -05:00
Nick Mathewson 54971e3c9a Change GuardUsage to have Vec of restrictions.
There's not much reason to use a HashSet here, since we're just
going over the whole list.

This reverts commit 16e8489abb and does a little more
refactoring.
2021-12-06 09:26:32 -05:00
Neel Chauhan b0016682c3 Implement guard family restriction code 2021-12-06 09:05:48 -05:00
Nick Mathewson 9f9bb3e4c1 chutney: Make $target relative to ${CHUTNEY_PATH}
This is per a suggestion from @trinity-1686a.
2021-12-05 16:04:46 -05:00
Nick Mathewson 66d5f73b9c tor-linkspec: Remove redundant method; add more tests.
The redundant method was a `to_owned` that probably shouldn't have
been called that.  It was only used in one place.

The tests should get tor-linkspec's line coverage up above 90%.
2021-12-04 15:42:53 -05:00
Nick Mathewson 214c251e41 Remove the unused "Error" type from caret.
This was a relic of the old, now-unused "caret_enum!" macro.
Removing it gets caret's coverage to 100%.

Yes, technically this is a semver breaker on caret.
2021-12-04 15:13:43 -05:00
Neel Chauhan ac1afe92cc Improve ClientDNSConfig field comments 2021-12-03 10:34:24 -08:00
Neel Chauhan f32a10865e Make DNS fields in arti-client/src/client.rs configurable 2021-12-03 10:28:42 -08:00
Nick Mathewson 68d4070038 Idle hacking: Get 90% coverage in tor-llcrypto
For this one I just wrote some "are things completely broken" tests
for the rand_compat wrappers. These won't detect subtle biases in
the RNGs! They'll only let you know if the wrappers have screwed up
in some way that always sets a given bit to 1 or 0.
2021-12-02 18:58:35 -05:00
Nick Mathewson 04d99ff1d0 Idle hacking to get 90% coverage in arti-config
This is just a matter of writing a few tests for some very easy
functions.
2021-12-02 18:55:30 -05:00
Nick Mathewson 2ee620ec46 Idle hacking to get tor-socksproto line coverage over 90%
This was just a matter of adding a call to one function.
2021-12-02 18:52:58 -05:00
Nick Mathewson d582b1c439 Python does not have quadruple-quote.
Fix a bug in postprocess_coverage.py that stuck a big row of '
characters in its output.
2021-12-02 17:38:27 -05:00
Nick Mathewson 99a046da46 Get tor-units grcov line coverage to 100%
This is mostly a finger exercise, and an experiment in "what does
grcov consider to be coverage".  Here's what I've found out...

* In grcov's eyes, most #[derive(Foo)] lines count as containing code;
  but calling any one derived function counts as calling those lines.

* Unlike with tarpaulin, it is actually possible to reach 100% grcov
  line coverage.  (Tarpaulin likes to pick "}" lines and tell you that
  you never reached them; or sometimes it picks expression
  statements that have the effect of a return, and tells you that
  they're unreached.  Even with these tests, tarpaulin claims that
  the line coverage of tor-units is only 97.3%.)

* In rust, it may be a bit hopeless trying to get high function
  coverage. Even though we've hit every line of the tor-units crate,
  the function coverage from its own tests is only 9.38% (55.41%
  from other crates).  I think this is probably due to derived
  functions, or maybe due to generics getting instantiated?
  I've got no idea; the denominator for the function coverage
  lines fluctuates oddly.
2021-12-02 17:08:22 -05:00
Nick Mathewson 47614ee737 Implement Eq,PartialEq for BoundedInt32. 2021-12-02 16:40:22 -05:00
Nick Mathewson 047f0fb571 Merge remote-tracking branch 'origin/mr/165' 2021-12-02 15:29:04 -05:00
Nick Mathewson b009e31410 When tearing down test net, always tear down test net :)
Previously, if the arti process had died or been killed, we wouldn't
reach the point where we called "chutney stop".
2021-12-02 09:25:28 -05:00
Nick Mathewson ec2245164f Detect and use CHUTNEY_PATH in test scripts.
If the user has CHUTNEY_PATH set, respect that value, rather than
cloning a local chutney.

Also, if we have a local chutney, then update it in case there have
been changes.
2021-12-02 09:22:52 -05:00
eta dbc801f256 Merge branch 'postprocess_coverage' into 'main'
Postprocess coverage index.html with python instead

Closes #249

See merge request tpo/core/arti!163
2021-12-02 10:46:02 +00:00
Neel Chauhan f5362028b4 Remove dir_port from RouterStatusBuilder 2021-12-01 21:51:49 -08:00
Nick Mathewson 14eeff00ef Postprocess coverage index.html with python instead
This change jettisons the awk and ed dependencies and instead uses a
real HTML parser, via the BeautifulSoup library in python.

Using BeautifulSoup lets us do trickier stuff, like actually
extracting the coverage totals and adding our own table, with
per-crate coverage.

The script only does this post-processing when it finds python3; the
script exits with an error if BeautifulSoup isn't installed.
2021-12-01 12:02:53 -05:00
eta a4ec8476a7 Merge branch 'tor-dirmgr' into 'main'
Don't warn in bootstrap_from_config when error is  Error::ManagerDropped

See merge request tpo/core/arti!157
2021-12-01 13:00:39 +00:00
eta 740b798f69 Merge branch 'weightkind-bitflags' into 'main'
tor-netdir: Use bitflags for WeightKind

See merge request tpo/core/arti!161
2021-12-01 13:00:16 +00:00
Neel Chauhan d586925388 tor-netdir: Use bitflags for WeightKind 2021-11-30 15:16:12 -08:00
Nick Mathewson d3aecd5192 Add a semicolon. 2021-11-30 15:43:21 -05:00
Nick Mathewson c2804419ab Add constructor for TorAddr, to enforce port != 0
This makes sure that we're checking for a nonzero port in all cases.
2021-11-30 15:41:19 -05:00
Nick Mathewson 08267147ec Merge remote-tracking branch 'origin/mr/156' 2021-11-30 15:21:02 -05:00
Nick Mathewson c733374693 Merge remote-tracking branch 'origin/mr/154' 2021-11-30 14:12:08 -05:00
Nick Mathewson e2a7289aa7 Add comments about the absence of tap_key in microdesc. 2021-11-30 14:05:13 -05:00
Nick Mathewson 9afe5c09e7 Merge remote-tracking branch 'origin/mr/151' 2021-11-30 14:03:46 -05:00
Nick Mathewson d4ebda8e2a Note non-breaking API change in tor-proto. 2021-11-30 14:00:00 -05:00
Nick Mathewson 8dde60ca60 Merge remote-tracking branch 'origin/mr/160' 2021-11-30 13:57:43 -05:00
Nick Mathewson a49ee4d5f4 Merge remote-tracking branch 'origin/mr/159' 2021-11-30 13:53:53 -05:00
Nick Mathewson bafd56c461 Clear semver_status log now that 0.0.2 is out. 2021-11-30 12:58:29 -05:00
eta 9a94f72e42 Add tests & address review commentary 2021-11-30 16:58:08 +00:00
eta 9d0ede2680 Merge branch 'license' into 'main'
Add MIT and Apache licenses

Closes #243

See merge request tpo/core/arti!152
2021-11-30 14:38:38 +00:00
Nick Mathewson 0c7d83b0cd Add dagon to the acknowledgments section for 0.0.2--no-verify 2021-11-30 09:19:44 -05:00
Nick Mathewson 92c56eaa83 One more "cargo update" before the release. 2021-11-30 09:17:31 -05:00
Nick Mathewson 3b072c5420 Merge branch 'readme_fixes' 2021-11-30 09:12:51 -05:00
dagon 0162ea8210 Example needs to be the same as the readme 2021-11-30 09:09:42 -05:00