Commit Graph

314 Commits

Author SHA1 Message Date
Alex Xu (Hello71) 15e95c3bda Use tor_event_free instead of event_del+tor_free
Using tor_free is wrong; event_free must be called for objects obtained from
event_new. Additionally, this slightly simplifies the code.

Also, add a static_assert to prevent further instances.
2022-04-20 00:14:25 -04:00
Mike Perry b2553bfba2 Use path type hint for Vegas queue parameters.
These parameters will vary depending on path length, especially for onions.
2022-02-22 19:28:35 +00:00
Mike Perry b6d5fbba7d Implement congestion control parameter negotiation 2022-02-22 19:28:34 +00:00
Nick Mathewson 93318ba5e2 Convert TODO into TODO-324 for better visibility. 2022-02-22 19:28:33 +00:00
Nick Mathewson a511718a30 Negotiated circuit parameters must pass from worker. 2022-02-22 19:28:33 +00:00
Nick Mathewson 244444e8b1 Add an exported struct to onion handshakes for circuits params
THis will eventually hold the congestion control parameters that we
negotiated, plus whatever else is relevant.
2022-02-22 19:28:33 +00:00
Nick Mathewson 358ce9a19d Add a size argument for the buffer on onion handshake functions 2022-02-22 19:28:33 +00:00
Mike Perry 0422eb26a7 Prop#324: Hook up flow control 2021-10-04 10:45:46 -04:00
David Goulet 819b69244a Support rate limiting of edge connections reads.
We only need to rate limit reading on edges for flow control, as per the rate
that comes in the XON from the other side. When we rate limit reading from the
edge source to this rate, we will only deliver that fast to the other side,
thus satisfying its rate request.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-04 10:45:46 -04:00
Mike Perry 5c3021be85 Make inbuf and outbuf len check params const 2021-07-30 12:57:31 -04:00
George Kadianakis 30a97d9bb3 Increase frequency of vg-lite callback to 15 minutes 2021-07-20 13:03:32 +03:00
George Kadianakis 314a6b42c5 Introduce vanguards-lite subsystem and some of its entry points
Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
2021-07-01 18:15:55 +03:00
Nick Mathewson af560f21ec Merge branch 'maint-0.4.6' 2021-05-17 09:04:22 -04:00
Nick Mathewson fbd47a5078 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-05-17 09:04:22 -04:00
David Goulet 5f009a59da conn: MetricsPort listener is a listener port
The connection type for the listener part was missing from the "is
connection a listener" function.

This lead to our periodic event that retries our listeners to keep
trying to bind() again on an already opened MetricsPort.

Closes #40370

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12 15:13:50 -04:00
David Goulet 22861c2f40 relay: Add TCP port exhaustion metrics
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12 11:58:25 -04:00
Roger Dingledine 962b15aa6f fix some tiny typos 2021-03-24 18:13:46 -04:00
George Kadianakis 29f07a4e9d Merge branch 'mr/334' 2021-03-17 18:23:18 +02:00
George Kadianakis e688580277 Implement rate limiting metrics. 2021-03-17 18:22:38 +02:00
George Kadianakis faf1fe833e Implement port/file-descriptor exhaustion metric.
This uses a heuristic that came up after a discussion with David.

I'm leaving this as a separate commit so that it can be discussed further if
needed.
2021-03-17 18:22:38 +02:00
David Goulet 15a95df376 Merge branch 'tor-gitlab/mr/337' 2021-03-17 11:53:14 -04:00
Nick Mathewson 066748c9cd Add a DormantTimeoutEnabled to disable dormant mode entirely
(If you need to do this in an older version you can just set
DormantClientTimeout to something huge.)

Closes #40228.
2021-03-17 11:53:09 -04:00
Nick Mathewson b5d08ddc09 Update copyrights to 2021, using "make update-copyright" 2021-03-12 11:39:23 -05:00
David Goulet 38649b4f95 relay: Remove dirport reachability self test
Regular relays are about to get their DirPort removed so that reachability
test is not useful anymore

Authorities will still use the DirPort but because network reentry towards
their DirPort is now denied network wide, this test is not useful anymore and
so it should simply be considered reachable at all time.

Part of #40282

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 08:52:06 -05:00
David Goulet 2c865542b6 hs-v2: Removal of service and relay support
This is unfortunately massive but both functionalities were extremely
intertwined and it would have required us to actually change the HSv2 code in
order to be able to split this into multiple commits.

After this commit, there are still artefacts of v2 in the code but there is no
more support for service, intro point and HSDir.

The v2 support for rendezvous circuit is still available since that code is
the same for the v3 and we will leave it in so if a client is able to
rendezvous on v2 then it can still transfer traffic. Once the entire network
has moved away from v2, we can remove v2 rendezvous point support.

