Commit Graph

23810 Commits

Author SHA1 Message Date
rl1987
a549e4f7a3 Remove no-longer needed logging statements 2019-04-02 12:59:37 +03:00
rl1987
eaf071d7da Stop requiring bash in test-network.sh. Make it POSIX compliant 2019-04-02 12:31:57 +03:00
teor
965f0d8912
Merge remote-tracking branch 'tor-github/pr/875' 2019-04-02 11:47:05 +10:00
teor
583ed7c6ec
Merge remote-tracking branch 'tor-github/pr/864' 2019-04-02 11:46:42 +10:00
Nick Mathewson
809a3a748d bug_occurred: a place where we assumed that "buf" was still a buffer
In 9c132a5f9e we replaced "buf" with a pointer and replaced
one instance of snprintf with asprintf -- but there was still one
snprintf left over, being crashy.

Fixes bug 29967; bug not in any released Tor. This is CID 1444262.
2019-03-30 21:07:15 -04:00
Nick Mathewson
9ed02ec282 Merge branch 'ticket29662_squashed' into ticket29662_squashed_merged 2019-03-29 14:28:48 -04:00
rl1987
537ad0bca3 Check for NULL in tor_assertf_nonfatal() 2019-03-29 14:26:13 -04:00
rl1987
9c132a5f9e Refrain from using static buffer for assert failure message; call tor_asprintf() instead 2019-03-29 14:26:03 -04:00
rl1987
a959d7cb98 Use tor_assertf{_nonfatal} in code 2019-03-29 14:25:59 -04:00
rl1987
f66a17444e Silence compiler warnings 2019-03-29 14:25:59 -04:00
teor
194b25f0c7
dircache: Refactor handle_get_next_bandwidth() to use connection_dir_buf_add()
Implements ticket 29897.
2019-03-29 17:26:30 +10:00
rl1987
6ab1929f00
Add connection_dir_buf_add() helper function 2019-03-29 17:25:43 +10:00
Nick Mathewson
c66df27c90 Fix checkIncludes warning about "unusual pattern in src/ext/timeouts/"
Closes ticket 28806.
2019-03-28 16:35:24 -04:00
Nick Mathewson
a7bc47532b test_routerkeys.c: Always check mkdir() return value
After this fix, we have no more unchecked mkdir() calls.

Bug 29939; CID 144254. Bugfix on 0.2.7.2-alpha.
2019-03-28 09:31:13 -04:00
Nick Mathewson
f58587a68d Don't unconditionally deref pub and sub in lint_message_consistency
This can't actually result in a null pointer dereference, since
pub_excl and sub_excl are only set when the corresponding smartlists
are nonempty.  But coverity isn't smart enough to figure that out,
and we shouldn't really be depending on it.

Bug 29938; CID 1444257.  Bug not in any released Tor.
2019-03-28 09:19:23 -04:00
George Kadianakis
00ca3d04cf Merge branch 'tor-github/pr/859' 2019-03-27 14:30:53 +02:00
teor
8991280f89
Merge branch 'maint-0.4.0' 2019-03-27 12:31:37 +10:00
teor
6d188fb4cc
Merge remote-tracking branch 'tor-github/pr/835' into maint-0.4.0 2019-03-27 12:31:07 +10:00
teor
a10d4adc25
Stop assuming that /usr/bin/python3 exists
For scripts that work with python2, use /usr/bin/python.
Otherwise, use /usr/bin/env python3.

Fixes bug 29913; bugfix on 0.2.5.3-alpha.
2019-03-27 11:07:55 +10:00
Nick Mathewson
a47b61f329 Merge branch 'messaging_v3' into messaging_v3_merged 2019-03-26 20:13:49 -04:00
teor
6d057c56f1
Merge remote-tracking branch 'tor-github/pr/820' into maint-0.3.4 2019-03-27 10:01:45 +10:00
Nick Mathewson
203e9138d1 Remove message/subsystem numbers from log messages
Having the numbers in those messages makes some of the unit test
unstable, by causing them to depend on the initialization order of
the naming objects.
2019-03-26 19:56:39 -04:00
teor
c72526f168
Merge branch 'maint-0.4.0' 2019-03-27 09:36:55 +10:00
teor
9ae8d663ea
Merge remote-tracking branch 'tor-github/pr/836' into maint-0.4.0 2019-03-27 09:36:26 +10:00
George Kadianakis
989b6325d6 Merge branch 'tor-github/pr/842' 2019-03-26 16:41:07 +02:00
Nick Mathewson
f32d890531 Merge branch 'bug29805_rebased_squashed' 2019-03-26 09:39:46 -04:00
George Kadianakis
27f24484d4 prob-distr: Some more comments about the initializers.
Based on patches and review comments by Riastradh and Catalyst.

