summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-04-05Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-05Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-04-05Merge branch 'ticket25296_032_squashed' into maint-0.3.2Nick Mathewson
2018-04-05PerConnBW{Rate,Burst} docs: do not say consensus param is always setNick Mathewson
Closes ticket 25296; bugfix on 0.2.2.7-alpha when these manpage entries were introduced.
2018-04-05man: Move RephistTrackTime to the server sectionDavid Goulet
Every node in the network uses that value, it is a general server options, not a dirauth specific one. Fixes #25720 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-05Switch to use should_record_bridge_info()Neel Chauhan
Both in geoip_note_client_seen() and options_need_geoip_info(), switch from accessing the options directly to using the should_record_bridge_info() helper function. Fixes #25290 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-05Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-04-05Merge branch 'maint-0.3.1' into maint-0.3.2Nick Mathewson
2018-04-05Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-05Switch Travis to stable rustTaylor Yu
2018-04-05Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-05Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-04-05Merge branch 'maint-0.3.1' into maint-0.3.2Nick Mathewson
2018-04-05Merge branch 'maint-0.2.9' into maint-0.3.1Nick Mathewson
2018-04-05Merge branch 'maint-0.2.5' into maint-0.2.9Nick Mathewson
2018-04-05Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-05Merge remote-tracking branch 'dgoulet/bug25582_033' into maint-0.3.3Nick Mathewson
2018-04-05Merge branch 'bug25679_033_squashed' into maint-0.3.3Nick Mathewson
2018-04-05Fix the default for TOR_RUST_DEPENDENCIESNick Mathewson
By default, we want to look at the crates directory of the submodule, not the toplevel of the submodule. Fixes bug 25679; bugfix on 0.3.3.1-alpha.
2018-04-05Update geoip and geoip6 to the April 3 2018 database.maint-0.2.5Karsten Loesing
2018-04-04man: Add a comment to anchor only optionDavid Goulet
Some anchor don't appear in the final man page so document those so we understand why we do that in the future. Part of #25582 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-04Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-04Merge branch 'bug21394_029_redux' into maint-0.3.3Nick Mathewson
2018-04-04Bug 21394 touchup: Increase DNS attempts to 3Dhalgren
Also don't give up on a resolver as quickly if multiple are configured.
2018-04-03Merge remote-tracking branch 'fristonio/ticket-25645'Nick Mathewson
2018-04-03Fix bug24031 changes fileNick Mathewson
2018-04-03Merge remote-tracking branch 'isis-github/bug24031_r5_squashed'Nick Mathewson
2018-04-03Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-03add a missing wordNick Mathewson
2018-04-03Merge remote-tracking branch 'isis-github/bug24031_r5_squashed_033' into ↵Nick Mathewson
maint-0.3.3
2018-04-03changes: Add changes file for #24031.Isis Lovecruft
(cherry picked from commit 5a8cdec3f8617920f19e3ab7707233ad3f02424f)
2018-04-03changes: Add changes file for #24031.Isis Lovecruft
2018-04-03ticket(25645): remove unused variable n_possible from channel_get_for_extend()Deepesh Pathak
2018-04-02rust: Fix ProtoSet and ProtoEntry to use the same DoS limits as C.Isis Lovecruft
Previously, the limit for MAX_PROTOCOLS_TO_EXPAND was actually being applied in Rust to the maximum number of version (total, for all subprotocols). Whereas in C, it was being applied to the number of subprotocols that were allowed. This changes the Rust to match C's behaviour.
2018-04-02rust: Port all C protover_all_supported tests to Rust.Isis Lovecruft
The behaviours still do not match, unsurprisingly, but now we know where a primary difference is: the Rust is validating version ranges more than the C, so in the C it's possible to call protover_all_supported on a ridiculous version range like "Sleen=0-4294967294" because the C uses MAX_PROTOCOLS_TO_EXPAND to count the number of *subprotocols* whereas the Rust uses it to count the total number of *versions* of all subprotocols.
2018-04-02tests: Run all existing protover tests in both languages.Isis Lovecruft
There's now no difference in these tests w.r.t. the C or Rust: both fail miserably (well, Rust fails with nice descriptive errors, and C gives you a traceback, because, well, C).
2018-04-02tests: Make inline comments in test_protover.c more accurate.Isis Lovecruft
The DoS potential is slightly higher in C now due to some differences to the Rust code, see the C_RUST_DIFFERS tags in src/rust/protover/tests/protover.rs. Also, the comment about "failing at the splitting stage" in Rust wasn't true, since when we split, we ignore empty chunks (e.g. "1--1" parses into "(1,None),(None,1)" and "None" can't be parsed into an integer). Finally, the comment about "Rust seems to experience an internal error" is only true in debug mode, where u32s are bounds-checked at runtime. In release mode, code expressing the equivalent of this test will error with `Err(ProtoverError::Unparseable)` because 4294967295 is too large.
2018-04-02protover: Change protover_all_supported() to return only unsupported.Isis Lovecruft
Previously, if "Link=1-5" was supported, and you asked protover_all_supported() (or protover::all_supported() in Rust) if it supported "Link=3-999", the C version would return "Link=3-999" and the Rust would return "Link=6-999". These both behave the same now, i.e. both return "Link=6-999".
2018-04-02rust: Refactor protover::compute_for_old_tor().Isis Lovecruft
During code review and discussion with Chelsea Komlo, she pointed out that protover::compute_for_old_tor() was a public function whose return type was `&'static CStr`. We both agree that C-like parts of APIs should: 1. not be exposed publicly (to other Rust crates), 2. only be called in the appropriate FFI code, 3. not expose types which are meant for FFI code (e.g. `*mut char`, `CString`, `*const c_int`, etc.) to the pure-Rust code of other crates. 4. FFI code (e.g. things in `ffi.rs` modules) should _never_ be called from pure-Rust, not even from other modules in its own crate (i.e. do not call `protover::ffi::*` from anywhere in `protover::protoset::*`, etc). With that in mind, this commit makes the following changes: * CHANGE `protover::compute_for_old_tor()` to be visible only at the `pub(crate)` level. * RENAME `protover::compute_for_old_tor()` to `protover::compute_for_old_tor_cstr()` to reflect the last change. * ADD a new `protover::compute_for_old_tor()` function wrapper which is public and intended for other Rust code to use, which returns a `&str`.
2018-04-02rust: Refactor Rust implementation of protover_is_supported_here().Isis Lovecruft
It was changed to take borrows instead of taking ownership. * REFACTOR `protover::ffi::protover_is_supported_here()` to use changed method signature on `protover::is_supported_here()`.
2018-04-02rust: Refactor Rust impl of protover_compute_vote().Isis Lovecruft
This includes a subtle difference in behaviour to the previous Rust implementation, where, for each vote that we're computing over, if a single one fails to parse, we skip it. This now matches the current behaviour in the C implementation. * REFACTOR `protover::ffi::protover_compute_vote()` to use new types and methods.
2018-04-02rust: Refactor Rust impl of protover_list_supports_protocol_or_later().Isis Lovecruft
This includes a subtle difference in behaviour, as in 4258f1e18, where we return (matching the C impl's return behaviour) earlier than before if parsing failed, saving us computation in parsing the versions into a protover::protoset::ProtoSet. * REFACTOR `protover::ffi::protover_list_supports_protocol_or_later()` to use new types and methods.
2018-04-02rust: Refactor Rust impl of protover_list_supports_protocol().Isis Lovecruft
This includes a subtle difference in behaviour, as in 4258f1e18, where we return (matching the C impl's return behaviour) earlier than before if parsing failed, saving us computation in parsing the versions into a protover::protoset::ProtoSet. * REFACTOR `protover::ffi::protover_list_supports_protocol()` to use new types and methods.
2018-04-02rust: Refactor Rust impl of protover_all_supported().Isis Lovecruft
This includes differences in behaviour to before, which should now more closely match the C version: - If parsing a protover `char*` from C, and the string is not parseable, this function will return 1 early, which matches the C behaviour when protocols are unparseable. Previously, we would parse it and its version numbers simultaneously, i.e. there was no fail early option, causing us to spend more time unnecessarily parsing versions. * REFACTOR `protover::ffi::protover_all_supported()` to use new types and methods.
2018-04-02rust: Refactor protover tests with new methods; note altered behaviours.Isis Lovecruft
Previously, the rust implementation of protover considered an empty string to be a valid ProtoEntry, while the C version did not (it must have a "=" character). Other differences include that unknown protocols must now be parsed as `protover::UnknownProtocol`s, and hence their entries as `protover::UnvalidatedProtoEntry`s, whereas before (nearly) all protoentries could be parsed regardless of how erroneous they might be considered by the C version. My apologies for this somewhat messy and difficult to read commit, if any part is frustrating to the reviewer, please feel free to ask me to split this into smaller changes (possibly hard to do, since so much changed), or ask me to comment on a specific line/change and clarify how/when the behaviours differ. The tests here should more closely match the behaviours exhibited by the C implementation, but I do not yet personally guarantee they match precisely. * REFACTOR unittests in protover::protover. * ADD new integration tests for previously untested behaviour. * FIXES part of #24031: https://bugs.torproject.org/24031.
2018-04-02rust: Refactor protover::is_supported_here().Isis Lovecruft
This changes `protover::is_supported_here()` to be aware of new datatypes (e.g. don't call `.0` on things which are no longer tuple structs) and also changes the method signature to take borrows, making it faster, threadable, and easier to read (i.e. the caller can know from reading the function signature that the function won't mutate values passed into it). * CHANGE the `protover::is_supported_here()` function to take borrows. * REFACTOR the `protover::is_supported_here()` function to be aware of new datatypes. * FIXES part of #24031: https://bugs.torproject.org/24031
2018-04-02rust: Add new ProtoverVote type and refactor functions to methods.Isis Lovecruft
This adds a new type for votes upon `protover::ProtoEntry`s (technically, on `protover::UnvalidatedProtoEntry`s, because the C code does not validate based upon currently known protocols when voting, in order to maintain future-compatibility), and converts several functions which would have operated on this datatype into methods for ease-of-use and readability. This also fixes a behavioural differentce to the C version of protover_compute_vote(). The C version of protover_compute_vote() calls expand_protocol_list() which checks if there would be too many subprotocols *or* expanded individual version numbers, i.e. more than MAX_PROTOCOLS_TO_EXPAND, and does this *per vote* (but only in compute_vote(), everywhere else in the C seems to only care about the number of subprotocols, not the number of individual versions). We need to match its behaviour in Rust and ensure we're not allowing more than it would to get the votes to match. * ADD new `protover::ProtoverVote` datatype. * REMOVE the `protover::compute_vote()` function and refactor it into an equivalent-in-behaviour albeit more memory-efficient voting algorithm based on the new underlying `protover::protoset::ProtoSet` datatype, as `ProtoverVote::compute()`. * REMOVE the `protover::write_vote_to_string()` function, since this functionality is now generated by the impl_to_string_for_proto_entry!() macro for both `ProtoEntry` and `UnvalidatedProtoEntry` (the latter of which is the correct type to return from a voting protocol instance, since the entity voting may not know of all protocols being voted upon or known about by other voting parties). * FIXES part of #24031: https://bugs.torproject.org/24031 rust: Fix a difference in compute_vote() behaviour to C version.
2018-04-02rust: Add macro for `impl ToString for {Unvalidated}ProtoEntry`.Isis Lovecruft
This implements conversions from either a ProtoEntry or an UnvalidatedProtoEntry into a String, for use in replacing such functions as `protover::write_vote_to_string()`. * ADD macro for implementing ToString trait for ProtoEntry and UnvalidatedProtoEntry. * FIXES part of #24031: https://bugs.torproject.org/24031
2018-04-02rust: Add new protover::UnvalidatedProtoEntry type.Isis Lovecruft
This adds a new protover::UnvalidatedProtoEntry type, which is the UnknownProtocol variant of a ProtoEntry, and refactors several functions which should operate on this type into methods. This also fixes what was previously another difference to the C implementation: if you asked the C version of protovet_compute_vote() to compute a single vote containing "Fribble=", it would return NULL. However, the Rust version would return "Fribble=" since it didn't check if the versions were empty before constructing the string of differences. ("Fribble=" is technically a valid protover string.) This is now fixed, and the Rust version in that case will, analogous to (although safer than) C returning a NULL, return None. * REMOVE internal `contains_only_supported_protocols()` function. * REMOVE `all_supported()` function and refactor it into `UnvalidatedProtoEntry::all_supported()`. * REMOVE `parse_protocols_from_string_with_no_validation()` and refactor it into the more rusty implementation of `impl FromStr for UnvalidatedProtoEntry`. * REMOVE `protover_string_supports_protocol()` and refactor it into `UnvalidatedProtoEntry::supports_protocol()`. * REMOVE `protover_string_supports_protocol_or_later()` and refactor it into `UnvalidatedProtoEntry::supports_protocol_or_later()`. * FIXES part of #24031: https://bugs.torproject.org/24031 rust: Fix another C/Rust different in compute_vote(). This fixes the unittest from the prior commit by checking if the versions are empty before adding a protocol to a vote.
2018-04-02rust: Add new protover::ProtoEntry type which uses new datatypes.Isis Lovecruft
This replaces the `protover::SupportedProtocols` (why would you have a type just for things which are supported?) with a new, more generic type, `protover::ProtoEntry`, which utilises the new, more memory-efficient datatype in protover::protoset. * REMOVE `get_supported_protocols()` and `SupportedProtocols::tor_supported()` (since they were never used separately) and collapse their functionality into a single `ProtoEntry::supported()` method. * REMOVE `SupportedProtocols::from_proto_entries()` and reimplement its functionality as the more rusty `impl FromStr for ProtoEntry`. * REMOVE `get_proto_and_vers()` function and refactor it into the more rusty `impl FromStr for ProtoEntry`. * FIXES part of #24031: https://bugs.torproject.org/24031