Related to #40266

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-19 13:20:48 -05:00
David Goulet 2444629c86 hs-v2: Remove client support
Related to #40266

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-19 13:19:08 -05:00
George Kadianakis cf1f03fe1d Merge remote-tracking branch 'tor-gitlab/mr/308' 2021-02-19 13:25:47 +02:00
David Goulet 9f61d9238c metrics: Handle the connection finished flushing event
Turns out, we forgot to add the METRICS connection type fo the finished
flushing handler.

Fixes #40295

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-17 09:54:05 -05:00
Nick Mathewson d6b82d79dc Merge branch 'maint-0.4.5' 2021-02-08 14:28:19 -05:00
David Goulet 01c4abc2d4 conn: Properly close MetricsPort socket on EOF
Handle the EOF situation for a metrics connection. Furthermore, if we failed
to fetch the data from the inbuf properly, mark the socket as closed because
the caller, connection_process_inbuf(), assumes that we did so on error.

Fixes #40257

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08 14:26:45 -05:00
Neel Chauhan a82b4eb305 src/core/mainloop: Put brackets around IPv6 addresses in log messages 2021-01-27 08:23:39 -08:00
George Kadianakis 42e95c8d85 Merge branch 'maint-0.4.5' 2021-01-12 18:05:32 +02:00
David Goulet 9b59ede8d3 Merge branch 'ticket40237_044_01' into ticket40237_045_01 2021-01-12 10:55:21 -05:00
David Goulet b3652f2104 Merge branch 'ticket40237_043_01' into ticket40237_044_01 2021-01-12 10:54:31 -05:00
David Goulet 60da5d6222 Merge branch 'ticket40237_035_01' into ticket40237_043_01 2021-01-12 10:46:25 -05:00
David Goulet 04b0263974 hs-v3: Require reasonably live consensus
Some days before this commit, the network experienced a DDoS on the directory
authorities that prevented them to generate a consensus for more than 5 hours
straight.

That in turn entirely disabled onion service v3, client and service side, due
to the subsystem requiring a live consensus to function properly.

We know require a reasonably live consensus which means that the HSv3
subsystem will to its job for using the best consensus tor can find. If the
entire network is using an old consensus, than this should be alright.

If the service happens to use a live consensus while a client is not, it
should still work because the client will use the current SRV it sees which
might be the previous SRV for the service for which it still publish
descriptors for.

If the service is using an old one and somehow can't get a new one while
clients are on a new one, then reachability issues might arise. However, this
is a situation we already have at the moment since the service will simply not
work if it doesn't have a live consensus while a client has one.

Fixes #40237

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-12 09:46:35 -05:00
Alexander Færøy b645fbdb54 Merge remote-tracking branch 'tor-gitlab/mr/207' 2020-12-18 14:19:24 +00:00
David Goulet 7c06707750 Merge branch 'tor-gitlab/mr/182' into master 2020-11-17 10:36:05 -05:00
Nick Mathewson 6c61011781 Merge remote-tracking branch 'tor-gitlab/mr/184' into master 2020-11-17 08:22:44 -05:00
Neel Chauhan d1494d140c Remove orconn_ext_or_id_map and related functions 2020-11-12 11:19:21 -08:00
Samanta Navarro 4a0cd79588 Fix typos.
Typos found with codespell.

Please keep in mind that this should have impact on actual code
and must be carefully evaluated:

src/core/or/lttng_circuit.inc
-    ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER)
+    ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
2020-11-12 11:44:09 -05:00
George Kadianakis 6178a64fcf Abstract v2/v3 "write stats to file" logic into a single function. 2020-11-03 11:12:17 +02:00
George Kadianakis bd28551763 Introduce v3_stats_t structure and some of its methods. 2020-11-03 11:09:24 +02:00
George Kadianakis 1de7843658 Make room for v3: s/hs_stats/hs_v2_stats/ 2020-11-02 21:05:05 +02:00
Neel Chauhan 09b3af578d Stop forcing IPv4 and IPv6 traffic on non-SOCKSPorts 2020-10-27 17:57:48 -07:00
David Goulet 2fe0322fe4 hs: Collect service traffic metrics
Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 4f5cea1f59 conn: New Metrics listener port
If MetricsPort is defined, listen on it and handle the incoming request.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
Nick Mathewson 47d6eef190 Also, include ed25519 identities in connection_describe().
Related to #22668.
2020-10-15 10:53:45 -04:00
Nick Mathewson 701a1936fa Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:26:04 -04:00
Nick Mathewson ad7ffa5240 Merge remote-tracking branch 'tor-gitlab/mr/79' into maint-0.3.5 2020-10-07 08:25:55 -04:00