Commit Graph

26279 Commits

Author SHA1 Message Date
David Goulet
0d0b677b64 test: Fix unit tests with latest scheduler changes
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
734dbfa590 sched: Make the scheduler object static
Each type of scheduler implements its own static scheduler_t object and
returns a reference to it.

This commit also makes it a const pointer that is it can only change inside
the scheduler type subsystem but not outside for extra protection.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
bd34a0d30f sched: Compare channel pointer in the socket table
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
e0984b8a51 sched: Make the outbuf table local to run()
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
ba08f8a4ed sched: Make check-spaces happy
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
3d2d8d6841 sched: Extra careful in channel_outbuf_length()
In case we don't have a connection object in the channel, just be careful and
recover.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
14cd8bdd4b sched: Don't expose the global scheduler libevent object
Instead, add wrappers to do the needed action the different scheduler needs
with the libevent object.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
84d18f70f3 sched: Always call on_channel_free() regardless of state
A channel can bounce in the scheduler and bounce out with the IDLE state which
means that if it came in the scheduler once, it has socket information that
needs to be freed from the global hash table.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
7cc9621d11 sched: Add Schedulers torrc option
This option is a list of possible scheduler type tor can use ordered by
priority. Its default value is "KIST,KISTLite,Vanilla" which means that KIST
will be used first and if unavailable will fallback to KISTLite and so on.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
Matt Traudt
6ff8c86ac6 sched: change most asserts to non-fatal BUGs 2017-09-15 11:40:59 -04:00
Matt Traudt
4bc97c6431 sched: revisist compatibility on non-linux systems
Wrap things in HAVE_KIST_SUPPORT until Tor compiles and tests cleanly on
my OS X machine.
2017-09-15 11:40:59 -04:00
Matt Traudt
8ccb2c106a sched: rename scheduler to the_scheduler 2017-09-15 11:40:59 -04:00
Matt Traudt
7f1d643083 sched: validate KIST sched options 2017-09-15 11:40:59 -04:00
Matt Traudt
61fc9c41ad sched: switch to monotonic time; add/fix comments, style, and logs msgs 2017-09-15 11:40:59 -04:00
David Goulet
6e598bbcd8 sched: Add sandbox support for KIST
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
a06f2a0509 sched: Fallback to naive approach if no runtime KIST support
It is possible that tor was compiled with KIST support but the running kernel
has no support for it. In that case, fallback to a naive approach and flag
that we have no kernel support.

At this commit, if the kernel support is disabled, there are no ways to come
back from it other than restarting tor with a kernel that supporst KIST.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
David Goulet
8424c4f35b sched: Detect KIST support at compile time
Add a detection for the KIST scheduler in our build system and set
HAVE_KIST_SUPPORT if available.

Adapt the should use kist function with this new compile option.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
Matt Traudt
dde358667d sched: Implement the KIST scheduler
Closes #12541

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
Matt Traudt
2034e0d1d4 sched: Groundwork before KIST implementation
- HT_FOREACH_FN defined in an additional place because nickm did that
  in an old kist prototype
- Make channel_more_to_flush mockable for future sched tests
- Add empty scheduler_{vanilla,kist}.c files and put in include.am

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
Matt Traudt
b2c56eacdd sched: Remove vanilla sched options that will be going away
- massive change to src/tgest/test_options.c since the sched options
  were added all over the place in it
- removing the sched options caused some tests to pass/fail in new ways
  so I assumed current behavior is correct and made them pass again
   - ex: "ConnLimit must be greater" lines
   - ex: "Authoritative directory servers must" line
