Commit Graph

37644 Commits

Author SHA1 Message Date
Roger Dingledine
db34f6c9e8 handle other de-sync cases from #40396
Specifically, every time a guard moves into or out of state
GUARD_REACHABLE_MAYBE, it is an opportunity for the guard reachability
state to get out of sync with the have-minimum-dir-info state.

Fixes even more of #40396.
2021-10-28 20:57:28 -04:00
Roger Dingledine
3c8510e2c0 reassess minimum-dir-info when a bridge fails
When we try to fetch a bridge descriptor and we fail, we mark
the guard as failed, but we never scheduled a re-compute for
router_have_minimum_dir_info().

So if we had already decided we needed to wait for this new descriptor,
we would just wait forever -- even if, counterintuitively, *losing* the
bridge is just what we need to *resume* using the network, if we had it
in state GUARD_REACHABLE_MAYBE and we were stalling to learn this outcome.

See bug 40396 for more details.
2021-10-28 20:57:28 -04:00
Roger Dingledine
867c3c6f89 only log "new bridge descriptor" if really new
The bridge descriptor fetching codes ends up fetching a lot of duplicate
bridge descriptors, because this is how we learn when the descriptor
changes.

This commit only changes comments plus whether we log that one line.

It moves us back to the old behavior, before the previous commit for
30496, where we would only log that line when the bridge descriptor
we're talking about is better than the one we already had (if any).
2021-10-28 20:57:28 -04:00
Roger Dingledine
d66549c208 fetch missing bridge descriptors without delay
Without this change, if we have a working bridge, and we add a new bridge,
we will schedule the fetch attempt for that new bridge descriptor for
three hours(!) in the future.

This change is especially needed because of bug #40396, where if you have
one working bridge and one bridge whose descriptor you haven't fetched
yet, your Tor will stall until you have successfully fetched that new
descriptor -- in this case for hours.

In the old design, we would put off all further bridge descriptor fetches
once we had any working bridge descriptor. In this new design, we make the
decision per bridge based on whether we successfully got *its* descriptor.

To make this work, we need to also call learned_bridge_descriptor() every
time we get a bridge descriptor, not just when it's a novel descriptor.

Fixes bug 40396.

Also happens to fix bug 40495 (redundant descriptor fetches for every
bridge) since now we delay fetches once we succeed.

A side effect of this change is that if we have any configured bridges
that *aren't* working, we will keep trying to fetch their descriptors
on the modern directory retry schedule -- every couple of seconds for
the first half minute, then backing off after that -- which is a lot
faster than before.
2021-10-24 17:40:28 -04:00
David Goulet
2f171f30c8 Merge branch 'maint-0.4.6' 2021-10-21 10:01:39 -04:00
David Goulet
d496a75026 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-21 10:01:38 -04:00
David Goulet
1dab1c8ad5 Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-21 10:01:38 -04:00
David Goulet
66e8e0f71b fallbackdir: Regenerate the list for October 2021
Closes #40493

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-21 09:13:40 -04:00
Alexander Færøy
ae05f06597 Merge branch 'tor-gitlab/mr/452_squashed' into main 2021-10-21 12:57:37 +00:00
Nick Mathewson
54ab43d05e Prop335: Changes file and manual entries.
Closes #40448.
2021-10-21 12:57:20 +00:00
Nick Mathewson
ab26475cab Add a new consensus method to handle MiddleOnly specially.
When this method is in place, then any relay which is assigned
MiddleOnly has Exit, V2Dir, Guard, and HSDir cleared
(and has BadExit set if appropriate).
2021-10-21 12:57:20 +00:00
Nick Mathewson
fc542167cb Implement a MiddleOnly flag for vote generation.
This proposal implements part of Prop335; it's based on a patch
from Neel Chauhan.

When configured to do so, authorities will assign a MiddleOnly flag
to certain relays.  Any relay which an authority gives this flag
will not get Exit, V2Dir, Guard, or HSDir, and might get BadExit if
the authority votes for that one.
2021-10-21 12:57:20 +00:00
Alexander Færøy
d320f4d2a2 Merge remote-tracking branch 'tor-gitlab/mr/442' into main 2021-10-21 12:50:28 +00:00
Alexander Færøy
bd1c14f015 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-21 12:35:36 +00:00
Alexander Færøy
998706c611 Merge branch 'maint-0.4.6' into main 2021-10-21 12:35:36 +00:00
Alexander Færøy
0135fb028c Merge remote-tracking branch 'tor-gitlab/mr/338' into maint-0.4.5 2021-10-21 12:35:26 +00:00
Alexander Færøy
1e08efdb58 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-20 21:47:26 +00:00
Alexander Færøy
059ea671ed Merge branch 'maint-0.4.6' into main 2021-10-20 21:47:26 +00:00
Alexander Færøy
5717b88bcb Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-20 21:47:17 +00:00
Alexander Færøy
7372739765 Announce URL to bridge status page when starting Tor as a bridge relay.
This patch makes Tor announce the relay specific bridge status page URL
when Tor is starting up before bootstrap occours.

See: tor#30477
2021-10-20 21:44:45 +00:00
David Goulet
7c2c749d89 relay: Comment out a unused variable for now
We keep it around until libevent is fixed, it should be used again. In
the meantime, avoid the compiler to complain of this unused variable.

https://gitlab.torproject.org/dgoulet/tor/-/jobs/43358#L1522

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 15:17:08 -04:00
Alexander Færøy
bae6780e70 Merge branch 'tor-gitlab/mr/464_squashed' into main 2021-10-20 18:39:07 +00:00
Nick Mathewson
bcc953307b Move "Didn't recognize cell, but circ stops here" into heartbeat.
When we looked, this was the third most frequent message at
PROTOCOL_WARN, and doesn't actually tell us what to do about it.
Now:
 * we just log it at info
 * we log it only once per circuit
 * we report, in the heartbeat, how many times it happens, how many
   cells it happens with per circuit, and how long these circuits
   have been alive (on average).