Co-authored-by: Taylor R Campbell <campbell+tor@mumble.net>
Co-authored-by: Taylor Yu <catalyst@torproject.org>
2019-03-26 09:39:40 -04:00
George Kadianakis
08176c2396 prob-distr: Silence some coverity warnings. 2019-03-26 09:39:37 -04:00
George Kadianakis
d11976b8bd Merge branch 'tor-github/pr/709' 2019-03-26 15:34:54 +02:00
George Kadianakis
2790ee3685 Merge branch 'maint-0.4.0' 2019-03-26 15:16:37 +02:00
George Kadianakis
06951cb3fc Merge branch 'tor-github/pr/847' into maint-0.4.0 2019-03-26 15:16:21 +02:00
teor
613c5ff357
Merge remote-tracking branch 'tor-github/pr/724' 2019-03-26 19:31:17 +10:00
teor
0642650865
Merge branch 'maint-0.4.0' 2019-03-26 19:16:06 +10:00
teor
4258728d56
Merge remote-tracking branch 'tor-github/pr/852' into maint-0.4.0 2019-03-26 19:15:46 +10:00
rl1987
4e6ba575a6 Add header guards to ptr_helpers.h 2019-03-26 09:49:32 +02:00
juga0
da7a8d7624
dircache: fix identation and remove unneded goto 2019-03-26 17:41:17 +10:00
juga0
892b918b66
bwauth: remove declaring args, they are now in use 2019-03-26 17:41:13 +10:00
juga0
a4bf3be8bc
test: check that .../bandwidth.z is compressed 2019-03-26 17:41:09 +10:00
juga0
fb4a40c32c
test: Check bw file cache lifetime 2019-03-26 17:41:06 +10:00
juga0
7627134743
bwauth: increment bw file cache lifetime
Increment bw file cache lifetime when serving it by HTTP.
And add a constant to define that lifetime.
2019-03-26 17:41:02 +10:00
juga0
4d3502e45b
bwauth: check and use compression serving bw file 2019-03-26 17:40:58 +10:00
juga0
b75e2539f9
bwauth: check if a bw file could be read
Before serving it by HTTP.
2019-03-26 17:40:54 +10:00
juga0
ee09e5d7ea
bwauth: use flag to do not warn when file is missing
Use flag to do not warn when the bandwidth file is missing trying
to serve it by http.
Also remove double space in the assignement.
2019-03-26 17:40:50 +10:00
juga0
3eacae42b2
Serve bandwidth file used in the next vote
When a directory authority is using a bandwidth file to obtain the
bandwidth values that will be included in the next vote, serve this
bandwidth file at /tor/status-vote/next/bandwidth.z.
2019-03-26 17:40:45 +10:00
teor
3d38d0ca24
Merge branch 'maint-0.4.0' 2019-03-26 16:57:04 +10:00
teor
828033001b
Merge remote-tracking branch 'tor-github/pr/848' into maint-0.4.0 2019-03-26 16:56:45 +10:00
teor
d482913e69
Merge remote-tracking branch 'tor-github/pr/834' 2019-03-26 12:55:48 +10:00
rl1987
669ec64325
Fix CID 1444119
Let's use the same function exit point for BUG() codepath that we're using
for every other exit condition. That way, we're not forgetting to clean up
the memarea.
2019-03-26 12:24:45 +10:00
teor
3af9a51118
test/dir: add a 4th argument to dirserv_read_measured_bandwidths()
Part of 29806.
2019-03-26 11:49:33 +10:00
teor
b76ae3898d
Merge branch 'ticket29806_035_squashed_merged' into ticket29806_040_squashed_merged 2019-03-26 11:48:52 +10:00
Nick Mathewson
ddb31dd583 Rename one case of c_type to c_ptr_type. 2019-03-25 16:35:34 -04:00
Nick Mathewson
3f0bfe1d29 Rename DISPATCH_DEFINE_TYPE() to DISPATCH_REGISTER_TYPE()
Also fix a grammar error in a comment.
2019-03-25 16:35:34 -04:00
Nick Mathewson
28fd4996ac Various documentation notes and tweaks for pubsub 2019-03-25 16:35:34 -04:00
Nick Mathewson
a8ca464cee Log warning messages _before_ exiting because of earlier dcfg failure
This helps diagnostics.
2019-03-25 16:35:34 -04:00
Nick Mathewson
47de9c7b0a Use actual pointers in dispatch_cfg.c.
Previously, I had used integers encoded as pointers.  This
introduced a flaw: NULL represented both the integer zero, and the
absence of a setting.  This in turn made the checks in
cfg_msg_set_{type,chan}() not actually check for an altered value if
the previous value had been set to zero.

Also, I had previously kept a pointer to a dispatch_fypefns_t rather
than making a copy of it.  This meant that if the dispatch_typefns_t
were changed between defining the typefns and creating the
dispatcher, we'd get the modified version.

