Commit Graph

377 Commits

Author SHA1 Message Date
Nick Mathewson
d6c89b1ae1 Make networkstatus_getinfo_by_purpose report published_on again.
When we implemented prop275 in 0.4.8.1-alpha, we changed the
behavior of networkstatus_getinfo_helper_single to omit meaningful
published_on times, replacing them with "2038-01-01".  This is
necessary when we're formatting a routerstatus with no additional
info, since routerstatus objects no longer include a published_on.

But in networkstatus_getinfo_by_purpose, we do have a routerinfo
that does have a published_on.  This patch uses that information
to report published_on times in our output when we're making a
"virtual" networkstatus for a big file of routerinfo_t objects.
This is mostly important for bridge authorities, since when
they dump a secret list of the bridges, they want to include
published_on times.

Closes #40855. Bugfix on 0.4.8.1-alpha.
2023-09-12 08:46:31 -04:00
David Goulet
336a24754d Prop#329 Pool: Handle linking, unlinking, and relaunching conflux circuit legs.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-04-06 15:57:11 +00:00
Mike Perry
eac2bad86b Prop#329 params: Consensus parameter and torrc handling
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-04-06 15:57:10 +00:00
David Goulet
a9fc6c937c protover: Support Relay=5 for Conflux (prop329)
Closes #40721

Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-04-06 15:57:10 +00:00
David Goulet
d02d2a4338 Fix compiler warnings about unused variables
Fixes #40743

Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-01-19 11:18:02 -05:00
David Goulet
c408d0a7f9 Merge branch 'tor-gitlab/mr/657' 2022-11-28 09:35:53 -05:00
David Goulet
560d44b08b Merge branch 'maint-0.4.7' 2022-11-09 15:29:04 -05:00
David Goulet
780ca741f3 relay: Cache onion queue parameters on consensus change
This is part of the fast path so we need to cache consensus parameters
instead of querying it everytime we need to learn a value.

Part of #40704

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-09 15:12:51 -05:00
David Goulet
e3f6908984 relay: Make the max pending tasks per CPU a consensus parameter
Until now, there was this magic number (64) used as the maximum number
of tasks a CPU worker can take at once.

This commit makes it a consensus parameter so our future selves can
think of a better value depending on network conditions.

Part of #40704

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-09 13:13:21 -05:00
David Goulet
ca135a127d Merge branch 'maint-0.4.7' 2022-10-26 15:01:43 -04:00
Roger Dingledine
c56980f5e5 use consensus ip:port for dir auths if different
Directory authorities and relays now interact properly with directory
authorities if they change addresses. In the past, they would continue
to upload votes, signatures, descriptors, etc to the hard-coded address
in the configuration. Now, if the directory authority is listed in
the consensus at a different address, they will direct queries to this
new address.

Specifically, these three activities have changed:

* Posting a vote, a signature, or a relay descriptor to all the dir auths.

* Dir auths fetching missing votes or signatures from all the dir auths.

* Dir auths fetching new descriptors from a specific dir auth when they
just learned about them from that dir auth's vote.

We already do this desired behavior (prefer the address in the consensus,
but fall back to the hard-coded dirservers info if needed) when fetching
missing certs.

There is a fifth case, in router_pick_trusteddirserver(), where clients
and relays are trying to reach a random dir auth to fetch something. I
left that case alone for now because the interaction with fallbackdirs
is complicated.

Implements ticket 40705.
2022-10-25 04:19:37 -04:00
Roger Dingledine
bab8375ef5 dir auths now omit Measured= if rs->is_authority
Directory authorities stop voting a consensus "Measured" weight
for relays with the Authority flag. Now these relays will be
considered unmeasured, which should reserve their bandwidth
for their dir auth role and minimize distractions from other roles.

In place of the "Measured" weight, they now include a
"MeasuredButAuthority" weight (not used by anything) so the bandwidth
authority's opinion on this relay can be recorded for posterity.

Resolves ticket 40698.
2022-10-24 04:34:49 -04:00
Nick Mathewson
0dc9561f21 Add a missing "not" to a message.
Closes #40619.

Bugfix on 0.2.5.4-alpha.
2022-06-17 12:00:09 -04:00
David Goulet
4f038d224f Merge branch 'tor-gitlab/mr/489' 2022-05-16 08:51:00 -04:00
David Goulet
2cdb5ceb1d relay: On new consensus, reconfigure DNS nameservers
This applies only for relays. Previous commit adds two new consensus
parameters that dictate how libevent is configured with DNS resolution.
And so, with a new consensus, we now look at those values in case they
ever change.

Without this, Exit relay would have to HUP or restart to apply any new
Exit DNS consensus parameters.

Related to #40312

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-03-15 15:26:37 -04:00
David Goulet
9a47372096 rephist: Introduce a fraction and period for overload onionskin
This code was heavily reused from the previous DNS timeout work done in
ticket #40491 that was removed afterall from our code.

Closes #40560

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-03-15 13:28:17 -04:00
Roger Dingledine
72729210bf fix a typo in a comment 2022-02-23 10:03:24 -05:00
David Goulet
0eaf0e8a31 hs: Republish onion descriptor on sendme_inc change
Republishing is necessary to ensure that clients connect using the correct
sendme_inc upon any change. Additionally, introduction points must be
re-chosen, so that cached descriptors with old values are not usable.

We do not expect to change sendme_inc, unless cell size or TLS record size
changes, so this should be rare.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-22 19:28:34 +00:00
Nick Mathewson
baaabb503c Use protover to signal support for ntor3 + congestion control. 2022-02-22 19:28:33 +00:00
David Goulet
bf1ed5c853 relay: Change DNS timeout label on MetricsPort
Change it from "timeout" to "tor_timeout" in order to indicate that the
DNS timeout is one from tor's DNS threshold and not the DNS server
itself.

