Nick Mathewson
31838bd783
changes suggested by weasel
2015-01-16 11:46:20 -05:00
Nick Mathewson
485fdcf826
Unify parse_unix_socket_config and parse_port_config
...
This incidentally makes unix SocksSocket support all the same options
as SocksPort.
This patch breaks 'SocksSocket 0'; next will restore it.
Resolves 14254.
2015-01-16 11:35:48 -05:00
Nick Mathewson
bbad23bf37
No, client-side DNS cacheing should not be on by default.
2015-01-16 09:32:22 -05:00
Nick Mathewson
4b23b398a3
Merge branch 'bug8546_squashed'
...
Conflicts:
src/or/connection.c
src/or/or.h
src/or/relay.c
2015-01-16 09:31:50 -05:00
Nick Mathewson
49bdfbabb4
Replace field-by-field copy with memcpy for entry_port_cfg
2015-01-16 09:23:03 -05:00
Nick Mathewson
13dac5e463
Move entry_port_cfg_t fields in entry_connection_t
...
Also rename some options for uniformity, and apply this script:
@@
entry_connection_t *conn;
@@
conn->
+entry_cfg.
\(
isolation_flags
\|
session_group
\|
socks_prefer_no_auth
\|
ipv4_traffic
\|
ipv6_traffic
\|
prefer_ipv6
\|
cache_ipv4_answers
\|
cache_ipv6_answers
\|
use_cached_ipv4_answers
\|
use_cached_ipv6_answers
\|
prefer_ipv6_virtaddr
\)
2015-01-16 09:22:58 -05:00
Nick Mathewson
58d17add5e
Combine entry_port_cfg_t fields in listener_connection_t
...
Also, revise the code using these options with this cocci script:
@@
listener_connection_t *conn;
@@
conn->
+entry_cfg.
\(
isolation_flags
\|
session_group
\|
socks_prefer_no_auth
\|
ipv4_traffic
\|
ipv6_traffic
\|
prefer_ipv6
\|
cache_ipv4_answers
\|
cache_ipv6_answers
\|
use_cached_ipv4_answers
\|
use_cached_ipv6_answers
\|
prefer_ipv6_virtaddr
\)
2015-01-16 09:22:53 -05:00
Nick Mathewson
f444f2b1d3
Split client-specific and server-specific parts of port_cfg_t
...
Also, apply this cocci script to transform accesses. (Plus manual
migration for accesses inside smartlist_foreach loops.)
@@
port_cfg_t *cfgx;
@@
cfgx->
+server_cfg.
\(
no_advertise
\|
no_listen
\|
all_addrs
\|
bind_ipv4_only
\|
bind_ipv6_only
\)
@@
port_cfg_t *cfgx;
@@
cfgx->
+entry_cfg.
\(
isolation_flags
\|
session_group
\|
socks_prefer_no_auth
\|
ipv4_traffic
\|
ipv6_traffic
\|
prefer_ipv6
\|
cache_ipv4_answers
\|
cache_ipv6_answers
\|
use_cached_ipv4_answers
\|
use_cached_ipv6_answers
\|
prefer_ipv6_virtaddr
\)
2015-01-16 09:22:49 -05:00
Nick Mathewson
2329d9fe37
Fix a compilation warning in the unit tests
2015-01-15 12:56:57 -05:00
Nick Mathewson
746bb55851
Ignore warning for redundant decl in openssl/srtp.h
...
Backports some commits from tor master.
2015-01-15 12:38:08 -05:00
Nick Mathewson
3368b0c9f2
Add string for IP_NOW_REDUNDANT in circuit_end_reason_to_control_string
...
Closes 14207; bugfix on 0.2.6.2-alpha.
2015-01-15 11:53:20 -05:00
George Kadianakis
bb56fd1f8f
unittests: use tt_i64_op() instead of tt_int_op() in laplace tests.
...
Do this in even more places to try to fix the build.
2015-01-15 11:08:22 -05:00
Nick Mathewson
a52e549124
Update workqueue implementation to use a single queue for the work
...
Previously I used one queue per worker; now I use one queue for
everyone. The "broadcast" code is gone, replaced with an idempotent
'update' operation.
2015-01-15 11:05:22 -05:00
Roger Dingledine
660a35d97c
fix typo
2015-01-15 11:03:13 -05:00
Nick Mathewson
52d6cb03a7
Merge remote-tracking branch 'andrea/bug12194_alt'
2015-01-15 10:26:35 -05:00
Nick Mathewson
88e36eaf0e
Fix the checkdir/perms test when umask==077
...
Fixes 14215; bugfix on 0.2.6.2-alpha. Reported by "cypherpunks".
2015-01-15 10:24:27 -05:00
Andrea Shepard
f7bb60e202
Add comments in rendclient.c noting that certain functions involved in handling ended HS connection attempts must be idempotent
2015-01-15 15:19:31 +00:00
George Kadianakis
354ddf8712
unittests: use tt_i64_op() instead of tt_int_op() in laplace tests.
2015-01-15 15:14:33 +00:00
George Kadianakis
25e7821bb1
unittests: Change some tt_assert()s to tt_int_op()s.
2015-01-15 14:43:58 +00:00
George Kadianakis
45bc5a0743
Restrict sample values of the Laplace distribution to int64_t.
...
This helps avoid undefined behavior from casting big double values to
int64_t. Fixes #14090 .
2015-01-15 14:43:58 +00:00
Nick Mathewson
3668a4126e
Merge remote-tracking branch 'public/bug13397'
2015-01-14 14:15:29 -05:00
Nick Mathewson
1686f81ac2
Merge remote-tracking branch 'origin/maint-0.2.5'
2015-01-14 13:30:10 -05:00
Nick Mathewson
051ad788e0
Incorporate some comments based on notes from dgoulet
2015-01-14 11:31:14 -05:00
Nick Mathewson
fb5ebfb507
Avoid chan/circ linear lookups for requests
...
The solution I took is to not free a circuit with a pending
uncancellable work item, but rather to set its magic number to a
sentinel value. When we get a work item, we check whether the circuit
has that magic sentinel, and if so, we free it rather than processing
the reply.
2015-01-14 11:31:12 -05:00
Nick Mathewson
6c9c54e7fa
Remove if (1) indentation in cpuworker.c
...
To avoid having diffs turn out too big, I had replaced some unneeded
ifs and fors with if (1), so that the indentation would still work out
right. Now I might as well clean those up.
2015-01-14 11:28:26 -05:00
Nick Mathewson
1e896214e7
Refactor cpuworker to use workqueue/threadpool code.
2015-01-14 11:23:34 -05:00
Nick Mathewson
cc6529e9bb
Fix check-spaces
2015-01-14 11:19:35 -05:00
Nick Mathewson
e5f8c772f4
Test and fix workqueue_entry_cancel().
2015-01-14 11:17:46 -05:00
Nick Mathewson
ebbc177005
Add shutdown and broadcast support to test_workqueue.
2015-01-14 11:17:46 -05:00
Nick Mathewson
81354b081b
Add unit test for thread IDs.
2015-01-14 11:17:43 -05:00
Nick Mathewson
7a63005220
Basic unit test for condition variables.
2015-01-14 11:17:09 -05:00
Nick Mathewson
e47a90a976
"Recursive" locks, not "reentrant" locks. Duh.
2015-01-14 11:12:40 -05:00
Nick Mathewson
d69717f61b
Use correct (absolute) time for pthread_cond_timedwait
2015-01-14 11:09:52 -05:00
Nick Mathewson
9fdc0d0594
Fix windows compilation of condition code
2015-01-14 11:09:51 -05:00
Nick Mathewson
d850ec8574
Fix linux compilation (pipe2 needs _GNU_SOURCE)
2015-01-14 11:09:51 -05:00
Nick Mathewson
74b782645a
Move thread tests into their own module
2015-01-14 11:09:47 -05:00
Nick Mathewson
c51f7c23e3
Test a little more of compat_threads.c
2015-01-14 11:05:56 -05:00
Nick Mathewson
3868b5d210
Rename mutex_for_cond -> mutex_nonreentrant
...
We'll want to use these for other stuff too.
2015-01-14 11:05:56 -05:00
Nick Mathewson
93ad89e9d2
Rename bench_workqueue -> test_workqueue and make it a unit test.
2015-01-14 11:05:56 -05:00
Nick Mathewson
b2db3fb462
Documentation for new workqueue and condition and locking stuff
2015-01-14 11:05:54 -05:00
Nick Mathewson
4abbf13f99
Add a way to tell all threads to do something.
2015-01-14 11:01:21 -05:00
Nick Mathewson
51bc0e7f3d
Isolate the "socketpair or a pipe" logic for alerting main thread
...
This way we can use the linux eventfd extension where available.
Using EVFILT_USER on the BSDs will be a teeny bit trickier, and will
require libevent hacking.
2015-01-14 11:01:19 -05:00
Nick Mathewson
c7eebe237d
Make pending work cancellable.
2015-01-14 10:56:27 -05:00
Nick Mathewson
a82604b526
Initial workqueue implemention, with a simple test.
...
It seems to be working, but more tuning is needed.
2015-01-14 10:56:24 -05:00
Nick Mathewson
6c9363310a
Specialize handling for mutexes allocated for condition variables
...
(These must not be reentrant mutexes with pthreads.)
2015-01-14 10:52:56 -05:00
Nick Mathewson
65016304d2
Add tor_cond_init/uninit
2015-01-14 10:49:59 -05:00
Nick Mathewson
e865248156
Add a timeout to tor_cond_wait; add tor_cond impl from libevent
...
The windows code may need some tweaks for it to compile; I've not
tested it yet.
2015-01-14 10:47:39 -05:00
Nick Mathewson
c2f0d52b7f
Split threading-related code out of compat.c
...
Also, re-enable the #if'd out condition-variable code.
Work queues are going to make us hack on all of this stuff a bit more
closely, so it might not be a terrible idea to make it easier to hack.
2015-01-14 10:41:53 -05:00
Nick Mathewson
518b0b3c5f
Do not log a notice on every socks connection
2015-01-14 09:54:40 -05:00
Nick Mathewson
b72acd725a
More tests as suggested by rl1987
2015-01-14 09:10:35 -05:00
George Kadianakis
220f419da1
New minimum uptime to become an HSDir is 96 hours.
2015-01-14 12:48:09 +00:00
Nick Mathewson
03f783c045
remove a bogus comment
2015-01-13 13:59:39 -05:00
Nick Mathewson
73d1d153dc
remove needless AllowDotExit in test_entryconn_rewrite_mapaddress_automap_onion2
2015-01-13 13:56:59 -05:00
Nick Mathewson
17c568b95c
Fix new unused variable warning in connection_listener_new
2015-01-13 13:45:35 -05:00
Nick Mathewson
73ccf0b33f
Uncomment a test
2015-01-13 13:42:20 -05:00
Nick Mathewson
2b8cebaac0
whitespace fix
2015-01-13 13:11:39 -05:00
Nick Mathewson
d8b7dcca8d
Merge remote-tracking branch 'andrea/ticket12585_v3'
2015-01-13 12:50:55 -05:00
Nick Mathewson
9d0fab9872
Allow MapAddress and Automap to work together
...
The trick here is to apply mapaddress first, and only then apply
automapping. Otherwise, the automap checks don't get done.
Fix for bug 7555; bugfix on all versions of Tor supporting both
MapAddress and AutoMap.
2015-01-13 12:41:15 -05:00
Nick Mathewson
ab6bd78eca
(Disabled, failing) test for the bug in 7555.
2015-01-13 12:26:04 -05:00
Nick Mathewson
f2fb85f970
Remove needless strdup in addressmap_register_virtual_address()
...
Fixes bug 14195. Bugfix on 0.1.0.1-rc.
2015-01-13 12:24:42 -05:00
Nick Mathewson
6cbe016cb1
Fix memory leaks in entryconn tests.
2015-01-13 12:13:46 -05:00
Nick Mathewson
05a80bb46c
More unit tests for rewriting entry connection addresses
2015-01-13 11:08:33 -05:00
Nick Mathewson
2e1ed0815d
Actually set *expires_out in addressmap_rewrite.
...
Fixes 14193; bugfix on 35d08e30d
, which went into 0.2.3.17-beta.
2015-01-13 09:42:23 -05:00
Nick Mathewson
732c885b32
Fix a conversion warning on 32-bit clang
2015-01-12 22:33:10 -05:00
Nick Mathewson
a0b4c2f1bd
On jessie, we need a =, not a ==
2015-01-12 22:30:40 -05:00
Nick Mathewson
7257f2e31d
mktemp wants some Xs
2015-01-12 21:45:41 -05:00
Nick Mathewson
038804e13d
Tweak zero_length_keys.sh and test/include.am to make out-of-tree builds work
2015-01-12 21:28:01 -05:00
Nick Mathewson
bba995e666
Begin writing unit tests for rewrite code
2015-01-12 21:08:43 -05:00
Andrea Shepard
066acaf6b9
Explicitly chmod AF_UNIX sockets to 0600 when *GroupWritable isn't specified
2015-01-13 00:27:04 +00:00
Andrea Shepard
4316bb601a
Remove no-longer-accurate comment from connection.c
2015-01-13 00:21:59 +00:00
Andrea Shepard
cb047f4078
Fix ipv4/ipv6 traffic bits on AF_UNIX socks listeners and remove hacky workarounds for brokenness
2015-01-13 00:18:17 +00:00
Andrea Shepard
f50068b17e
Fix default list handling for parse_unix_socket_config(); avoid clearing whole pre-existing list
2015-01-12 22:12:18 +00:00
Nick Mathewson
2edfdc02a2
Merge remote-tracking branch 'teor/bug13111-empty-key-files-fn-empty'
2015-01-12 14:06:14 -05:00
Nick Mathewson
cacea9102a
reindent cell_queues_check_size()
2015-01-12 13:59:50 -05:00
Nick Mathewson
c2e200cef8
Merge branch 'bug13806_squashed'
...
Conflicts:
src/or/relay.c
2015-01-12 13:59:26 -05:00
Nick Mathewson
3033ba9f5e
When OOM, free cached hidden service descriptors too.
2015-01-12 13:47:52 -05:00
Andrea Shepard
62f297fff0
Kill duplicated code in connection_listener_new()
2015-01-12 16:26:34 +00:00
Anthony G. Basile
8df35a0c88
src/common/compat_libevent.h: include testsupport.h
...
When tor is configured with --enable-bufferevents, the build fails
because compat_libevent.h makes use of the macro MOCK_DECL() which
is defined in testsupport.h, but not included. We add the include.
2015-01-12 01:03:47 -05:00
Nick Mathewson
2d123efe7c
Merge remote-tracking branch 'origin/maint-0.2.5'
2015-01-12 00:59:48 -05:00
Nick Mathewson
c9dd2d1a6a
Merge remote-tracking branch 'public/bug14129_024' into maint-0.2.5
2015-01-12 00:59:29 -05:00
Nick Mathewson
e009c2da51
Fix unused-parameter warning in systemd_watchdog_callback
2015-01-11 11:19:51 -05:00
Tomasz Torcz
a8999acc3b
fix and enable systemd watchdog
...
There were following problems:
- configure.ac wrongly checked for defined HAVE_SYSTEMD; this
wasn't working, so the watchdog code was not compiled in.
Replace library search with explicit version check
- sd_notify() watchdog call was unsetting NOTIFY_SOCKET from env;
this means only first "watchdog ping" was delivered, each
subsequent one did not have socket to be sent to and systemd
was killing service
- after those fixes, enable Watchdog in systemd unit with one
minute intervals
2015-01-11 11:14:32 -05:00
Tomasz Torcz
2aa2d0a1c5
send more details about daemon status to supervisor
...
If running under systemd, send back information when reloading
configuration and gracefully shutting down. This gives administator
more information about current Tor daemon state.
2015-01-11 11:14:14 -05:00
Tomasz Torcz
b17918726d
send PID of the main daemon to supervisor
...
If running under systemd, notify the supervisor about current PID
of Tor daemon. This makes systemd unit simpler and more robust:
it will do the right thing regardless of RunAsDaemon settings.
2015-01-11 11:14:08 -05:00
Nick Mathewson
180ecd6a2b
Merge remote-tracking branch 'teor/nickm-bug13401'
2015-01-11 11:10:23 -05:00
Nick Mathewson
7b51667d63
Merge remote-tracking branch 'origin/maint-0.2.5'
2015-01-11 11:05:31 -05:00
teor
b08cfc65a7
Don't crash on torrc Vi[rtualAddrNetworkIPv[4|6]] with no option value
...
Check for a missing option value in parse_virtual_addr_network
before asserting on the NULL in tor_addr_parse_mask_ports.
This avoids crashing on torrc lines like Vi[rtualAddrNetworkIPv[4|6]]
when no value follows the option.
Bugfix on 0.2.3 (de4cc126cb
on 24 November 2012), fixes #14142 .
2015-01-11 11:05:00 -05:00
Nick Mathewson
715fdfcb7b
document rewrite_result_t and export for testing
2015-01-10 20:16:00 -05:00
Nick Mathewson
cd6a57e3d5
Move stream-closing out of rewrite code
2015-01-10 20:16:00 -05:00
Nick Mathewson
fc2831558c
Split the rewrite part of rewrite-and-attach
...
I'd also like to split out the part that sends early socks responses.
2015-01-10 20:16:00 -05:00
Nick Mathewson
b2663298e9
Fix tortls.c build with GCC<4.6
...
apparantly, "pragma GCC diagnostic push/pop" don't exist with older versions.
Fixes bug in 740e592790f570c446cbb5e6d4a77f842f75; bug not in any
released Tor.
2015-01-10 17:31:48 -05:00
Nick Mathewson
740e592790
Ignore warning for redundant decl in openssl/srtp.h
2015-01-10 16:06:25 -05:00
Nick Mathewson
53ecfba284
Merge remote-tracking branch 'teor/fix-typos'
2015-01-10 16:00:12 -05:00
teor
ac2f90ed00
Speed up hidden service bootstrap by reducing the initial post delay
...
Drop the MIN_REND_INITIAL_POST_DELAY on a testing network to 5 seconds,
but keep the default at 30 seconds.
Reduces the hidden service bootstrap to 25 seconds from around 45 seconds.
Change the default src/test/test-network.sh delay to 25 seconds.
Closes ticket 13401.
2015-01-10 22:34:29 +11:00
teor
f9d57473e1
Create TestingDirAuthVoteHSDir like TestingDirAuthVoteExit/Guard
...
TestingDirAuthVoteHSDir ensures that authorities vote the HSDir flag
for the listed relays regardless of uptime or ORPort connectivity.
Respects the value of VoteOnHidServDirectoriesV2.
Partial fix for bug 14067.
2015-01-10 22:34:28 +11:00
Nick Mathewson
e136606fe8
Smaller RendPostPeriod on test networks
...
This patch makes the minimum 5 seconds, and the default 2 minutes.
Closes 13401.
2015-01-10 22:34:28 +11:00
teor
f8ffb57bc4
Merge branch 'master' of https://git.torproject.org/tor into bug13111-empty-key-files-fn-empty
...
Conflicts:
src/or/connection_edge.c
Merged in favour of origin.
2015-01-10 17:20:06 +11:00
teor
debd7862bb
Test that tor correctly handles zero-length keys
...
Check that tor generates new keys, and overwrites the empty key files.
Test that tor generates new keys when keys are missing (existing
behaviour).
Test that tor does not overwrite key files that already contain data
(existing behaviour).
Tests fixes to bug 13111.
2015-01-10 17:14:29 +11:00
teor
c200ab46b8
Merge branch 'bug14001-clang-warning' into bug13111-empty-key-files-fn-empty
...
Conflicts:
src/or/router.c
Choose newer comment.
Merge changes to comment and function invocation.
2015-01-10 16:34:10 +11:00
teor
5ac26cb7c7
Fix a minor misspelling in util.c
2015-01-10 15:52:55 +11:00