Commit Graph

35461 Commits

Author SHA1 Message Date
teor
766fc86df4 circuitbuild: Do node checks when choosing exits
And check that the correct flags are passed when choosing exits.

Adds the following checks for exits:
* must support EXTEND2 cells,
* must have an ntor circuit crypto key,
* can't require the guard flag,
* can't be a direct connection.

All these checks are already implied by other code.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
38c72400b7 routerlist: Split the node checks into their own function
Split the node choosing checks into their own function, so we can call
it independently of iterating through the nodelist.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
a3244c03fb nodelist: Replace int with bool
Make some interfaces and implementations consistent by replacing int
with bool.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
3f7f976d48 nodelist: Stop recursing in router_choose_random_node()
Instead, call out to a helper function, repeating the call if needed.

Avoids duplicating exclusions for:
  * the current relay's family, and
  * any exclusions specified by the caller.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
2ea1692c20 nodelist: Rewrite router_crn_flags_t
Re-order the flags in a logical order, and re-number them.
Add missing comments, fix comment typos.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
48413dc65f nodelist: Remove the unused CRN_WEIGHT_FOR_EXIT flag
Part of 34200.
2020-05-18 21:53:52 +10:00
teor
1ec604f0f9 nodelist: Move node flag checks
Move node flag checks to router_add_running_nodes_to_smartlist(), where
they are actually used.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
280195f414 nodelist: Move the v3 onion service rendezvous check
And delete a loop that is now empty. This change should improve tor's
performance, because we no longer iterate through the nodelist twice for
every node in every circuit path.

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
ce11e3bf69 nodelist: Move the single-hop exit check
Check for single-hop exits in router_add_running_nodes_to_smartlist(),
rather than router_choose_random_node().

Part of 34200.
2020-05-18 21:53:52 +10:00
teor
4bcec38fce test/protover: Add debug logs to some tests
Part of 33222.
2020-05-18 21:51:31 +10:00
teor
3efe53562f rust/protover: Fix protocol version support error handling
Make Rust protocol version support checks consistent with the
undocumented error behaviour of the corresponding C code.

Fixes bug 34251; bugfix on 0.3.3.5-rc.
2020-05-18 21:50:35 +10:00
teor
f05c144d7c rust: declare HSIntro=5
Declare support for the onion service introduction point denial of
service extensions, when building tor with Rust.

Fixes bug 34248; bugfix on 0.4.2.1-alpha.
2020-05-18 20:16:11 +10:00
teor
c6bcc92c17 test/protover: Add tests for summarize flags
Part of 33222.
2020-05-17 22:51:43 +10:00
teor
277baf676b versions: Improve the protover summary comments
Part of 33222.
2020-05-15 23:34:43 +10:00
teor
a702e92c82 protover: Add defines for recent protocol versions
Also update the protover/supported_protocols test.

Part of 33226.
2020-05-15 14:59:10 +10:00
teor
c39394afa2 test/circuitbuild: Tests for node selection flags
Part of 33222.
2020-05-15 12:22:34 +10:00
teor
5f577b0f25 circuitbuild: Refactor IPv6 extend node selection
Move this complex check into its own function.

Part of 33222.
2020-05-14 22:06:14 +10:00
teor
2e41d82cc5 circuitbuild: Refactor build state node selection flags
Move common build state to node selection flags conversion code into its
own function.

Part of 33222.
2020-05-14 22:05:46 +10:00
teor
6a0fdf381d circuitbuild: test relays sending IPv6 extend cells
Add tests for relays sending IPv6 extend cells in
circuit_send_next_onion_skin().

Clients also use this code, check that they can only extend over IPv4
(for now).

Part of 33222.
2020-05-14 21:15:16 +10:00
teor
d41d13ea73 test: Move the origin circuit function to test helpers
Part of 33222.
2020-05-14 10:44:56 +10:00
teor
9949b545c8 test/circuitstats: Refactor common code
Refactor common circuitstats test code into its own function.

Part of 33222.
2020-05-14 10:38:09 +10:00
teor
e9c9e171ae test/circuitstats: Fix a bunch of coding style issues
Part of 33222.
2020-05-14 10:23:14 +10:00
teor
de979dd7bd practracker: Allow a few extra lines in circuituse
Part of 33222.
2020-05-13 20:08:29 +10:00
teor
115a453f04 test/circuitbuild: Add a test for origin_circuit_init()
Part of 33222.
2020-05-13 20:06:27 +10:00
teor
4d2822ee74 changes: file for 33222 and 33226 2020-05-13 16:05:54 +10:00
teor
e2bd15b6f3 doc: Some tor features may not work with MiddleNodes
And fix a formatting issue in the MiddleNodes man page entry.