Found while investigating coverage in pubsub_add_{pub,sub}_()
2019-03-25 16:35:34 -04:00
Nick Mathewson
8d70f21717 Add a test for pubsub_items_clear_bindings() 2019-03-25 16:35:34 -04:00
Nick Mathewson
b11b4b7bb7 Add test for dispatch_send() fast path. 2019-03-25 16:35:34 -04:00
Nick Mathewson
ab6ddc7a33 practracker: split shutdown code out of main.c
This is necessary to get the number of includes in main.c back under
control.  (In the future, we could just use the subsystem manager for
this kind of stuff.)
2019-03-25 16:35:34 -04:00
Nick Mathewson
4bdff5e3e9 practracker compliance: split lint_message into more logical parts 2019-03-25 16:35:34 -04:00
Nick Mathewson
d976cda49f pubsub: add test for items_out in builder_finalize() 2019-03-25 16:35:34 -04:00
Nick Mathewson
3552cd69bd coverage: Exclude lines in pubsub_pub that can only be reached on bug 2019-03-25 16:35:34 -04:00
Nick Mathewson
2e7f80d5f4 pubsub_check.c: Stop accepting NULL prefix, which we never send.
(Our code to handle it was broken, too)
2019-03-25 16:35:34 -04:00
Nick Mathewson
c40bcab85d dispatch: Test behavior of formatting type with no set fmt function. 2019-03-25 16:35:34 -04:00
Nick Mathewson
f74301f8fd Unit test for namemap_fmt_name() 2019-03-25 16:35:34 -04:00
Nick Mathewson
9fb511526a pubsub test: add a test to make sure typefns can't be changed. 2019-03-25 16:35:34 -04:00
Nick Mathewson
beedadbeac Try a different approach to making publish function seem used.
We want the DISPATCH_ADD_PUB() macro to count as making a
DECLARE_PUBLISH() invocation "used", so let's try a new approach
that preserves that idea.  The old one apparently did not work for
some versions of osx clang.
2019-03-25 16:35:34 -04:00
Nick Mathewson
94feec59cf move pubsub_connector_t typedef to pubsub_connect.h 2019-03-25 16:35:34 -04:00
Nick Mathewson
22ad8658cd Correct doxygen @file directives 2019-03-25 16:35:34 -04:00
Nick Mathewson
3d6bf7b36e Document several issues found by Taylor 2019-03-25 16:35:34 -04:00
Nick Mathewson
b4f28b9df8 pubsub: install libevent events separately from the_dispatcher.
Also, add documentation, and fix a free-on-error bug.
2019-03-25 16:35:34 -04:00
Nick Mathewson
6d1abd37e2 Connect the mainloop pubsub dispatcher on startup; free it on shutdown. 2019-03-25 16:35:33 -04:00
Nick Mathewson
02e0a39d39 Add msgtypes.h include to pubsub_build.h
(The header won't compile without it.)
2019-03-25 16:35:33 -04:00
Nick Mathewson
bdeaf7d4b2 Code to manage publish/subscribe setup via subsystem interface.
This commit has the necessary logic to run the publish/subscribe
system from the mainloop, and to initialize it on startup and tear
it down later.
2019-03-25 16:35:33 -04:00
Nick Mathewson
24df14eb09 Pubsub: macros for ease-of-use and typesafety. 2019-03-25 16:35:33 -04:00
Nick Mathewson
a7681525ab Add function to clear publish bindings.
When we clean up, we'd like to clear all the bindings that refer to
a dispatch_t, so that they don't have dangling pointers to it.
2019-03-25 16:35:33 -04:00
Nick Mathewson
271a671822 pubsub: relationship checking functionality
This code tries to prevent a large number of possible errors by
enforcing different restrictions on the messages that different
modules publish and subscribe to.

Some of these rules are probably too strict, and some too lax: we
should feel free to change them as needed as we move forward and
learn more.
2019-03-25 16:35:33 -04:00
Nick Mathewson
9e60482b80 Pubsub: an OO layer on top of lib/dispatch
This "publish/subscribe" layer sits on top of lib/dispatch, and
tries to provide more type-safety and cross-checking for the
lower-level layer.

Even with this commit, we're still not done: more checking will come
in the next commit, and a set of usability/typesafety macros will
come after.
2019-03-25 16:35:33 -04:00
Nick Mathewson
24b945f713 Debug logs to record all messages sent and delivered. 2019-03-25 16:35:33 -04:00
Nick Mathewson
f5683d90be Add a naming system for IDs in dispatch. 2019-03-25 16:35:33 -04:00
Nick Mathewson
e4d3098d4d Low-level dispatch module for publish-subscribe mechanism
This module implements a way to send messages from one module to
another, with associated data types.  It does not yet do anything to
ensure that messages are correct, that types match, or that other
forms of consistency are preserved.
2019-03-25 16:35:33 -04:00
Nick Mathewson
a62ac17198 Add a new inline function to check whether debug logging is on
We already do this in our log_debug() macro, but there are times
when we'd like to avoid allocating or precomputing something that we
are only going to log if debugging is on.
2019-03-25 16:35:33 -04:00
Nick Mathewson
253fea84cf Add a smartlist_grow() function to expand a smartlist
Tests included.
2019-03-25 16:35:33 -04:00
Nick Mathewson
56bda7464f Add a macro for the fairly common "eat next semicolon" syntax trick
You use this when you're defining a macro to be used at file scope,
and you want to require a semicolon afterwards.
2019-03-25 16:35:33 -04:00
Nick Mathewson
0944500a8e Add MESG as a new log domain. 2019-03-25 16:35:33 -04:00
Nick Mathewson
dfd7a7f5b6 Add a type to map names to short identifiers
We'll be using this for four kinds of identifier in dispatch.c
2019-03-25 16:35:33 -04:00
Nick Mathewson
61cebb2035 Minimize the includes in control.c 2019-03-25 14:14:56 -04:00
Nick Mathewson
2917ecaa97 Split command-handling and authentication from control.c 2019-03-25 14:06:56 -04:00
Nick Mathewson
4754e9058b Split getinfo handling into a new control_getinfo.c 2019-03-25 12:49:24 -04:00
Nick Mathewson
a49f506e05 Split all controller events code into a new control_events.c
Also, split the formatting code shared by control.c and
control_events.c into controller_fmt.c.
2019-03-25 12:11:59 -04:00
rl1987
68260e85b5 Move sizeof check to torint.h 2019-03-25 10:17:30 +02:00
Taylor Yu
5d2f5e482e
Correctly report PT vs proxy during bootstrap
Previously, or_connection_t did not record whether or not the
connection uses a pluggable transport. Instead, it stored the
underlying proxy protocol of the pluggable transport in
proxy_type. This made bootstrap reporting treat pluggable transport
connections as plain proxy connections.

Store a separate bit indicating whether a pluggable transport is in
use, and decode this during bootstrap reporting.

Fixes bug 28925; bugfix on 0.4.0.1-alpha.
2019-03-25 14:13:45 +10:00
teor
d4d541c53c
Merge remote-tracking branch 'tor-github/pr/785' 2019-03-25 14:01:20 +10:00
Alexander Færøy
4be522b2e6 Pass NULL to lpApplicationName in CreateProcessA().
When NULL is given to lpApplicationName we enable Windows' "magical"
path interpretation logic, which makes Tor 0.4.x behave in the same way
as previous Tor versions did when it comes to executing binaries in
different system paths.

For more information about this have a look at the CreateProcessA()
documentation on MSDN -- especially the string interpretation example is
useful to understand this issue.

This bug was introduced in commit bfb94dd2ca.

See: https://bugs.torproject.org/29874
2019-03-25 03:10:37 +01:00
rl1987
f09205ef53 Refactor test_utils_general() to fix Coverity warnings 2019-03-24 10:10:52 +02:00
Nick Mathewson
8bc3ac6a84 Bump to 0.4.0.3-alpha-dev 2019-03-23 08:44:36 -04:00
Nick Mathewson
22e72eeaa7 Merge branch 'maint-0.4.0' 2019-03-22 11:17:10 -04:00
Nick Mathewson
4b79b43e3e Merge branch 'bug29693_040_radical_squashed' into maint-0.4.0 2019-03-22 11:17:01 -04:00
George Kadianakis
a5df9402b6 prob-distr: Decrease false positive rate of stochastic tests. 2019-03-22 11:16:30 -04:00
rl1987
7b30f8dc8c Write missing function comments 2019-03-22 13:04:06 +02:00
rl1987
13b28063f9 Compile time check for being able to fit {unsigned} int inside void pointer 2019-03-22 12:57:58 +02:00
teor
f7688cb179
test: Backport the 0.3.4 src/test/test-network.sh to 0.2.9
We need a recent test-network.sh to use new chutney features in CI.

Fixes bug 29703; bugfix on 0.2.9.1-alpha.
2019-03-22 13:20:23 +10:00
teor
15900ab70f
Merge remote-tracking branch 'tor-github/pr/819' 2019-03-22 13:10:47 +10:00
George Kadianakis
5729160253
circpad: Rename circpad_machine_state_t to circpad_machine_runtime_t.
The name of circpad_machine_state_t was very confusing since it was conflicting
with circpad_state_t and circpad_circuit_state_t.

Right now here is the current meaning of these structs:

      circpad_state_t -> A state of the state machine.
      circpad_machine_runtime_t -> The current mutable runtime info of the state machine.
      circpad_circuit_state_t -> Circuit conditions based on which we should apply a machine to the circuit
2019-03-22 09:23:05 +10:00
George Kadianakis
846d379b50
circpad/prob_distr: Use crypto_fast_rng() instead of the old RNG. 2019-03-22 09:22:54 +10:00
Nick Mathewson
ebc7556dd0 Bump version to 0.4.0.3-alpha 2019-03-21 09:36:19 -04:00
teor
091f8688b8
test/dir: add an extra argument to dirserv_read_measured_bandwidths()
Part of 29806.
2019-03-21 12:56:28 +10:00
teor
3adb689fbc
Merge branch 'ticket29806_034_squashed' into ticket29806_035_squashed_merged
Copy and paste the vote=0 code from the old src/or/dirserv.c
to the new src/feature/dirauth/bwauth.c.
2019-03-21 12:04:30 +10:00
juga0
4ab2e9a599
bwauth: Ignore bandwidth file lines with "vote=0"
so that the relays that would be "excluded" from the bandwidth
file because of something failed can be included to diagnose what
failed, without still including these relays in the bandwidth
authorities vote.

Closes #29806.
2019-03-21 12:00:45 +10:00
George Kadianakis
bc64fb4e33
circpad: Don't pad if Tor is in dormant mode.
This is something we should think about harder, but we probably want dormant
mode to be more powerful than padding in case a client has been inactive for a
day or so. After all, there are probably no circuits open at this point and
dormant mode will not allow the client to open more circuits.

Furthermore, padding should not block dormant mode from being activated, since
dormant mode relies on SocksPort activity, and circuit padding does not mess
with that.
2019-03-21 10:29:04 +10:00
rl1987
72e0dc0822 Check roundtrip for each bit of {unsigned} int values 2019-03-20 19:06:40 +02:00
rl1987
280109473f Check more values of int 2019-03-20 19:00:03 +02:00
rl1987
0bc9ed9d38 Move casts to separate C file to prevent compiler from optimising them away 2019-03-20 18:54:11 +02:00
teor
41cd05562f
Merge branch 'maint-0.3.4' into maint-0.3.5 2019-03-20 09:48:03 +10:00
teor
6bf9078ceb
Merge remote-tracking branch 'tor-github/pr/798' into maint-0.3.5 2019-03-20 09:47:31 +10:00
teor
db2ac3b9fe
Merge remote-tracking branch 'tor-github/pr/774' into maint-0.2.9 2019-03-20 09:46:10 +10:00
Nick Mathewson
a80131765a Merge branch 'maint-0.4.0' 2019-03-19 09:32:24 -04:00
teor
17e3eea685
Merge remote-tracking branch 'tor-github/pr/727' into maint-0.3.5 2019-03-19 15:43:05 +10:00
teor
af21d126e6
Merge branch 'bug29706_035_minimal_merge' into bug29706_040_minimal_merge
Comment merge.
2019-03-18 11:30:37 +10:00
teor
55865a2c9c
Merge branch 'bug29706_034_minimal_merge' into bug29706_035_minimal_merge 2019-03-18 11:29:20 +10:00
teor
aec6ee201b
test/sr: update sr_state_free() to sr_state_free_all() in a comment 2019-03-18 11:28:34 +10:00
teor
1d0146e2a2
Merge branch 'bug29706_029_minimal' into bug29706_034_minimal_merge 2019-03-18 11:27:59 +10:00
teor
c44ad396f8
test/sr: Clear SRVs after init, and before setup
Already merged to 0.4.0 and later in tor-github/pr/776.
Backported to 0.2.9 and later with minor comment changes.

Part of 29706.
2019-03-18 11:12:25 +10:00
Nick Mathewson
677384e276 Merge branch 'maint-0.4.0' 2019-03-15 08:59:30 -04:00
Nick Mathewson
1547fd99a6 Merge branch 'bug28656_035_squashed' into maint-0.4.0 2019-03-15 08:59:19 -04:00
teor
532f4c9103 Stop logging a BUG() warning when tor is waiting for exit descriptors
Fixes bug 28656; bugfix on 0.3.5.1-alpha.
2019-03-15 08:57:28 -04:00
Nick Mathewson
1cffacdaf5 Merge branch 'maint-0.4.0' 2019-03-15 08:54:39 -04:00
Nick Mathewson
560ba98dd7 Merge remote-tracking branch 'tor-github/pr/776' into maint-0.4.0 2019-03-15 08:54:30 -04:00
Nick Mathewson
af56dece09 Merge branch 'maint-0.4.0' 2019-03-15 08:53:03 -04:00
Nick Mathewson
94523bffdc Merge remote-tracking branch 'tor-github/pr/791' into maint-0.4.0 2019-03-15 08:52:50 -04:00
David Goulet
aee65084b4 circ: Remove n_mux and p_mux members
They are simply not used apart from assigning a pointer and asserting on the
pointer depending on the cell direction.

Closes #29196.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-03-14 23:54:05 -04:00
Roger Dingledine
a3bc950e42 relays shouldn't close idle rend circuits
Allow connections to single onion services to remain idle without being
disconnected.

Relays acting as rendezvous points for single onion services were
mistakenly closing idle established rendezvous circuits after 60 seconds,
thinking that they are unused directory-fetching circuits that had served
their purpose.

Fixes bug 29665; bugfix on 0.2.1.26.
2019-03-14 12:54:16 +02:00
teor
f3b17a6b26
Merge remote-tracking branch 'tor-github/pr/795' into maint-0.3.4 2019-03-14 06:56:09 +10:00
teor
c03b1b3f08
Merge remote-tracking branch 'tor-github/pr/794' into maint-0.3.4 2019-03-14 06:55:57 +10:00
teor
66f944f79b
Merge branch 'bug28096-029-squashed' into bug28096-034-squashed
Merge the new code, and preserve the #else macro comment from 0.3.4.
2019-03-14 06:53:17 +10:00
teor
2840580cf2
Merge remote-tracking branch 'nickm/bug27073_029' into bug27073_034
Replace == with OP_EQ in test macros.
2019-03-14 06:47:32 +10:00
teor
5606cfae47
Merge remote-tracking branch 'tor-github/pr/771' into maint-0.3.4 2019-03-14 06:41:14 +10:00
teor
8bd9b2a6a0
Merge remote-tracking branch 'tor-github/pr/770' into maint-0.2.9 2019-03-14 06:37:50 +10:00
teor
90301247fd
Merge remote-tracking branch 'tor-github/pr/765' into maint-0.2.9 2019-03-14 06:37:17 +10:00
teor
530304dd77
Merge remote-tracking branch 'tor-github/pr/746' into maint-0.2.9 2019-03-14 06:36:47 +10:00
teor
eaa84234c9
Merge remote-tracking branch 'tor-github/pr/510' into maint-0.2.9 2019-03-14 06:36:11 +10:00
teor
9daae1b302
Merge remote-tracking branch 'tor-github/pr/331' into maint-0.2.9 2019-03-14 06:35:05 +10:00
George Kadianakis
fe78ba855a prob_distr: Better document our public API. 2019-03-13 17:51:19 +02:00
George Kadianakis
8d9f81bc9c prob_distr: Implement type-safe downcasting functions. 2019-03-13 17:51:19 +02:00
Nick Mathewson
cab93930de Merge branch 'pr_722_squashed' 2019-03-13 10:37:37 -04:00
George Kadianakis
a71999462b Fix test prob distr parameters that caused warnings.
They were causing the following warnings in circuitpadding/circuitpadding_sample_distribution:

     src/lib/math/prob_distr.c:1311:17: runtime error: division by zero
     SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/lib/math/prob_distr.c:1311:17 in
     src/lib/math/prob_distr.c:1219:49: runtime error: division by zero
     SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/lib/math/prob_distr.c:1219:49 in

because the distributions were called with erroneous parameters (e.g. geometric
distribution with p=0).

We now defined these test probability distributions with more realistic
parameters.

As far as the circuitpadding_sample_distribution() test is concerned, it
doesn't matter if the distributions return values outside of [0,10] since we
already restrict the values into that interval using min=0 and max=10 (and RTT
estimate is disabled).
2019-03-13 10:36:26 -04:00
Nick Mathewson
58fd864a85 Merge remote-tracking branch 'tor-github/pr/705' 2019-03-13 09:36:47 -04:00
George Kadianakis
cdaff26f91 circpad: Machines MUST have strictly increasing histogram edges.
Add a basic validation function for the histograms. It can be a building block
for the future
2019-03-13 13:35:52 +02:00
George Kadianakis
32c821c47b circpad: Documentation improvements after Nick's review. 2019-03-13 13:22:17 +02:00
teor
a9c3101e21 test/sr: Clear SRVs after init, and before setup
Part of 29706.
2019-03-13 15:29:46 +10:00
Nick Mathewson
065b74fa36 Fix all nonconformant headers' guard macros. 2019-03-12 15:20:22 -04:00
George Kadianakis
18a4f535d3 Merge branch 'maint-0.4.0' 2019-03-12 18:11:53 +02:00
George Kadianakis
0ce32affc2 Merge branch 'tor-github/pr/763' into maint-0.4.0 2019-03-12 18:11:35 +02:00
Nick Mathewson
61adcb22c5 Merge branch 'bug23576-041-rebased-squashed' 2019-03-12 11:10:01 -04:00
teor
680b2afd84 hs: abolish hs_desc_link_specifier_dup()
The previous commits introduced link_specifier_dup(), which is
implemented using trunnel's opaque interfaces. So we can now
remove hs_desc_link_specifier_dup().

Cleanup after bug 22781.
2019-03-12 11:09:53 -04:00
teor
257cea8876 test/hs: minor hs test fixes
Cleanup some bugs discovered during 23576:

* stop copying the first 20 characters of a 40-character hex string
  to a binary fingerprint
* stop putting IPv6 addresses in a variable called "ipv4"
* explain why we do a duplicate tt_int_op() to deliberately fail and
  print a value

Fixes bug 29243; bugfix on 0.3.2.1-alpha.
2019-03-12 11:09:53 -04:00
teor
bb98bc8562 hs: abolish hs_desc_link_specifier_t
The previous commits for 23576 confused hs_desc_link_specifier_t
and link_specifier_t. Removing hs_desc_link_specifier_t fixes this
confusion.

Fixes bug 22781; bugfix on 0.3.2.1-alpha.
2019-03-12 11:09:53 -04:00
Nick Mathewson
c01c6123fa Merge remote-tracking branch 'tor-github/pr/779' 2019-03-12 11:05:27 -04:00
Nick Mathewson
1c9b629284 Merge branch 'maint-0.4.0' 2019-03-12 11:03:47 -04:00
Nick Mathewson
9c9214f2c9 Merge remote-tracking branch 'tor-github/pr/776' into maint-0.4.0 2019-03-12 11:03:37 -04:00
rl1987
e52653e01a USe uintptr_t for unsigned ints 2019-03-12 12:14:22 +02:00
rl1987
052ec08a08 Refrain from doing exhaustive iteration over all values of integers 2019-03-12 12:01:26 +02:00
teor
dfc3e552a3
test/sr: update sr_state_free() to sr_state_free_all()
The function name changed between 0.2.9 and 0.3.4.
2019-03-12 11:34:52 +10:00
teor
c7854933e9
Merge branch bug29706_029_refactor into bug29706_034_refactor 2019-03-12 11:31:52 +10:00
teor
9eeff921ae sr: BUG() on NULL sr_state before doing a state_query_*()
Part of #29706.
2019-03-12 11:14:30 +10:00
teor
0cca554110 sr: Check for replacing a SRV pointer with the same pointer
Check if the new pointer is the same as the old one: if it is, it's
probably a bug:
* the caller may have confused current and previous, or
* they may have forgotten to sr_srv_dup().

Putting NULL multiple times is allowed.

Part of 29706.
2019-03-12 11:14:30 +10:00
Nick Mathewson
733afb52a8 Merge branch 'maint-0.4.0' 2019-03-11 09:45:48 -04:00
Nick Mathewson
a9c84bfd35 Merge remote-tracking branch 'tor-github/pr/756' into maint-0.4.0 2019-03-11 09:45:31 -04:00
rl1987
4773fa6474 Revert "Walk back from requiring bash"
This reverts commit c346eff223.
2019-03-10 18:16:58 +02:00
teor
593fde930f sr: rename srv_dup() to sr_srv_dup() 2019-03-09 12:03:12 +10:00
teor
26e6f56023 sr: Free SRVs before replacing them in state_query_put_()
Refactor the shared random state's memory management so that it actually
takes ownership of the shared random value pointers.

Fixes bug 29706; bugfix on 0.2.9.1-alpha.
2019-03-09 12:03:00 +10:00
teor
9400da9b5e test/sr: Free SRVs before replacing them in test_sr_setup_srv()
Stop leaking parts of the shared random state in the shared-random unit
tests. The previous fix in 29599 was incomplete.

Fixes bug 29706; bugfix on 0.2.9.1-alpha.
2019-03-09 11:59:52 +10:00
Nick Mathewson
c40d53ab39 Merge branch 'pr_719_squashed_040' into maint-0.4.0 2019-03-08 10:25:43 -05:00
Mike Perry
ff410edec0 Bug 29204: Inspect circuit queues before sending padding.
Mitigates OOM conditions at relays.
2019-03-08 10:25:28 -05:00
Nick Mathewson
e47e60c12e Merge branch 'pr_719_squashed' 2019-03-08 10:24:00 -05:00
Mike Perry
cd67911033 Bug 29204: Inspect circuit queues before sending padding.
Mitigates OOM conditions at relays.
2019-03-08 10:23:47 -05:00
teor
e91b999cf2
Merge branch 'bug23512-v4-029-fixes-keep-typedef' into bug23512-v4-034-fixes 2019-03-08 19:37:18 +10:00
teor
08ddf1f62b
Merge remote-tracking branch 'bug28525_029' into maint-0.3.5 2019-03-08 12:33:00 +10:00
Neel Chauhan
63b4049114
Make tor_addr_is_internal_() RFC6598 (Carrier Grade NAT) aware
Fixes 28525.
2019-03-08 12:19:12 +10:00
Nick Mathewson
d3fc9aef93 Merge branch 'maint-0.4.0' 2019-03-07 08:57:02 -05:00
Nick Mathewson
3af943dcd1 Merge remote-tracking branch 'tor-github/pr/745' into maint-0.4.0 2019-03-07 08:56:35 -05:00
Nick Mathewson
918bda25ad Merge branch 'maint-0.4.0' 2019-03-06 14:29:48 -05:00
Nick Mathewson
9b4ecbaa7d Merge branch 'maint-0.3.5' into maint-0.4.0 2019-03-06 14:29:43 -05:00
Nick Mathewson
d6f77b99da Merge branch 'maint-0.3.4' into maint-0.3.5 2019-03-06 14:29:38 -05:00
Nick Mathewson
155b0f5521 Merge branch 'maint-0.3.3' into maint-0.3.4 2019-03-06 14:29:33 -05:00
Nick Mathewson
0c9cd7c487 Merge branch 'maint-0.2.9' into maint-0.3.3 2019-03-06 14:29:29 -05:00
Karsten Loesing
2e74edb53e Update geoip and geoip6 to the March 4 2019 database. 2019-03-06 11:45:27 +01:00
Nick Mathewson
f1890707cc Merge branch 'maint-0.4.0' 2019-03-05 13:00:07 -05:00
David Goulet
a999cb43df protover: Add missing Padding to translate_to_rust
This commit also explicitly set the value of the PRT enum so we can match/pin
the C enum values to the Rust one in protover/ffi.rs.

Fixes #29631

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-03-05 12:33:43 -05:00
Nick Mathewson
d24acc008d Merge remote-tracking branch 'tor-github/pr/759' 2019-03-05 12:01:28 -05:00
Nick Mathewson
72751f0c30 Merge remote-tracking branch 'tor-github/pr/680' 2019-03-05 11:53:31 -05:00
rl1987
b6813845cf Also add tor_assertf_nonfatal() 2019-03-05 16:46:40 +02:00
rl1987
f236c9e7f9 Introduce tor_assertf() to allow logging extra error message on assert failure
With format string support!
2019-03-05 16:46:40 +02:00
David Fifield
4578c3eb21 Set TOR_PT_EXIT_ON_STDIN_CLOSE=1 for client transports too.
Closes #25614.
2019-03-05 15:24:31 +01:00
George Kadianakis
c5da1f1cd5 Merge branch 'tor-github/pr/723' 2019-03-04 18:55:28 +02:00
George Kadianakis
fe2552ad65 Merge branch 'tor-github/pr/739' 2019-03-04 18:52:19 +02:00
teor
f186f21a4e
doc: Fix an incorrect comment about calling FreeLibrary() on Windows
There's an incorrect comment in compat_time.c that suggests we call
FreeLibrary() before we're done using the library's functions.
See 29642 for background.

Closes ticket 29643.
2019-03-04 11:29:15 +10:00
teor
e52d725977
doc: Improve the monotonic time module and function documentation
Explain what "monotonic" actually means, and document some results that
have surprised people.

Fixes bug 29640; bugfix on 0.2.9.1-alpha.
2019-03-04 11:25:14 +10:00
rl1987
5d53862139 Split crypto_digest.c
* Move out code that depends on NSS to crypto_digest_nss.c
* Move out code that depends on OpenSSL to crypto_digest_openssl.c
* Keep the general code that is not specific to any of the above in
  crypto_digest.c
2019-03-02 20:07:05 +02:00
David Goulet
13e93bdfd5 Merge branch 'tor-github/pr/718' 2019-03-01 09:36:23 -05:00
Nick Mathewson
cb0d403049 Merge remote-tracking branch 'tor-github/pr/677' 2019-03-01 08:22:43 -05:00
Nick Mathewson
64f594499a Document crypto_fast_rng_one_in_n. 2019-03-01 08:20:54 -05:00
teor
7786198eef
Merge remote-tracking branch 'tor-github/pr/749' into maint-0.2.9 2019-03-01 14:15:00 +10:00
teor
c1ab538479
Merge remote-tracking branch 'tor-github/pr/748' into maint-0.2.9 2019-03-01 14:14:51 +10:00
teor
ecbc2e80a0
Merge remote-tracking branch 'tor-github/pr/747' into maint-0.2.9 2019-03-01 14:14:26 +10:00
Mike Perry
e8d84b18aa
Bug 25733: Avoid assert failure if all circuits time out.
Prior to #23100, we were not counting HS circuit build times in our
calculation of the timeout. This could lead to a condition where our timeout
was set too low, based on non HS circuit build times, and then we would
abandon all HS circuits, storing no valid timeouts in the histogram.

This commit avoids the assert.
2019-03-01 13:48:01 +10:00
Kris Katterjohn
389ee834b6
Log the correct "auto" port number for listening sockets
When "auto" was used for the port number for a listening socket, the
message logged after opening the socket would incorrectly say port 0
instead of the actual port used.

Fixes bug 29144; bugfix on 0.3.5.1-alpha

Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-03-01 12:34:21 +10:00
Nick Mathewson
d5f6137547 Merge branch 'maint-0.4.0' 2019-02-28 11:22:06 -05:00
Nick Mathewson
dc19d65c3b Merge remote-tracking branch 'tor-github/pr/728' into maint-0.4.0 2019-02-28 11:20:26 -05:00
teor
9b7cdd23de
doc: update the man page and sample torrc for ExitRelay
We changed the default of ExitRelay in #21530 in 0.3.5.1-alpha, but
forgot to update the documentation.

Closes 29612.
2019-02-28 11:22:20 +10:00
teor
de0969ef78
Merge branch 'maint-0.3.4' into maint-0.3.5 2019-02-28 10:49:33 +10:00
teor
6a61a020ee
Merge branch 'maint-0.3.3' into maint-0.3.4 2019-02-28 10:49:19 +10:00
teor
be29dfedd9
Merge branch 'maint-0.3.4' into maint-0.3.5 2019-02-28 10:45:59 +10:00
teor
524731503e
Merge branch 'maint-0.3.3' into maint-0.3.4 2019-02-28 10:45:44 +10:00
teor
3313444ef0
Merge branch 'maint-0.2.9' into maint-0.3.3 2019-02-28 10:45:30 +10:00
Neel Chauhan
c142e3d1e6 Set CIRCLAUNCH_NEED_UPTIME in rend_service_relaunch_rendezvous() on a hs_service_requires_uptime_circ() 2019-02-27 17:37:10 -05:00
Nick Mathewson
761eb4cf79 Merge branch 'maint-0.4.0' 2019-02-27 09:59:42 -05:00
Nick Mathewson
56f01e58b4 Merge remote-tracking branch 'tor-github/pr/731' into maint-0.4.0 2019-02-27 09:59:33 -05:00
teor
d4b7975ce7 test/shared-random: use sr_state_free_all() rather than sr_state_free()
sr_state_free() was renamed to sr_state_free_all() between 0.2.9 and 0.3.3.

Part of 29599.
2019-02-27 15:06:53 +10:00
teor
64e082e892 Merge branch 'bug29599_029' into bug29599_033 2019-02-27 15:06:39 +10:00
teor
4d9eb4dd0e test/shared-random: Stop leaking shared random state in the unit tests
Stop leaking parts of the shared random state in the shared-random unit
tests.

Fixes bug 29599; bugfix on 0.2.9.1-alpha.
2019-02-27 15:04:40 +10:00
teor
15dc33849e
Merge branch 'maint-0.3.4' into maint-0.3.5 2019-02-27 09:38:04 +10:00
teor
1a194beb2c
Merge branch 'maint-0.3.3' into maint-0.3.4 2019-02-27 09:37:50 +10:00
teor
6c966b894c
Merge branch 'maint-0.2.9' into maint-0.3.3 2019-02-27 09:37:36 +10:00
David Goulet
b402a0887f Merge branch 'tor-github/pr/655' 2019-02-26 11:30:44 -05:00
David Goulet
2a44ee9b8c Merge branch 'maint-0.4.0' 2019-02-26 11:25:16 -05:00
David Goulet
a5dd41b9af Merge branch 'tor-github/pr/638' into maint-0.4.0 2019-02-26 11:24:43 -05:00
Alexander Færøy
aa360b255b Fix crash bug in PT subsystem.
This patch fixes a crash bug (assertion failure) in the PT subsystem
that could get triggered if the user cancels bootstrap via the UI in
TorBrowser. This would cause Tor to call `managed_proxy_destroy()` which
called `process_free()` after it had called `process_terminate()`. This
leads to a crash when the various process callbacks returns with data
after the `process_t` have been freed using `process_free()`.

We solve this issue by ensuring that everywhere we call
`process_terminate()` we make sure to detach the `managed_proxy_t` from
the `process_t` (by calling `process_set_data(process, NULL)`) and avoid
calling `process_free()` at all in the transports code. Instead we just
call `process_terminate()` and let the process exit callback in
`managed_proxy_exit_callback()` handle the `process_free()` call by
returning true to the process subsystem.

See: https://bugs.torproject.org/29562
2019-02-26 15:43:09 +01:00
Nick Mathewson
732855c2e5 Merge branch 'maint-0.4.0' 2019-02-26 07:27:50 -05:00
Nick Mathewson
35257a1c69 Merge remote-tracking branch 'tor-github/pr/726' into maint-0.4.0 2019-02-26 07:27:42 -05:00
George Kadianakis
57d33b5786 Merge branch 'tor-github/pr/698' 2019-02-26 12:35:14 +02:00
George Kadianakis
7fbfdf2af7 Merge branch 'tor-github/pr/611' 2019-02-26 12:33:23 +02:00
Nick Mathewson
e138bb8ffc
Downgrade some LOG_ERR messages in the address/* tests to warnings
Fixes bug 29530, where the LOG_ERR messages were occurring when
we had no configured network, and so we were failing the unit tests
because of the recently-merged #28668.

Commit message edited by teor:

We backported 28668 and released it in 0.3.5.8.
This commit backports 29530 to 0.3.5.

Fixes bug 29530 in Tor 0.3.5.8.
2019-02-26 09:53:59 +10:00
Kris Katterjohn
1b9e77349f Fix some error-checking logic and a misleading error message
When IPv4Only (IPv6Only) was used but the address could not be
interpreted as a IPv4 (IPv6) address, the error message referred
to the wrong IP version.

This also fixes up the error-checking logic so it's more precise
about what's being checked.

Fixes bug 13221; bugfix on 0.2.3.9-alpha

Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-02-25 16:03:42 -06:00
Nick Mathewson
626e6d2c39 Merge remote-tracking branch 'tor-github/pr/684' 2019-02-25 13:33:39 -05:00
rl1987
d731ab4583 Check that all valid values of int and unsigned int can be put into void pointer 2019-02-25 20:04:02 +02:00
Nick Mathewson
065e7da8e6 Re-enable and fix unit test for nofork mappings
This test was previously written to use the contents of the system
headers to decide whether INHERIT_NONE or INHERIT_ZERO was going to
work.  But that won't work across different environments, such as
(for example) when the kernel doesn't match the headers.  Instead,
we add a testing-only feature to the code to track which of these
options actually worked, and verify that it behaved as we expected.

Closes ticket 29541; bugfix not on any released version of Tor.
2019-02-25 08:55:25 -05:00
George Kadianakis
18de065cbb Switch an int32_t bin to a circpad_hist_index_t. 2019-02-25 14:01:55 +02:00
George Kadianakis
71c11d7306 document picking infinity bin 2019-02-25 13:59:18 +02:00
George Kadianakis
331a067ae3 Fix dist_min_usec documentation and naming. 2019-02-25 13:46:58 +02:00
George Kadianakis
341cd6ea66 histogram_edges is histogram_len long 2019-02-25 13:28:35 +02:00
Nick Mathewson
69238ca2da Merge remote-tracking branch 'tor-github/pr/646' 2019-02-24 17:17:16 -05:00
Nick Mathewson
34601105a3 Merge branch 'ticket29065_squashed' 2019-02-24 17:02:35 -05:00
rl1987
b7dced893a Fix shellcheck SC2006 warnings in test_switch_id.sh 2019-02-24 17:02:06 -05:00
Neel Chauhan
df8ad64735 When a DirAuth checks reachability on itself and has IPv6, mark it as reachable 2019-02-22 13:36:02 -05:00
George Kadianakis
f229a33685 Merge remote-tracking branch 'nickm/thread_rng' 2019-02-22 16:07:57 +02:00
rl1987
c346eff223 Walk back from requiring bash
Refrain from using bash array to remember $@.
2019-02-21 21:09:40 +02:00
Nick Mathewson
1bff5646e6 Bump to 0.4.0.2-alpha-dev 2019-02-21 13:25:33 -05:00
Nick Mathewson
955ca72f95 Bump to 0.3.5.8-dev 2019-02-21 13:24:42 -05:00
Nick Mathewson
a56b9501f1 Bump to 0.3.4.11-dev 2019-02-21 13:23:46 -05:00
Nick Mathewson
fb309f6eba Bump to 0.3.3.12-dev 2019-02-21 13:22:56 -05:00