- remove test_options_validate__scheduler in prep for new sched tests

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 11:40:59 -04:00
Nick Mathewson
e88fb4f4f8 Merge remote-tracking branch 'catalyst-oniongit/bug23532' 2017-09-15 11:17:18 -04:00
Taylor Yu
e31a7be161 Make NETINFO clock skew detection work on clients
An unnecessary routerlist check in the NETINFO clock skew detection in
channel_tls_process_netinfo_cell() was preventing clients from
reporting NETINFO clock skew to controllers.
2017-09-15 09:49:53 -05:00
Taylor Yu
37fed742d1 Refactor channeltls.c lightly
Refactor some repetitive deep indirections in several functions in
channeltls.c into local variables.
2017-09-15 09:49:53 -05:00
Nick Mathewson
e05414d241 Fix several places where md-using relays would get wrong behavior.
This patch replaces a few calls to router_get_by_id_digest ("do we
have a routerinfo?") with connection_or_digest_is_known_relay ("do
we know this relay to be in the consensus, or have been there some
time recently?").

Found while doing the 21585 audit; fixes bug 23533.  Bugfix on
0.3.0.1-alpha.
2017-09-15 09:35:59 -04:00
Nick Mathewson
199f13755b Merge branch 'maint-0.3.1'
"ours" merge to avoid version bump
2017-09-15 09:33:41 -04:00
Nick Mathewson
b440560b8b bump to 0.3.1.7 2017-09-15 09:33:32 -04:00
Nick Mathewson
2c9f8badbd repair test_key_expiration.sh 2017-09-15 09:04:22 -04:00
Nick Mathewson
a213a32b7c Merge remote-tracking branch 'dgoulet/ticket23310_032_02' 2017-09-15 09:01:22 -04:00
Nick Mathewson
7facfc728e Merge branch 'bug23488' 2017-09-15 08:58:20 -04:00
David Goulet
21564c93ce test: Make check-spaces happy
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 08:34:56 -04:00
David Goulet
44ee5037ea fixup! test: Add HS v3 client-side test for picking intro points
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 08:34:30 -04:00
Martin Kepplinger
8d913cc352 doc: make introduction paragraph point to correct data
doc/HACKING/GettingStarted.md says "you might like reading doc/HACKING",
which the reader obviously is already doing. Instead point to the "torguts"
documents that are mentioned a few lines below too.
2017-09-15 08:18:37 -04:00
Nick Mathewson
c4c4d03412 Merge remote-tracking branch 'asn/bug23531' 2017-09-15 08:16:20 -04:00
Nick Mathewson
123337bbc9 Merge remote-tracking branch 'teor/ticket23528' 2017-09-15 08:15:36 -04:00
Nick Mathewson
72391fce23 Merge remote-tracking branch 'teor/bug23524' 2017-09-15 08:13:45 -04:00
George Kadianakis
88c58078fa prop224: Add changes file for prop224 2017-09-15 13:23:48 +03:00
George Kadianakis
5cc80692b8 prop224: Fix memleak in client_get_random_intro().
The memleak was occuring because of the way ExcludeNodes is handled in
that function. Basically, we were putting excluded intro points extend
infos in a special variable which was never freed. Also, if there were
multiple excluded intro points then that variable was overwritten
everytime leaking more memory. This commit should fix both issues.
2017-09-15 12:46:26 +03:00
George Kadianakis
e9b4624cc5 test: Add HS v3 client-side test for picking intro points
This commit adds a pretty advanced test for the client-side making sure that
picking intro is done properly.

This unittest also reveals a memleak on the client_pick_intro() function which
is fixed by the subsequent commit.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 12:46:26 +03:00
George Kadianakis
29aa400908 test: Improve HS v3 helper for building intro points.
Valid intro points need both legacy key and ipv4.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 12:46:26 +03:00
David Goulet
75ec72f24d test: Unit test for the hs indexes
Using a test vector in python, test both hs_build_hsdir_index() and
hs_build_hs_index().

This commit also adds the hs_build_address.py to EXTRA_DIST which was missing.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-15 12:46:26 +03:00
George Kadianakis
715a8ea81c prop224 test: Enrich the client_service_hsdir_set_sync() test.
Do two major improvements:

a) Make the client pick 6 HSDirs instead of just 1 and make sure they
   all match the service's HSDirs.

b) Test two additional missing scenarios borrowed from the
   test_reachability() test.
2017-09-15 12:46:26 +03:00
teor
42e7d0ea14
Explain the restrictions on divisor in round*_to_next_multiple_of
Closes 23528.
2017-09-15 16:06:17 +10:00
teor
6e87c0b23e
Avoid an instance of the bug warning in any_bridge_descriptors_known()
Part of 23524.
2017-09-15 14:17:41 +10:00
teor
61b5d05358
Make control port download status next attempts consistent
Make download status next attempts reported over the control port
consistent with the time used by tor. This issue only occurs if a
download status has not been reset before  it is queried over the
control port.

Fixes 23525, not in any released version of tor.
2017-09-15 14:11:34 +10:00
teor
033691212a
Make an assert into a BUG warning in the bridge code
If future code asks if there are any running bridges, without checking
if bridges are enabled, log a BUG warning rather than crashing.

Fixes 23524 on 0.3.0.1-alpha
2017-09-15 14:02:22 +10:00
teor
d60e7df2da
Explain where bridge download statuses are initialised
And why we can't initialise them on config

Comment-only change, follow-up to 23347.
2017-09-15 13:50:29 +10:00
Nick Mathewson
d6568bad5e Merge branch 'bug23499' 2017-09-14 17:18:38 -04:00
Nick Mathewson
536df21875 Merge branch 'maint-0.3.1' 2017-09-14 13:22:11 -04:00
Nick Mathewson
2446d4acc5 Merge branch 'maint-0.3.0' into maint-0.3.1
"ours" merge to avoid version bump.
2017-09-14 13:22:04 -04:00
Nick Mathewson
e468498469 Merge branch 'maint-0.2.9' into maint-0.3.0
"ours" merge to avoid version bump.
2017-09-14 13:21:52 -04:00