Commit Graph

38192 Commits

Author SHA1 Message Date
Nick Mathewson
e531d4d1b9 Fix a completely wrong calculation in mach monotime_init_internal()
Bug 1: We were purporting to calculate milliseconds per tick, when we
*should* have been computing ticks per millisecond.

Bug 2: Instead of computing either one of those, we were _actually_
computing femtoseconds per tick.

These two bugs covered for one another on x86 hardware, where 1 tick
== 1 nanosecond.  But on M1 OSX, 1 tick is about 41 nanoseconds,
causing surprising results.

Fixes bug 40684; bugfix on 0.3.3.1-alpha.
2022-10-13 13:40:10 -04:00
David Goulet
c8d8fa0d36 relay: Add number of rejected connections to MetricsPort
Related to #40194

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12 09:25:19 -04:00
David Goulet
d543db5ac0 relay: Add connection stats to MetricsPort
This adds the number of created and opened connections to the
MetricsPort for a relay for each connection type and direction.

Output looks like:

  # HELP tor_relay_connections Connections metrics of this relay
  # TYPE tor_relay_connections counter
  tor_relay_connections{type="OR listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="OR listener",direction="received",state="created"} 0
  tor_relay_connections{type="OR listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="OR listener",direction="received",state="opened"} 0
  tor_relay_connections{type="OR",direction="initiated",state="created"} 5
  tor_relay_connections{type="OR",direction="received",state="created"} 0
  tor_relay_connections{type="OR",direction="initiated",state="opened"} 5
  tor_relay_connections{type="OR",direction="received",state="opened"} 0
  tor_relay_connections{type="Exit",direction="initiated",state="created"} 0
  tor_relay_connections{type="Exit",direction="received",state="created"} 0
  tor_relay_connections{type="Exit",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Exit",direction="received",state="opened"} 0
  tor_relay_connections{type="Socks listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Socks listener",direction="received",state="created"} 0
  tor_relay_connections{type="Socks listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Socks listener",direction="received",state="opened"} 0
  tor_relay_connections{type="Socks",direction="initiated",state="created"} 0
  tor_relay_connections{type="Socks",direction="received",state="created"} 0
  tor_relay_connections{type="Socks",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Socks",direction="received",state="opened"} 0
  tor_relay_connections{type="Directory listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Directory listener",direction="received",state="created"} 0
  tor_relay_connections{type="Directory listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Directory listener",direction="received",state="opened"} 0
  tor_relay_connections{type="Directory",direction="initiated",state="created"} 0
  tor_relay_connections{type="Directory",direction="received",state="created"} 0
  tor_relay_connections{type="Directory",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Directory",direction="received",state="opened"} 0
  tor_relay_connections{type="Control listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Control listener",direction="received",state="created"} 0
  tor_relay_connections{type="Control listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Control listener",direction="received",state="opened"} 0
  tor_relay_connections{type="Control",direction="initiated",state="created"} 0
  tor_relay_connections{type="Control",direction="received",state="created"} 0
  tor_relay_connections{type="Control",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Control",direction="received",state="opened"} 0
  tor_relay_connections{type="Transparent pf/netfilter listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Transparent pf/netfilter listener",direction="received",state="created"} 0
  tor_relay_connections{type="Transparent pf/netfilter listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Transparent pf/netfilter listener",direction="received",state="opened"} 0
  tor_relay_connections{type="Transparent natd listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Transparent natd listener",direction="received",state="created"} 0
  tor_relay_connections{type="Transparent natd listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Transparent natd listener",direction="received",state="opened"} 0
  tor_relay_connections{type="DNS listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="DNS listener",direction="received",state="created"} 0
  tor_relay_connections{type="DNS listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="DNS listener",direction="received",state="opened"} 0
  tor_relay_connections{type="Extended OR",direction="initiated",state="created"} 0
  tor_relay_connections{type="Extended OR",direction="received",state="created"} 0
  tor_relay_connections{type="Extended OR",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Extended OR",direction="received",state="opened"} 0
  tor_relay_connections{type="Extended OR listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Extended OR listener",direction="received",state="created"} 0
  tor_relay_connections{type="Extended OR listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Extended OR listener",direction="received",state="opened"} 0
  tor_relay_connections{type="HTTP tunnel listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="HTTP tunnel listener",direction="received",state="created"} 0
  tor_relay_connections{type="HTTP tunnel listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="HTTP tunnel listener",direction="received",state="opened"} 0
  tor_relay_connections{type="Metrics listener",direction="initiated",state="created"} 0
  tor_relay_connections{type="Metrics listener",direction="received",state="created"} 1
  tor_relay_connections{type="Metrics listener",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Metrics listener",direction="received",state="opened"} 1
  tor_relay_connections{type="Metrics",direction="initiated",state="created"} 0
  tor_relay_connections{type="Metrics",direction="received",state="created"} 0
  tor_relay_connections{type="Metrics",direction="initiated",state="opened"} 0
  tor_relay_connections{type="Metrics",direction="received",state="opened"} 0

Related to #40194

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12 09:25:19 -04:00
David Goulet
5603baf257 conn: Keep stats of opened and closed connections
Related to #40194

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12 09:25:19 -04:00
Andy
d09414858e Properly compute cell-drop overload fraction
Patch to address #40673. An additional check has been added to
onion_pending_add() in order to ensure that we avoid counting create
cells from clients.

In the cpuworker.c assign_onionskin_to_cpuworker
method if total_pending_tasks >= max_pending_tasks
and channel_is_client(circ->p_chan) returns false then
rep_hist_note_circuit_handshake_dropped() will be called and
rep_hist_note_circuit_handshake_assigned() will not be called. This
causes relays to run into errors due to the fact that the number of
dropped packets exceeds the total number of assigned packets.

To avoid this situation a check has been added to
onion_pending_add() to ensure that these erroneous calls to
rep_hist_note_circuit_handshake_dropped() are not made.

See the #40673 ticket for the conversation with armadev about this issue.
2022-10-06 00:46:29 -04:00
Tor CI Release
2dff82dc72 version: Bump version to 0.4.7.10-dev 2022-08-12 10:55:03 -04:00
David Goulet
42f72dc10c Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-12 10:54:47 -04:00
Tor CI Release
83965eca26 version: Bump version to 0.4.6.12-dev 2022-08-12 10:54:41 -04:00
David Goulet
0915eb6862 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-12 10:54:31 -04:00
Tor CI Release
d52a5f2181 version: Bump version to 0.4.5.14-dev 2022-08-12 10:54:19 -04:00
Tor CI Release
f732a91a73 version: Bump version to 0.4.7.10 2022-08-12 10:19:37 -04:00
David Goulet
9a9ddc2657 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-12 10:17:36 -04:00
Tor CI Release
111b2d3a9f version: Bump version to 0.4.6.12 2022-08-12 10:17:03 -04:00
David Goulet
5de3b0db75 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-12 10:14:38 -04:00
David Goulet
b86b593c04 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-12 10:14:32 -04:00
Tor CI Release
ecb194b9da version: Bump version to 0.4.5.14 2022-08-12 10:12:06 -04:00
David Goulet
c4ff6a4f55 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-12 09:56:54 -04:00
David Goulet
8244eefcd3 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-12 09:56:54 -04:00
David Goulet
bb88086c72 geoip: Update geoip files with August 9th, 2022 database
Fixes #40658

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-08-12 09:56:50 -04:00
Tor CI Release
1506eca5aa version: Bump version to 0.4.7.9-dev 2022-08-11 11:15:05 -04:00
David Goulet
bbc4ec7950 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-11 11:14:52 -04:00
Tor CI Release
8e868600dd version: Bump version to 0.4.6.11-dev 2022-08-11 11:14:44 -04:00
David Goulet
3c5ae66c1f Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-11 11:14:34 -04:00
Tor CI Release
3b143927b3 version: Bump version to 0.4.5.13-dev 2022-08-11 11:14:20 -04:00
Tor CI Release
f478be6dc7 version: Bump version to 0.4.7.9 2022-08-11 10:24:15 -04:00
David Goulet
eddd80b2c2 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-11 10:23:40 -04:00
Tor CI Release
661c214f4b version: Bump version to 0.4.6.11 2022-08-11 10:19:11 -04:00
David Goulet
db4e226354 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-11 10:17:35 -04:00
David Goulet
3684e512ff Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-11 10:17:30 -04:00
Tor CI Release
56152a1048 version: Bump version to 0.4.5.13 2022-08-11 09:50:20 -04:00
David Goulet
9b4d3ed492 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-11 09:44:47 -04:00
David Goulet
c65d8b2aad Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-11 09:44:47 -04:00
Tor CI Release
65ffb97c2f fallbackdir: Update list generated on August 11, 2022 2022-08-11 09:44:39 -04:00
Tor CI Release
f9acdd0630 Update geoip files to match ipfire location db, 2022/08/11. 2022-08-11 09:44:32 -04:00
David Goulet
0564a19f6a Merge branch 'tor-gitlab/mr/613' into maint-0.4.7 2022-08-11 09:26:59 -04:00
Mike Perry
432b2e50c9 Tune congestion control parameters. 2022-08-11 09:26:51 -04:00
Mike Perry
9fb52305ee Add changes file for bug40642. 2022-08-11 09:26:51 -04:00
Mike Perry
0cde7bc6d6 Reduce the number of vegas parameters.
We need to tune these, but we're not likely to need the subtle differences
between a few of them. Removing them will prevent our consensus parameter
string from becoming too long in the event of tuning.
2022-08-11 09:26:51 -04:00
Mike Perry
acdc0ecdd4 Reset the min value if we hit cwnd_min.
This can avoid circuits getting stuck due to an abnormally low min value.
2022-08-11 09:26:51 -04:00
Mike Perry
4444f5f4ed Use EWMA instead of bare rtt for min rtt.
This allows us to average out minimums due to lulls in activity a bit more.
2022-08-11 09:26:51 -04:00
Mike Perry
08c3ee8eca Create slow-start max for n_ewma_cnt.
Since slow-start now checks every sendme, lower EWMA is better.
2022-08-11 09:26:51 -04:00
Mike Perry
832a1d9fae Implement RFC3742 Limited Slow Start
RFC3742 updates the cwnd every sendme during slow start, and backs off of the
exponential growth based on a cap parameter.
2022-08-11 09:26:51 -04:00
David Goulet
9e8f76d430 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-10 13:59:20 -04:00
David Goulet
7eac2e1c98 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-10 13:59:20 -04:00
David Goulet
362839a77d fallbackdirs: Update list from maint-0.4.7
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-08-10 13:59:14 -04:00
David Goulet
e465f511a5 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-08-10 13:41:25 -04:00
David Goulet
1716b428c0 Merge branch 'maint-0.4.6' into maint-0.4.7 2022-08-10 13:41:25 -04:00
David Goulet
13d2d1246f geoip: Update files from maint-0.4.7
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-08-10 13:41:22 -04:00
Roger Dingledine
d48eaff86d ignore families for L2 guard independence
mike is concerned that we would get too much exposure to adversaries,
if we enforce that none of our L2 guards can be in the same family.

this change set now essentially finishes the feature that commit a77727cdc
was attempting to add, but strips the "_and_family" part of that plan.
2022-08-09 16:39:26 -04:00
Roger Dingledine
7b1fffe0dd make L2 vanguards actually independent
We had omitted some checks for whether our vanguards (second layer
guards from proposal 333) overlapped or came from the same family.
Now make sure to pick each of them to be independent.

Fixes bug 40639; bugfix on 0.4.7.1-alpha.
2022-08-09 14:47:11 -04:00