Commit Graph

26029 Commits

Author SHA1 Message Date
Nick Mathewson
98c103d91d Rename write_http_status_line, since it does more now. 2017-09-14 08:39:08 -04:00
Nick Mathewson
2385e3f667 Make missing reason_phrase into a BUG(). 2017-09-14 08:34:58 -04:00
Roger Dingledine
771fb7e7ba get rid of the scary 256-byte-buf landmine 2017-09-14 03:04:20 -04:00
Roger Dingledine
eb429232ef Make dir servers include a "Date:" http header more often
Directory servers now include a "Date:" http header for response
codes other than 200. Clients starting with a skewed clock and a
recent consensus were getting "304 Not modified" responses from
directory authorities, so without a Date header the client would
never hear about a wrong clock.

Fixes bug 23499; bugfix on 0.0.8rc1.
2017-09-14 03:02:37 -04:00
Roger Dingledine
dcd0aea85e get rid of a case where we might log a NULL as %s
this doesn't happen in our current code, and now it can't
2017-09-13 22:43:31 -04:00
Roger Dingledine
3247518f22 fix a copy-pasta issue from long ago 2017-09-13 22:28:06 -04:00
Nick Mathewson
00bf4ed592 Merge branch 'bug23466_squashed' 2017-09-13 14:54:56 -04:00
George Kadianakis
6b794c7ed0 prop224 test: Test client desc expiration in tests.
We enrich the test_client_cache() test in two ways:

a) We check that transitioning time periods also cleans up expired
   descriptors in client memory.

b) We test hs_cache_lookup_as_client() instead of
   lookup_v3_desc_as_client(). The former is a higher level function
   which calls the latter and allows us to test deeper into the
   subsystem.
2017-09-13 14:54:49 -04:00
George Kadianakis
cf8a2b1567 prop224: Set stricter expiration time of cached client descriptors.
In #23466 we discovered that cached descriptors can stay around on the
client-side for up to 72 hours. In reality we only want those descs to
get cached for the duration of the current time period, since after that
TP is gone the client needs to compute a new blinded key to use for the HS.

In this commit we start using the consensus time (if available) when
cleaning up cached client descriptor entries. That makes sense because
the client uses consensus time anyway for connecting to hidden
services (e.g. computing blinded keys and time periods).

If no recent consensus is available, we consider descriptors to be
expired since we will want to fetch new ones when we get a live
consensus to avoid the Roger bug. If we didn't do that, when Roger
desuspends his laptop there would be a race between Tor fetching a new
consensus, and Tor connecting to the HS which would still cause
reachability issues.

We also turned a rev counter check into a BUG, since we should never
receive a descriptor with a strictly smaller rev counter than the one we
already have, except if there is a bug or if the HSDir wants to mess
with us. In any case, let's turn this into a BUG so that we can detect
and debug such cases easily.
2017-09-13 14:54:49 -04:00
Nick Mathewson
dcaf971a01 Merge remote-tracking branch 'teor/bug23470-029' 2017-09-13 09:20:19 -04:00
teor
c86013291b
Stop relays calling directory_fetches_from_authorities on dir downloads
This change refactors find_dl_schedule() to only call dependent functions
as needed. In particular, directory_fetches_from_authorities() only needs
to be called on clients.

Stopping spurious directory_fetches_from_authorities() calls on every
download on public relays has the following impacts:
* fewer address resolution attempts, particularly those mentioned in 21789
* fewer descriptor rebuilds
* fewer log messages, particularly those limited in 20610

Fixes 23470 in 0.2.8.1-alpha.
The original bug was introduced in commit 35bbf2e as part of prop210.
2017-09-13 09:46:17 +10:00
Nick Mathewson
3092c8bb3e Merge branch 'maint-0.3.1' 2017-09-12 17:09:47 -04:00
Nick Mathewson
eb078a3bd5 Merge branch 'maint-0.3.0' into maint-0.3.1 2017-09-12 17:09:47 -04:00
Nick Mathewson
dedafe95fe Merge branch 'maint-0.2.9' into maint-0.3.0 2017-09-12 17:09:47 -04:00
Nick Mathewson
3138fe2e69 Merge branch 'bug15582_029' into maint-0.2.9 2017-09-12 17:09:42 -04:00
Nick Mathewson
9c27f56cd9 Fix torrc-format documentation corner cases
We don't require that the final line be terminated, and we open
windows torrc files in text mode.

Closes ticket 22795.
2017-09-12 16:32:56 -04:00
Nick Mathewson
6ff6738963 Remove redundant items from testing_tor_network_defaults
These items were listed in testing_tor_network_defaults, but had the
same defaults as with the regular settings.

Closes ticket 22532.
2017-09-12 16:23:37 -04:00
Nick Mathewson
d9e2db1efd Avoid sscanf() warnings from openbsd in the unit tests
OpenBSD doesn't like tricks where you use a too-wide sscanf argument
for a too-narrow array, even when you know the input string
statically.  The fix here is just to use bigger buffers.

