Commit Graph

4381 Commits

Author SHA1 Message Date
Nick Mathewson 40eb26e1a7 Fix a pair of bugs in SENDME handling.
The problem is that we would count begin and end cells towards
towards window totals when we are only supposed to count DATA
cells, *and* that we would we send our sendmes one cell too early
(or maybe late?).

Closes #1.
2020-10-09 15:23:26 -04:00
Nick Mathewson b3a809b1e3 Move counts_towards_windows() code into circuit module 2020-10-09 15:07:12 -04:00
Nick Mathewson 68b969773a client-main: Add an option to run a test more than once 2020-10-09 13:10:31 -04:00
Nick Mathewson fe3c79d0d1 add point estimates to TODO 2020-10-09 11:37:45 -04:00
Nick Mathewson 15564bd1b2 check off the deadlock in the todo. 2020-10-09 11:31:03 -04:00
Nick Mathewson 569eff88c4 Split information about circuit hops into inbound and outbound.
Previously the circuit object owned not only the outbound crypto,
but also the inbound crypto and the stream maps.  That's not so
great, since the reactor needs to use the inbound crypto and the
stream maps all the time, whereas the circuit doesn't need them much
(or at all).

Moving these objects to the reactor-owned structure should let us
fix the deadlock case in stream sendme handling, since the circuit
reactor no longer needs to lock the circuit in order to do crypto
and demultiplexing.  It should also speed up the code a bit, since
it doesn't need to grab the circuit lock nearly so often as before.

This change forced me to add a couple of new reactor CtrlMsg values,
since the circuit can no longer add streams and layers directly.  I
think it will still be a performance win, though.
2020-10-09 11:28:09 -04:00
Nick Mathewson 5a8300f0f4 Split client relay crypto into separate directions
I think we should have the reactor task own the reverse crypto and
the circuit own the forward crypto.
2020-10-09 11:28:09 -04:00
Nick Mathewson dfa5e08a33 client-demo:Be louder on reactor failure. 2020-10-09 11:27:52 -04:00
Nick Mathewson 800948c4cb Fix counting rules for circuit-level sendmes. 2020-10-09 11:27:27 -04:00
Nick Mathewson cf882d5a6d Logic error: negate test for sendme cells in counts_towards_windows 2020-10-09 10:11:23 -04:00
Nick Mathewson f2ec2c68e0 Expose --flood and --dl switches on client-demo
These are for testing sendmes.
2020-10-09 09:37:46 -04:00
Nick Mathewson b845d37b3b Add routerdesc examples 2020-10-07 13:48:31 -04:00
Nick Mathewson b3e2086c7b netdoc: more tests for routerdesc parsing 2020-10-07 13:19:17 -04:00
Nick Mathewson 30f8aead6c A few more tests in tor-netdoc 2020-10-07 11:34:12 -04:00
Nick Mathewson 0ba8ab9b9a netdoc: test for signature/key checking func 2020-10-07 10:58:32 -04:00
Nick Mathewson b371a84a26 mdconsensus: add tests for a few accessors 2020-10-06 15:02:55 -04:00
Nick Mathewson 02e5380a73 tests for some failing cases in mdconsensus 2020-10-06 14:12:43 -04:00
Nick Mathewson 580c1ac567 Tokenize: report accurate positions for more parsing errors 2020-10-02 15:25:28 -04:00
Nick Mathewson f89283eaa6 microdesc parsing: tests for bad microdescs 2020-10-02 15:24:00 -04:00
Nick Mathewson ff852df70e tests and fixes for md content parsing 2020-10-02 14:04:03 -04:00
Nick Mathewson 17273d38d9 Make rsa::PublicKey derive Debug. 2020-10-02 14:03:15 -04:00
Nick Mathewson 98b4e004a7 Remove an unwrap() from tor-cert. 2020-10-02 12:05:16 -04:00
Nick Mathewson e0941523eb Use batch verification in client<->relay handshake. 2020-10-02 12:01:46 -04:00
Nick Mathewson 610739c139 Enable batch ed25519 verification. 2020-10-02 11:53:50 -04:00
Nick Mathewson 8c2aae10f7 netdoc: remove some outdated/unused stuff. 2020-10-02 11:21:59 -04:00
Nick Mathewson 1adc6c40fb authcert: test error recovery. 2020-10-02 10:59:55 -04:00
Nick Mathewson 38685d3cc1 Netdoc: use a more bulletproof pattern to prevent infinite loops
Previously our "read a bunch of this kind of document" functions had
a common problem, where they could get into an infinite loop if the
underlying "read this kind of document" function failed without
consuming any tokens.

