Commit Graph

706 Commits

Author SHA1 Message Date
Nick Mathewson a052f1232b Merge remote-tracking branch 'origin/mr/9' into main 2020-12-29 15:00:28 -05:00
Nick Mathewson df55817473 cargo fix --edition-idioms 2020-12-29 14:56:48 -05:00
George Kadianakis 4962128b0e dirmgr: Handle another error in download_mds().
Co-authored-by: David Goulet <dgoulet@torproject.org>
2020-12-23 15:38:16 +02:00
George Kadianakis a02de2010e dirmgr: Handle some errors in download_mds().
Co-authored-by: David Goulet <dgoulet@torproject.org>
2020-12-23 15:37:44 +02:00
Nick Mathewson 2e5f694503 Cleanup on DirInfo::circ_params. 2020-12-22 16:17:35 -05:00
Nick Mathewson dd0c866090 Implement the "circwindow" and "ExtendByEd25519ID" parameters
These necessitated a little complexity for our circuit
creation/extension API; we might want to refactor that down the
road.
2020-12-22 16:02:49 -05:00
Nick Mathewson f132c15cd1 Remove some now unused methods from NetParams. 2020-12-22 15:21:53 -05:00
Nick Mathewson f3ad295224 Expose network parameters more sensibly from NetDir. 2020-12-22 15:20:07 -05:00
Nick Mathewson cc2a5d94ef Migrate from lazy_static to once_cell. 2020-12-22 11:55:41 -05:00
Nick Mathewson 9341cde18c Use typesystem to enforce limit on socks hostname length. 2020-12-22 09:57:32 -05:00
Nick Mathewson cbd9755c1f When a stream read fails, block writes too.
Closes arti#49.
2020-12-22 09:39:29 -05:00
Nick Mathewson df4524d936 Check ipv6 exit policies when trying to connect to an ipv6 port specifically 2020-12-22 09:28:26 -05:00
Nick Mathewson 87cb44a4e5 Basic test for tor-dirclient::util 2020-12-21 11:57:10 -05:00
Nick Mathewson 216348a06e tor-socksproto: a few more tests 2020-12-21 10:47:45 -05:00
Nick Mathewson ccd6cbf627 upgrade to latest anyhow 2020-12-21 10:21:24 -05:00
Nick Mathewson 5057cbc12f Cargo-upgrade a few dependencies 2020-12-21 10:18:41 -05:00
Nick Mathewson 1a1ff2a45a Add a fuzzer for tor-socksproto. 2020-12-17 17:09:52 -05:00
Nick Mathewson 9680a99205 socksproto: fuze the handshake object on error.
Found by fuzzing: without doing this, there are ways to make the
SocksHandshake panic.  I don't think any of them are reachable from
the network assuming this crate is used correctly, but let's be safer.
2020-12-17 17:05:50 -05:00
Nick Mathewson 0222477cf8 Run cargo fmt 2020-12-17 16:04:37 -05:00
Nick Mathewson 8b5630e6b1 Merge branch 'mr_1_squashed' into main 2020-12-17 16:04:27 -05:00
Nick Mathewson 42db4210ab Simplification: Every relay is in the same family as itself. 2020-12-17 15:32:09 -05:00
Nick Mathewson f1eba83ebd Fix a few clippy warnings 2020-12-17 15:23:55 -05:00
Nick Mathewson 05ae2148bc Merge remote-tracking branch 'origin/mr/8' into main 2020-12-17 15:18:54 -05:00
Nick Mathewson 2678846fb8 Merge remote-tracking branch 'origin/mr/6' into main 2020-12-17 15:13:39 -05:00
Nick Mathewson e470f641f1 Merge remote-tracking branch 'origin/mr/7' into main 2020-12-17 15:12:08 -05:00
Nick Mathewson 31aa73c022 Download and use consensus diffs.
Had to refactor a few methods for database access, and fix a bug
where we were storing valid_until times with the wrong information.
2020-12-17 15:08:53 -05:00
Nick Mathewson edbd564b09 Add a function to see if a document looks like a diff. 2020-12-17 15:06:49 -05:00
Nick Mathewson 5c92517245 Whoops: add fuzzers code. 2020-12-17 15:05:58 -05:00
George Kadianakis e4594810fc Handle an error in circuit.rs without crashing. 2020-12-17 21:16:49 +02:00
George Kadianakis 52afa87ecd Simplify RelayCellBody::recognized() method.
self is no longer mutable.