Fixes #40527

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-13 10:49:00 -05:00
Nick Mathewson
96f1e69f24 Implement proposal 275: don't put "published" times in md consensus
When a new consensus method is negotiated, these values will all get
replaced with "2038-01-01 00:00:00".

This change should be safe because:

  * As of 0.2.9.11 / 0.3.0.7 / 0.3.1.1-alpha, Tor takes no action
    about published_on times in the future.

  * The only remaining parties relying on published_on values are (we
    believe) relays running 0.3.5.x, which rely on the values in a NS
    consensus to see whether their descriptors are out of date.  But
    this patch only changes microdesc consensuses.

  * The latest Tor no longer looks at this field in consensuses.

Why make this change?  In experiments, replacing these values with a
fixed value made the size of compressed consensus diffs much much
smaller.  (Like, by over 50%!)

Implements proposal 275; Implements #40130.
2021-11-09 13:43:48 -05:00
Nick Mathewson
1d2c918dfd Move published_on from routerstatus_t to vote_routerstatus_t.
Nothing breaks here, since all non-voting users of
routerstatus_t.published_on have been adjusted or removed in
previous commits.

We have to expand the API of routerstatus_format_entry() a bit,
though, so that it can always get a published time as argument,
since it can't get it from the routerstatus any more.

This should have no effect on voter behavior.
2021-11-09 13:29:36 -05:00
Nick Mathewson
a7fb5563bc Stop checking published_on in routerstatus_has_visibly_changed()
This function is only used for the controller; and any time that the
published_on time has changed, the digest should also change.
2021-11-09 09:08:48 -05:00
Nick Mathewson
73639fc3c1 Change a log not to use published_on.
It used to describe when the old and new routerinfos were published
when we'd decide to download a routerinfo.  Now it describes what
their descriptor digests are.
2021-11-09 09:07:04 -05:00
Nick Mathewson
08d452b38c Stop using published_on in rs to decide whether to download a routerdesc.
The consensus voters shouldn't actually include such old routers in
the consensus anyway, so this logic shouldn't come up...

but if a client _does_ download something it wouldn't use, it won't
retry infinitely: see checks for WRA_NEVER_DOWNLOADABLE.
2021-11-09 09:06:25 -05:00
Nick Mathewson
db7d067ab1 Retain all routerinfos listed in the consensus.
Previously we'd look at the routerstatus published_on field when
deciding what to dump, which really has no point.  If something's in
the consensus with an ancient published date, then we do want to
keep it.
2021-11-09 08:57:03 -05:00
Roger Dingledine
f9cb7e3398 do notice-level log when we resume having enough dir info
we do a notice-level log when we decide we *don't* have enough dir
info, but in 0.3.5.1-alpha (see commit eee62e13d9, #14950) we lost our
corresponding notice-level log when things come back.

bugfix on 0.3.5.1-alpha; fixes bug 40496.
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
Alexander Færøy
ae05f06597 Merge branch 'tor-gitlab/mr/452_squashed' into main 2021-10-21 12:57:37 +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
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
Mike Perry
6dae9903b1 Turn orconn watermarks into consensus parameters.
Tuning these may reduce memory usage and latency.
2021-10-04 10:45:46 -04:00
Mike Perry
0422eb26a7 Prop#324: Hook up flow control 2021-10-04 10:45:46 -04:00
George Kadianakis
e23947716e Use L2 vanguards during path selection
Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
2021-07-01 18:15:55 +03:00
David Goulet
e9edcea0ca Merge branch 'tor-gitlab/mr/275' 2021-06-29 10:55:46 -04:00
David Goulet
1d18ecbc5f Remove HSv2 leftovers after merging #18346
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-23 12:54:10 -04:00
David Goulet
3bd7367274 Merge branch 'tor-gitlab/mr/327'
Conflicts:
  src/test/test.c

  Minor comment issue.
2021-04-23 12:48:55 -04:00
Nick Mathewson
b5d08ddc09 Update copyrights to 2021, using "make update-copyright" 2021-03-12 11:39:23 -05:00
David Goulet
9f9fed3fd1 vote: Add "stats" line
Closes #40314

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-10 09:51:30 -05:00
Nick Mathewson
ae0aff87ce Choose the correct dirport when contacting an authority.
This is part of an implementation for proposal 330.

This implementation doesn't handle authdirs' IPv6 dirports (yet).
2021-02-24 10:23:20 -05:00
Nick Mathewson
4e977cce40 Add support for knowing multiple HTTP DirPorts for an authority.
(These aren't yet set or used.)
2021-02-24 10:23:20 -05:00
George Kadianakis
830b0f8c62 Merge remote-tracking branch 'tor-gitlab/mr/306' 2021-02-24 12:35:55 +02:00
Neel Chauhan
88559aca2d Make dirauths vote the Sybil flag when other flags are zeroed out 2021-02-19 10:44:11 -08: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
George Kadianakis
9fbedc74c3 Merge branch 'maint-0.4.5' 2021-02-12 13:50:36 +02:00
George Kadianakis
58b5300f44 Merge remote-tracking branch 'tor-gitlab/mr/295' into maint-0.4.5 2021-02-12 13:44:03 +02:00
Nick Mathewson
56f1cab9c1 Don't log supported-protover warnings if consensus is older than Tor.
Previously we would warn in this case... but there's really no
justification for doing so, and it can only cause confusion.

Fixes bug #40281; bugfix on 0.4.0.1-alpha.
2021-02-08 11:52:53 -05:00
David Goulet
22941c5299 Merge branch 'maint-0.4.5' 2021-02-03 09:35:50 -05:00
David Goulet
44b4aa82aa nodelist: Remove merge artefact
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 09:35:45 -05:00