Part of 33226.
2020-05-11 17:06:43 +10:00
teor
8829d2d644 nodelist: Fix a comment and a log message 2020-05-11 17:01:49 +10:00
teor
1c1faf586a routerlist: Choose nodes that can initiate IPv6 extends
Part of 33226.
2020-05-11 17:00:25 +10:00
teor
9e7f51e469 circuit: Add flags for IPv6 extends
But don't implement the actual node selection yet.

Part of 33226.
2020-05-11 16:54:01 +10:00
teor
b64972edcd practracker: Accept extra or.h lines 2020-05-11 14:39:42 +10:00
teor
c7f085d9bd protover: Add node functions for IPv6 extend support
Part of 33226.
2020-05-11 14:39:42 +10:00
teor
51f32140b4 protover: Sort version flags by their underlying protocols
Also fix some comment typos, mainly ">=" when the code says "=".

Part of 33226.
2020-05-11 12:24:06 +10:00
teor
e787e521af protover: Declare support for Relay=3
Declare support for the new Relay=3 IPv6 extend protocol,
in C and Rust.

Part of 33226.
2020-05-11 11:08:20 +10:00
teor
492c512af4 relay: Improve docs on inform_testing_reachability()
Document race conditions that we'll resolve in 34067 and 34137.

Part of 33222.
2020-05-07 22:06:13 +10:00
teor
504b16fb75 relay: Rewrite inform_testing_reachability()
Rewrite inform_testing_reachability() to use separate buffers for IPv4
ORPort, IPv6 ORPort, and IPv4 DirPort. And use consistent APIs to fill
those buffers.

Part of 33222.
2020-05-07 20:59:10 +10:00
teor
e887887cd3 relay: Clarify a comment in selftest.c 2020-05-07 20:57:14 +10:00
Neel Chauhan
0daa1da3ba Define and use TOR_ADDRPORT_BUF_LEN 2020-05-07 20:38:25 +10:00
teor
c76f310fe7 routerinfo: Make router_get_orport() return an error status
Part of 33222.
2020-05-07 20:25:36 +10:00
teor
24099680f1 Appease practracker: wrapping costs lines 2020-05-07 20:19:19 +10:00
teor
e1eecac888 Replace several C identifiers.
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        client_or_conn_should_skip_reachable_address_check router_or_conn_should_skip_reachable_address_check \
        client_dir_conn_should_skip_reachable_address_check router_dir_conn_should_skip_reachable_address_check
2020-05-07 20:17:57 +10:00
teor
74902c8aca Wrap long lines 2020-05-07 20:16:56 +10:00
teor
05c56ae455 Replace several C identifiers.
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        router_skip_orport_reachability_check router_should_skip_orport_reachability_check \
        router_skip_dirport_reachability_check router_should_skip_dirport_reachability_check \
        router_connect_assume_or_reachable client_or_conn_should_skip_reachable_address_check \
        router_connect_assume_dir_reachable client_dir_conn_should_skip_reachable_address_check

It was generated with --no-verify, so it probably breaks some commit hooks.
The commiter should be sure to fix them up in a subsequent commit.
2020-05-07 20:07:13 +10:00
teor
4a36dfebee circuitbuild: Allow relays to send IPv6 extend cells
Allow relays and bridges to send IPv4 or IPv6 extend cells.
But keep restricting clients to IPv4 extend cells, because sending IPv6
extend cells would be an obvious version distinguisher.

Part of 33222.
2020-04-30 23:27:48 +10:00
teor
4969dee102 relay: Update some self-test comments for IPv6
Part of 33222.
2020-04-30 23:27:38 +10:00
teor
aade9f31e7 relay: Log IPv4 and IPv6 ORPorts when testing reachability
When a relay starts testing reachability, log its IPv6 ORPort.
The existing code logs the IPv4 ORPort and DirPort.

The IPv4 ORPort is required. The other ports are only logged if they
are present.

Part of 33222.
2020-04-30 23:27:27 +10:00
teor
2a0e48385d relay: Launch IPv4 and IPv6 ORPort self-test circuits
When launching relay ORPort reachability self-tests, launch tests to the
IPv4 and IPv6 ORPorts (if available).

Part of 33222.
2020-04-30 23:27:13 +10:00
teor
01d940e71b relay: Refactor dirport self-test circuit launch
Remove some redundant variables, and improve some comments.

Explain that there are no advertised IPv6 DirPorts.

Part of 33222.
2020-04-30 23:26:58 +10:00
teor
a250dd6042 relay: Refactor reachability circuit launches
Split OR and Dir reachability circuits into their own functions.

Part of 33222.
2020-04-30 23:26:45 +10:00
teor
900994e46a relay: Remove unused DirPort self-test code
DIRIND_ANON_DIRPORT never uses our ORPort, so we don't need to set it in
the directory request.

Part of 33222.
2020-04-30 23:26:35 +10:00
teor
18174fb82f relay: Add an address family to self-test launches
Add an address family argument to the functions that launch relay ORPort
self-test circuits.

Part of 33222.
2020-04-30 23:26:31 +10:00