Co-authored-by: David Goulet <dgoulet@torproject.org>
2020-12-17 21:16:43 +02:00
Gaba 57fadaf301 Adds issue creation templates for bugs, features, proposals and documentation. 2020-12-17 13:57:06 -03:00
Nick Mathewson 6f62f9c5dc Mention tor-consdiff in list of crates 2020-12-17 10:52:18 -05:00
Nick Mathewson 3c2977c5dc consdiff: disallow usize::MAX as a line number.
This prevents some overflow cases; found by fuzzing.
2020-12-17 10:50:05 -05:00
Nick Mathewson a44a228d1a Add a fuzzer to tor-consdiff
This fuzzer checks both implementations and makes sure they give
the same result.
2020-12-17 10:27:49 -05:00
Nick Mathewson 1dc3b40336 consdiff: move responsibility for checking sort order into iterator 2020-12-17 09:26:36 -05:00
Nick Mathewson c4508f7ae0 More tests for tor-consdiff. 2020-12-17 09:08:42 -05:00
Nick Mathewson 65526fe7f5 tor-consdiff: document everything. 2020-12-17 08:31:58 -05:00
Nick Mathewson 059e9e96d7 consdiff: use real error messages 2020-12-17 07:29:49 -05:00
Nick Mathewson fce00005db consdiff: extract Error type to new module. 2020-12-17 07:12:43 -05:00
Nick Mathewson a9a62b8b76 Make the O(n^2) slow diff-apply algorithm off-by-default. 2020-12-16 17:30:45 -05:00
Nick Mathewson 867c4aac88 Handle the headers on our diff format correctly. 2020-12-16 16:49:50 -05:00
Nick Mathewson 3a92522e7b Implement the O(n) algorithm for applying diffs 2020-12-16 16:33:58 -05:00
Nick Mathewson f3e130c62a Initial work on client-side consensus diff code. 2020-12-16 15:47:00 -05:00
Lunar 42f0d294de Make sure that a circuit doesn't use relays in the same family
We implement `Relay::in_same_family` which is in turn used by
`ExitPathBuilder::pick_path` to avoid picking relays in the
same family.

Compared to the original C implementation, we are missing
support for options EnforceDistinctSubnets and NodeFamilySets.

This has only been very lightly tested so far.

Closes: #43
2020-12-16 16:34:59 +01:00
Nick Mathewson 635cdc06d8 Write a few misc unit tests 2020-12-15 15:34:08 -05:00
Nick Mathewson cae16665cb Basic support for IPv6 and begin flags.
We now have a way to tell a circuitmgr whether we require ipv4/ipv6
support for a target address in an exit policy, and we use similar
logic to set begin flags.
2020-12-15 14:41:03 -05:00
Nick Mathewson affe5c5c53 Use a set of named flags for BeginFlags in tor-cell. 2020-12-15 14:08:36 -05:00
Nick Mathewson a8a35c9914 dirmgr: Refactor so it has no unusable state.
With this new API, if you have a DirMgr, it has a NetDir that was
bootstrapped, and was live at least once during your program's
execution.
2020-12-15 11:57:24 -05:00
Nick Mathewson d408cf0f4b Implement a notion of "circuit dirtiness", as in Tor. 2020-12-15 11:37:17 -05:00
Nick Mathewson 6a42ba718f Fix some clippy warnings. 2020-12-15 08:37:23 -05:00