I _think_ that this error case was unreachable (or else fuzzing
would have found it, right?), but proving that it was unreachable
was a bit fiddly, and I couldn't follow my own arguments about it.

Instead, we just store the position of the reader before we start
reading, and make sure that it has consumed at least some data.  If
it hasn't, then we consume and drop a token before advancing to the
next document.
2020-10-02 10:15:14 -04:00
Nick Mathewson 4a1f319ffe authcert: add tests for several ways certs can fail. 2020-10-02 09:50:47 -04:00
Nick Mathewson 17e82a50c2 authcert: fix an error, and detect mismatched fingerprints 2020-10-02 09:49:27 -04:00
Nick Mathewson e6ba2ac8ed netdoc: rename BadVersion to BadTorVersion for clarity 2020-10-01 10:23:22 -04:00
Nick Mathewson 5ff859b89d improve errors in authcert.rs 2020-10-01 10:21:25 -04:00
Nick Mathewson a5f382aa61 Remove redundant signature check in authcert parsing. 2020-09-30 18:50:31 -04:00
Nick Mathewson d4d3e1c3db More tests on parsing, plus remove dead code. 2020-09-30 18:46:27 -04:00
Nick Mathewson c4d0ffa859 Start on some parser backend tests 2020-09-30 14:20:01 -04:00
Nick Mathewson 035e0422d9 tokenize: accept base64 with funny linewraps. 2020-09-30 14:19:07 -04:00
Nick Mathewson b57692aacd README edits 2020-09-30 10:51:31 -04:00
Nick Mathewson 9cab4e0f14 More tests for tokenize.rs, with some bugfixes 2020-09-30 09:39:52 -04:00
Nick Mathewson 59c46ec27b Start on some tests for parse::tokenize.rs 2020-09-29 17:30:48 -04:00
Nick Mathewson aafef113b3 Add tests for macros module in tor-netdoc.
Also improve output for multi-keyword tokens.
2020-09-29 17:02:56 -04:00
Nick Mathewson beee7a7f2a cargo upgrade 2020-09-29 16:43:16 -04:00
Nick Mathewson d0bed5e647 Throw a rudimentary CLI onto client-demo. 2020-09-29 16:42:27 -04:00
Nick Mathewson 91b7c7b874 Tests and minor debugging in tor_netdoc::types::policy 2020-09-29 11:34:07 -04:00
Nick Mathewson e02cccdf00 More tests for tor_netdoc::types 2020-09-29 10:15:08 -04:00
Nick Mathewson 788e0347cb Move around the modules inside tor-netdoc.
This change just gives them a more logical breakdown into parsing,
documents, and misc other types.
2020-09-29 09:05:17 -04:00
Nick Mathewson b0a53d4d40 Move RelayCell into a more reasonable place. 2020-09-29 08:43:13 -04:00
Nick Mathewson 5844037f89 Remove idmap as needlessly complex. 2020-09-29 08:24:51 -04:00
Nick Mathewson 5bb01ba305 make it work on rust 1.45 2020-09-28 21:57:29 -04:00
Nick Mathewson 8d5957ca4b test vectors for cell crypto. 2020-09-28 21:36:10 -04:00
Nick Mathewson f43db0d048 Mark most of the cell crypto code as crate-local. 2020-09-28 18:20:16 -04:00
Nick Mathewson 56101a0673 Add a round-trip test for cell encryption. 2020-09-28 18:16:30 -04:00