Fixes the final part of #40400.
2021-10-20 18:38:39 +00:00
Alexander Færøy
a5dc1a4c85 Merge remote-tracking branch 'tor-gitlab/mr/466' into main 2021-10-20 17:54:27 +00:00
David Goulet
903fb3dd62 relay: Avoid duplicate MetricsPort DNS error
We don't output per-type DNS errors anymore so avoid looping over the
DNS query type and output each errors for them. Before this commit, it
created 3x the same message because we had A, AAAA and PTR type records.

Fix on previous commit e7abab8782

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 13:49:44 -04:00
Alexander Færøy
16cbbf04c4 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-20 17:36:07 +00:00
Alexander Færøy
2a7c0a95ee Merge branch 'maint-0.4.6' into main 2021-10-20 17:36:07 +00:00
Alexander Færøy
fdc7549b61 Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-20 17:36:06 +00:00
Alexander Færøy
5a043825d0 Remove unused function: dns_randfn_() in dns.c.
This patch unbreaks the current build after tor!369 landed.

See: https://bugs.torproject.org/tpo/core/tor/40371
2021-10-20 17:35:52 +00:00
Alexander Færøy
db112329a0 Merge remote-tracking branch 'tor-gitlab/mr/369' into maint-0.3.5 2021-10-20 17:35:35 +00:00
David Goulet
e7abab8782 relay: For metrics, don't report DNS errors by query type
This is due to the libevent bug
https://github.com/libevent/libevent/issues/1219 that fails to return
back the DNS record type on error.

And so, the MetricsPort now only reports the errors as a global counter
and not a per record type.

Closes #40490

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 10:40:56 -04:00
David Goulet
7a8108ea87 relay: Overload state on DNS timeout is now X% over Y secs
With this commit, we will only report a general overload state if we've
seen more than X% of DNS timeout errors over Y seconds. Previous
behavior was to report when a single timeout occured which is really too
small of a threshold.

The value X is a consensus parameters called
"overload_dns_timeout_scale_percent" which is a scaled percentage
(factor of 1000) so we can represent decimal points for X like 0.5% for
instance. Its default is 1000 which ends up being 1%.

The value Y is a consensus parameters called
"overload_dns_timeout_period_secs" which is the time period for which
will gather DNS errors and once over, we assess if that X% has been
reached ultimately triggering a general overload signal.

Closes #40491

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 10:00:03 -04:00
David Goulet
3752a71ded Merge branch 'maint-0.4.6' 2021-10-20 09:16:45 -04:00
David Goulet
caa305a5ad changes: Add file for ticket 40491
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 09:15:51 -04:00
David Goulet
996409c9c4 test: Add unit tests for DNS timeout overload state
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 09:09:25 -04:00
David Goulet
de907893be relay: Overload state on DNS timeout is now X% over Y secs
With this commit, we will only report a general overload state if we've
seen more than X% of DNS timeout errors over Y seconds. Previous
behavior was to report when a single timeout occured which is really too
small of a threshold.

The value X is a consensus parameters called
"overload_dns_timeout_scale_percent" which is a scaled percentage
(factor of 1000) so we can represent decimal points for X like 0.5% for
instance. Its default is 1000 which ends up being 1%.

The value Y is a consensus parameters called
"overload_dns_timeout_period_secs" which is the time period for which
will gather DNS errors and once over, we assess if that X% has been
reached ultimately triggering a general overload signal.

Closes #40491

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 09:09:25 -04:00
David Goulet
d455f9e18a hs: v2 address are now considered a bad hostname
This means that at this commit, tor will stop logging that v2 is
deprecated and treat a v2 address as a bad hostname that we can't use.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 10:59:19 -04:00
David Goulet
af48f5736a hs: Fix merge conflicts after merging forward 40476
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 10:57:10 -04:00
David Goulet
2a705e81a3 Merge branch 'maint-0.4.6' 2021-10-19 10:35:40 -04:00
David Goulet
326f954f10 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-19 10:35:35 -04:00
David Goulet
d949a2f924 Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-19 10:29:15 -04:00
David Goulet
44e105c27f hs: Improve warning for bad service version
Now that we don't have version 2, it gives us:

  [warn] HiddenServiceVersion must be between 3 and 3, not 2.

This commit changes it to:

  [warn] HiddenServiceVersion must be 3, not 2.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
18b5630a7c changes: Add file for ticket 40476
Closes #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
f9750249ac test: Don't run HSv2 Chutney test networks
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
9a6c6e8ec5 test: Fix unit tests after disabling version 2
Some tests were removed because they were testing something not usable
anymore.

Some tests remains to make sure that things are indeed disabled.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
d0053fdfb5 hs: Improve warning for bad service version
Now that we don't have version 2, it gives us:

  [warn] HiddenServiceVersion must be between 3 and 3, not 2.

This commit changes it to:

  [warn] HiddenServiceVersion must be 3, not 2.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:23 -04:00
David Goulet
3dd4b3316d changes: Add file for ticket 40476
Closes #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:23 -04:00
David Goulet
48e6e0843b test: Don't run HSv2 Chutney test networks
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:23 -04:00
David Goulet
1589e6bf28 test: Fix unit tests after disabling version 2
Some tests were removed because they were testing something not usable
anymore.

Some tests remains to make sure that things are indeed disabled.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:22 -04:00
David Goulet
fb0c949df6 hs-v2: Disable version 2 HSPOST and HSFETCH command
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:22 -04:00