Fixes 15582; bugfix on a3dafd3f58 in 0.2.6.2-alpha.
2017-09-12 16:01:12 -04:00
Nick Mathewson
d165812416 remove a redundant changes file for 22750 2017-09-12 15:39:06 -04:00
David Goulet
6b4eace248 hs-v3: Stall SOCKS connection when no live consensus available
Fixes #23481

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-12 21:34:26 +03:00
George Kadianakis
f13ca360c9 prop224: Improve docs in time period funcs. 2017-09-12 21:17:35 +03:00
Nick Mathewson
d71a00e91f Merge remote-tracking branch 'dgoulet/ticket23480_032_01' 2017-09-12 11:20:27 -04:00
Nick Mathewson
6c5c74e11e Merge remote-tracking branch 'asn/bug23457_032_01' 2017-09-12 11:10:48 -04:00
David Goulet
98953b1fc2 hs-v3: Rate limit some log statements
Also fix an indentation issue.

Closes #23480

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-12 11:03:13 -04:00
David Goulet
184bd22586 hs: Fix digest256 to base64 issue in a log statement
Part of #23480.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-12 11:03:13 -04:00
Nick Mathewson
26d462c1f0 Merge branch 'ticket21031' 2017-09-12 10:43:34 -04:00
Nick Mathewson
4027bd2e96 Merge branch 'bug23347_squashed' 2017-09-12 10:38:35 -04:00
teor
1b5e34badb Add a missing bridge download status reset
17750 made unused download schedules automatically reset.
But we should make that explicit.
2017-09-12 10:38:25 -04:00
teor
93a8ed3b83 Make clients wait to refresh bridges when they have a recent descriptor
But when clients are just starting, make them try each bridge a few times
before giving up on it.

These changes make the bridge download schedules more explicit: before
17750, they relied on undocumented behaviour and specific schedule
entries. (And between 17750 and this fix, they were broken.)

Fixes 23347, not in any released version of tor.
2017-09-12 10:38:25 -04:00
teor
6370fb77c5 Refactor bridge download statuses to increment on attempt
We were always incrementing bridge download statuses on each attempt,
but we were using the "increment on failure" functions to do it.
And we never incremented them on failure.

No behaviour change.
2017-09-12 10:38:25 -04:00
teor
97249c4f5e Make bridge clients download bridge descriptors immediately
The download schedule tells Tor to wait 15 minutes before downloading
bridge descriptors. But 17750 made Tor ignore that and start immediately.
Since we fixed 17750, Tor waits 15 minutes for bridge client bootstrap,
like the schedule says.

This fixes the download schedule to start immediately, and to try each
bridge 3 times in the first 30 seconds. This should make bridge bootstraps
more reliable.

Fixes 23347.
2017-09-12 10:38:25 -04:00
Nick Mathewson
8eef7fc845 Merge branch 'maint-0.3.1' 2017-09-12 10:30:54 -04:00
Nick Mathewson
befddf6d2a Merge branch 'ticket17857_squashed' into maint-0.3.1 2017-09-12 10:29:00 -04:00
Mike Perry
6689c95d06 Changes file for #17857. 2017-09-12 10:28:45 -04:00
Mike Perry
6d221c8f37 Ticket #17857: Apply padding off-switch to existing connections. 2017-09-12 10:28:45 -04:00
Nick Mathewson
5238210da4 changes file for 22215 2017-09-12 09:58:07 -04:00
Nick Mathewson
035fe2d208 Remove named_map and unnamed_map from networkstatus.c 2017-09-12 09:56:42 -04:00
Neel Chauhan
42b5e3cbb7 Remove networkstatus_nickname_is_unnamed() 2017-09-12 09:52:07 -04:00
Nick Mathewson
4ace1b96ac Add a changes file for 22437. 2017-09-12 09:31:57 -04:00
Nick Mathewson
2bfc490c1e Merge remote-tracking branch 'teor/ticket22437' 2017-09-12 09:30:33 -04:00
Nick Mathewson
80a22f536a Merge branch 'bug23479' 2017-09-12 09:24:54 -04:00
Nick Mathewson
767372f6a0 Merge branch 'maint-0.3.1' 2017-09-12 09:24:34 -04:00
Nick Mathewson
469189d84a Merge branch 'maint-0.3.0' into maint-0.3.1
"ours" merge to avoid torgzip.c change, since torgzip has been replaced.
2017-09-12 09:24:20 -04:00
Nick Mathewson
0729ba2868 Merge branch 'maint-0.2.9' into maint-0.3.0 2017-09-12 09:23:57 -04:00
Nick Mathewson
bac160b4e0 One more implicit fallthrough warning to fix on GCC 7 2017-09-12 09:22:50 -04:00
Nick Mathewson
5bb4e0c88d Whoops -- options_trial_assign() was calling get_options() in #22281
So, move the get_options() call.
2017-09-12 08:40:13 -04:00
teor
d7d8d2c20e
Add v3 hidden service support to make test-network-all
Requires chutney master 50f64ea or later.

Implements ticket 22437.
2017-09-12 17:08:28 +10:00
David Goulet
7150214baf hs-v3: Cancel active descriptor directory connections before uploading
It is possible that two descriptor upload requests are launched in a very
short time frame which can lead to the second request finishing before the
first one and where that first one will make the HSDir send back a 400
malformed descriptor leading to a warning.

To avoid such, cancel all active directory connections for the specific
descriptor we are about to upload.

Note that this race is still possible on the HSDir side which triggers a log
info to be printed out but that is fine.

Fixes #23457

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-12 01:32:04 +03:00
Nick Mathewson
6e4967ef03 Merge remote-tracking branch 'dgoulet/ticket23462_032_01' 2017-09-11 17:57:31 -04:00
Nick Mathewson
eaa8224cef Merge branch 'maint-0.3.0' into maint-0.3.1 2017-09-11 17:49:18 -04:00