Commit Graph

10120 Commits

Author SHA1 Message Date
Kevin Butler
5327605caa Tougher validation for parsing urls from HTTP headers. Fixes #2767. 2013-09-03 01:14:43 +01:00
Kevin Butler
b336e8c74e No longer writing control ports to file if updating reversible options fail. Fixes #5605. 2013-09-02 19:25:08 +01:00
Cristian Toader
fe6e2733ab added contingency message to test for sandbox_getaddrinfo 2013-09-02 12:16:02 +03:00
Cristian Toader
1ef0b2e1a3 changed how sb getaddrinfo works such that it supports storing multiple results 2013-09-02 11:44:04 +03:00
Kevin Butler
6e17fa6d7b Added --library-versions flag to print the compile time and runtime versions of libevent, openssl and zlib. Partially implements #6384. 2013-09-01 17:38:01 +01:00
Kevin Butler
1bdb391ed0 Added no_tempfile parameter to write_chunks_to_file to do non-atomic writes. Implements #1376. 2013-09-01 00:24:07 +01:00
Kevin Butler
bb69bf8882 Changed signature for check_nickname_list to remove warnings on free. 2013-08-31 05:14:48 +01:00
Kevin Butler
0513643317 MyFamily option will now fix fingerprints missing their leading instead of complaining. Should fix #4341. 2013-08-31 04:49:04 +01:00
Cristian Toader
d5f43b5254 _array filter functions now rely on final NULL parameter 2013-08-29 15:42:30 +03:00
Cristian Toader
b1f7105506 supporting /dev/urandom instead of /dev/random 2013-08-29 15:22:14 +03:00
Cristian Toader
148c6dc473 updated open syscall strings 2013-08-26 21:19:22 +03:00
Nick Mathewson
a5f6cb908c Increase POLICY_BUF_LEN to 72 to accomodate IPv6 exit policy items.
Fixes bug 9596; bugfix on 0.2.4.7-alpha.
2013-08-26 11:30:09 -04:00
Nick Mathewson
00bcc25d05 Cleanup whitespaces 2013-08-25 12:22:20 -04:00
Nick Mathewson
078d6bcda5 Basic unit test for EVENT_TRANSPORT_LAUNCHED 2013-08-25 11:29:03 -04:00
Nick Mathewson
69312c7a84 Widen event_mask_t to 64 bits 2013-08-25 10:46:53 -04:00
George Kadianakis
6dd462e8bc Implement the TRANSPORT_LAUNCHED control port event. 2013-08-25 10:37:03 -04:00
Nick Mathewson
2452302354 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-08-25 00:34:23 -04:00
Nick Mathewson
8611195a00 Merge remote-tracking branch 'public/bug9546_023_v2' into maint-0.2.3 2013-08-25 00:32:27 -04:00
Nick Mathewson
4107ddd003 Merge remote-tracking branch 'public/bug9546_v2' into maint-0.2.4 2013-08-25 00:31:51 -04:00
Nick Mathewson
1ee1c8fb4f Merge remote-tracking branch 'public/bug9366' into maint-0.2.4 2013-08-25 00:29:49 -04:00
Nick Mathewson
3727a978b8 Merge remote-tracking branch 'public/bug9543' into maint-0.2.4 2013-08-25 00:29:06 -04:00
Roger Dingledine
0fd8f5781b fix typos 2013-08-23 21:43:57 -04:00
Nick Mathewson
223c7da080 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-08-22 20:47:23 -04:00
Nick Mathewson
43f187ec2e Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4 2013-08-22 20:47:10 -04:00
Nick Mathewson
8920fc5457 Hide the contents of the circuit_build_times structure.
There were only two functions outside of circuitstats that actually
wanted to know what was inside this.  Making the structure itself
hidden should help isolation and prevent us from spaghettifying the
thing more.
2013-08-22 10:15:57 -04:00
Nick Mathewson
79cad08b4f Documentation for new cbt accessors 2013-08-22 10:15:56 -04:00
Nick Mathewson
775c491502 Separate mutable/const accessors for circuit_build_times
(These have proved invaluable for other global accessors.)
2013-08-22 10:15:56 -04:00
Nick Mathewson
e1c9b43b8e Rename get_circuit_nbuild_* to end with _ms 2013-08-22 10:15:56 -04:00
vagrant
4834641dce Make circ_times static and add accessor functions.
Change the global circ_times to a static variable and use
accessor functions throughout the code, instead of
accessing it directly.
2013-08-22 10:15:56 -04:00
Nick Mathewson
2530c84220 Replace return with continue in update_consensus_networkstatus_downloads
Fix for bug 9564; bugfix on 0.2.3.14-alpha.
2013-08-22 10:00:37 -04:00
Nick Mathewson
71ec90fdc8 Tweak/cleanup 5526 fix. 2013-08-21 13:41:53 -04:00
Peter Retzlaff
a337d4b7cb Print accounting information in heartbeat messages.
Implements ticket 5526.
2013-08-21 13:26:57 -04:00
Nick Mathewson
af7970b6bc Add a 30-day maximum on user-supplied MaxCircuitDirtiness
Fix for bug 9543.
2013-08-21 11:35:00 -04:00
Nick Mathewson
cbc53a2d52 Make bridges send AUTH_CHALLENGE cells
The spec requires them to do so, and not doing so creates a situation
where they can't send-test because relays won't extend to them because
of the other part of bug 9546.

Fixes bug 9546; bugfix on 0.2.3.6-alpha.
2013-08-21 11:29:19 -04:00
Nick Mathewson
940cef3367 Make bridges send AUTH_CHALLENGE cells
The spec requires them to do so, and not doing so creates a situation
where they can't send-test because relays won't extend to them because
of the other part of bug 9546.

Fixes bug 9546; bugfix on 0.2.3.6-alpha.
2013-08-21 11:28:58 -04:00
Nick Mathewson
0daa26a473 Send NETINFO on receiving a NETINFO if we have not yet sent one.
(Backport to Tor 0.2.3)

Relays previously, when initiating a connection, would only send a
NETINFO after sending an AUTHENTICATE.  But bridges, when receiving a
connection, would never send AUTH_CHALLENGE.  So relays wouldn't
AUTHENTICATE, and wouldn't NETINFO, and then bridges would be
surprised to be receiving CREATE cells on a non-open circuit.

Fixes bug 9546.
2013-08-21 11:28:57 -04:00
Cristian Toader
bc19ea100c make check-spaces fixes 2013-08-21 17:57:15 +03:00
Nick Mathewson
1bb4a4f9bd Send NETINFO on receiving a NETINFO if we have not yet sent one.
Relays previously, when initiating a connection, would only send a
NETINFO after sending an AUTHENTICATE.  But bridges, when receiving a
connection, would never send AUTH_CHALLENGE.  So relays wouldn't
AUTHENTICATE, and wouldn't NETINFO, and then bridges would be
surprised to be receiving CREATE cells on a non-open circuit.

Fixes bug 9546.
2013-08-20 14:52:56 -04:00
Cristian Toader
a9910d89f1 finalised fix on libevent open string issue 2013-08-19 11:41:46 +03:00
Nick Mathewson
a3ffa1f76e Rename circuit_get_global_list to remove trailing _ 2013-08-15 15:37:23 -04:00
Nick Mathewson
d4634d1b72 Merge remote-tracking branch 'majek/bug9108'
Conflicts:
	src/or/circuitlist.h
2013-08-15 15:36:04 -04:00
Nick Mathewson
74262f1571 Merge branch 'bug5040_4773_rebase_3' 2013-08-15 12:04:56 -04:00
George Kadianakis
794447d03d Fix some #5040 bugs found by Nick's tests.
- Set conn->address when we receive a USERADDR command.
- Set conn->state to a sane value when we transition from Extended
  ORPort to ORPort.
2013-08-15 12:03:38 -04:00
George Kadianakis
f549e4c36d Write some free_all functions to free the auth. cookies.
We started allocating space for them on the heap in the previous
commit.

Conflicts:
	src/or/ext_orport.h
2013-08-15 12:03:38 -04:00
George Kadianakis
33c3e60a37 Implement and use a generic auth. cookie initialization function.
Use the generic function for both the ControlPort cookie and the
ExtORPort cookie.

Also, place the global cookie variables in the heap so that we can
pass them around more easily as pointers.

Also also, fix the unit tests that broke by this change.

Conflicts:
	src/or/config.h
	src/or/ext_orport.c
2013-08-15 12:03:37 -04:00
George Kadianakis
13784d4753 Warn if the Extended ORPort listens on a public IP address. 2013-08-15 12:03:37 -04:00
George Kadianakis
bdeddecd29 Better documentation for ext_or_auth_correct_client_hash. 2013-08-15 12:03:37 -04:00
Nick Mathewson
28bb673584 White-box tests for the succeeding case of ext_or_port handshake.
(Okay, white-box plus mocking enough other functions so they don't
crash.)
2013-08-15 12:03:37 -04:00
Nick Mathewson
ba78a3c800 Make 0x01==SAFECOOKIE a macro, not a magic number 2013-08-15 12:03:37 -04:00
Nick Mathewson
d7358e8598 Expose/mock some functions to make ext_orport.c testing possible 2013-08-15 12:03:37 -04:00
Nick Mathewson
4526c3e0b6 Unit test for basic ext_or_cookie authentication backend 2013-08-15 12:03:37 -04:00
Nick Mathewson
b64351ed17 Split the cryptographic part of handle_client_auth_nonce into new fn 2013-08-15 12:03:36 -04:00
George Kadianakis
e1d1d7a8da Fix some ext_orport.c DOCDOCs. 2013-08-15 12:03:36 -04:00
Nick Mathewson
03e3881043 Tests for connection_write_ext_or_command. 2013-08-15 12:03:36 -04:00
Nick Mathewson
c342ea9879 Unit tests for ext_or_id_map. 2013-08-15 12:03:36 -04:00
Nick Mathewson
7da59721a9 Unit tests for fetch_ext_or_cmd 2013-08-15 12:03:36 -04:00
Nick Mathewson
9d8ffa91ce Add a clientmap_entry_free().
Remove a nedless strdup/free pair.
2013-08-15 12:03:36 -04:00
Nick Mathewson
34d02484c0 Fix hash functions for transport_name in client entry 2013-08-15 12:03:35 -04:00
Nick Mathewson
50136b6698 Use memdup_nulterm and check for NULs in handle_cmd_transport 2013-08-15 12:03:35 -04:00
Nick Mathewson
550af7be0a Fix a variety of issues in 4773
memwipe some stack-allocated stuff
Add DOCDOC comments for state machines
Use memdup_nulterm as appropriate
Check for NULs in useraddr
Add a macro so that <= AUTH_MAX has a meaning.
2013-08-15 12:03:35 -04:00
Nick Mathewson
6dd8ff0ad9 Break up <??> differently, and explain why 2013-08-15 12:03:35 -04:00
Nick Mathewson
e4a241af11 Add guards to ext_orport.h, rename get_file to get_file_name 2013-08-15 12:03:34 -04:00
Nick Mathewson
6568424410 Use only uintptr_t for the value of transport_count 2013-08-15 12:03:34 -04:00
George Kadianakis
6ad535e6dc If a single client connects with multiple transports, note all transports. 2013-08-15 12:03:34 -04:00
George Kadianakis
cb54e44587 Fix a number of issues with the #5040 code.
- Don't leak if a transport proxy sends us a TRANSPORT command more
  than once.

- Don't use smartlist_string_isin() in geoip_get_transport_history().
  (pointed out by Nick)

- Use the 'join' argument of smartlist_join_strings() instead of
  trying to write the separator on our own.
  (pointed out by Nick)

- Document 'ext_or_transport' a bit better.
  (pointed out by Nick)

- Be a bit more consistent with the types of the values of 'transport_counts'.
  (pointed out by Nick)
2013-08-15 12:03:34 -04:00
George Kadianakis
b2c7379aec Make check-spaces happy. 2013-08-15 12:03:34 -04:00
Cristian Toader
e2a7b484f4 partial libevent open fix 2013-08-14 23:03:38 +03:00
Cristian Toader
8a85a48b9d attempt to add stat64 filename filters; failed due to getaddrinfo.. 2013-08-12 21:14:43 +03:00
Nick Mathewson
4361795145 Merge remote-tracking branch 'asn/bug9363_take2' 2013-08-12 09:46:54 -04:00
Roger Dingledine
49fd76be05 Merge branch 'maint-0.2.4' 2013-08-10 18:30:20 -04:00
Nick Mathewson
d5cfbf96a2 Fix an uninitialized-read when parsing v3 introduction requests.
Fortunately, later checks mean that uninitialized data can't get sent
to the network by this bug.  Unfortunately, reading uninitialized heap
*can* (in some cases, with some allocators) cause a crash if you get
unlucky and go off the end of a page.

Found by asn.  Bugfix on 0.2.4.1-alpha.
2013-08-10 17:49:51 -04:00
Cristian Toader
44a4464cf6 fixed memory leak, added array filter support 2013-08-10 18:04:48 +03:00
Cristian Toader
89b39db003 updated filters to work with orport 2013-08-09 19:07:20 +03:00
Cristian Toader
b3a8c08a92 orport progress (not functional), nickm suggested fixes 2013-08-07 13:13:12 +03:00
George Kadianakis
0c4baa016f Also test that server transports get written to Tor's state. 2013-08-05 21:05:39 +03:00
Nick Mathewson
b9f9110ac7 Don't allow all ORPort values to be NoAdvertise
Fix for bug #9366
2013-08-05 12:14:48 -04:00
Cristian Toader
356b646976 added execve and multi-configuration support 2013-08-05 15:40:23 +03:00
Cristian Toader
d897690fc7 fixes suggested by nickm 2013-08-05 14:17:46 +03:00
Arlo Breault
506a01bda8 Use size_t for length in replaycache_add_test_and_elapsed()
For consistency with the rest of buffer lengths in Tor.

See #8960
2013-08-04 09:29:22 -04:00
Peter Retzlaff
ebd4ab1506 Prepare patch for ticket 5129 for merging.
- Preserve old eventdns code.
- Add function to close sockets cross-platform, without accounting.
- Add changes/ file.
2013-08-02 09:35:24 -04:00
Nick Mathewson
83a859e24c Merge remote-tracking branch 'origin/maint-0.2.4' 2013-07-31 21:49:30 -04:00
Nick Mathewson
0a0f93d277 Merge remote-tracking branch 'arma/bug9354' into maint-0.2.4 2013-07-31 21:48:48 -04:00
George Kadianakis
5a5147dd2e Fix invalid-read when a managed proxy configuration fails. 2013-07-31 13:56:07 -04:00
Nick Mathewson
904a58d10f Merge branch 'bug9288_rebased'
Conflicts:
	src/test/test_pt.c
2013-07-31 13:51:15 -04:00
Nick Mathewson
22a074caa7 Update pt/configure_proxy until it stops segfaulting 2013-07-31 13:34:16 -04:00
George Kadianakis
99bb6d2937 Modifications to transports.c for the unit tests to work.
Both 'managed_proxy_list' and 'unconfigured_proxies_n' are global
src/or/transports.c variables that are not initialized properly when
unit tests are run.
2013-07-31 13:34:16 -04:00
George Kadianakis
aaf79eb4d3 Write unit tests for configure_proxy(). 2013-07-31 13:34:16 -04:00
George Kadianakis
6e40806025 Fix invalid-read when a managed proxy configuration fails. 2013-07-31 13:34:16 -04:00
Cristian Toader
871e5b35a8 small filter changes; openat as separate function 2013-07-30 19:25:56 +03:00
Roger Dingledine
ff6bb13c02 NumDirectoryGuards now tracks NumEntryGuards by default
Now a user who changes only NumEntryGuards will get the behavior she
expects. Fixes bug 9354; bugfix on 0.2.4.8-alpha.
2013-07-30 12:05:39 -04:00
Cristian Toader
8022def6f0 added openat parameter filter 2013-07-29 16:30:39 +03:00
Cristian Toader
8f9d3da194 Investigated access4 syscall problem, small changes to filter. 2013-07-26 19:53:05 +03:00
Nick Mathewson
d5a5a6a253 Allow {,k,kilo,m,mega,g,giga,t,tera}bit{,s} in torrc
Patch from CharlieB for ticket #9214
2013-07-26 16:07:11 +02:00
Nick Mathewson
221a0159b8 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-07-26 15:42:10 +02:00
Nick Mathewson
11f1b7d9df Avoid assertion failure on unexepcted address family in DNS reply.
Fixes bug 9337; bugfix on 0.2.4.7-alpha.
2013-07-26 15:33:46 +02:00
Cristian Toader
626a2b23de integrated context for dynamic filters 2013-07-25 14:08:02 +03:00
Cristian Toader
3dfe1c0639 initia stages of runtime dynamic filters 2013-07-25 13:25:20 +03:00
Nick Mathewson
5d4b5018be Fix bug9309, and n_noncanonical count/continue code
When we moved channel_matches_target_addr_for_extend() into a separate
function, its sense was inverted from what one might expect, and we
didn't have a ! in one place where we should have.

Found by skruffy.
2013-07-23 05:16:56 -07:00
Cristian Toader
c15d09293b added experimental support for open syscall path param 2013-07-23 14:01:53 +03:00
Nick Mathewson
1d2e8020b7 Fix bug9309, and n_noncanonical count/continue code
When we moved channel_matches_target_addr_for_extend() into a separate
function, its sense was inverted from what one might expect, and we
didn't have a ! in one place where we should have.

Found by skruffy.
2013-07-23 11:52:10 +02:00
Nick Mathewson
18845c5507 Initialize destroy_cell_queue.
Likely fix for the crash bug of #9296, which was introduced through a
combination of #7912 and #8586.  Bugfix not in any released Tor.
2013-07-19 09:49:35 -04:00
Nick Mathewson
e1d3b44495 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-07-18 23:17:57 -04:00
Nick Mathewson
17a960734a Merge remote-tracking branch 'public/bug9295_023' into maint-0.2.4 2013-07-18 23:17:05 -04:00
Nick Mathewson
5977435629 tmp 2013-07-18 23:08:36 -04:00
George Kadianakis
05306ad74f Write extra-info bridge-ip-transports lines. 2013-07-18 14:59:57 -04:00
George Kadianakis
e765d6ed84 Make a channel getter method to retrieve transport names. 2013-07-18 14:59:57 -04:00
George Kadianakis
0ec4e5a698 Add transport information to the GeoIP database. 2013-07-18 14:59:57 -04:00
George Kadianakis
210210f219 Make the Extended ORPort understand the TRANSPORT command. 2013-07-18 14:59:56 -04:00
George Kadianakis
895709db07 Fix logging severities and remove some trivial XXXs. 2013-07-18 14:59:56 -04:00
George Kadianakis
c46f1b810d More Extended ORPort code improvements.
* Change name of init_ext_or_auth_cookie_authentication().
* Add a small comment.
2013-07-18 14:59:56 -04:00
George Kadianakis
d8f74cc439 Move Extended ORPort code to its own module.
Move the code from the connection_or module to ext_orport.

This commit only moves code: it shouldn't modify anything.
2013-07-18 14:59:56 -04:00
George Kadianakis
2207525a69 Satisfy check-spaces. 2013-07-18 14:59:56 -04:00
George Kadianakis
e2e0d09dab Various Extended ORPort code improvements.
* Add documentation.
* Free ext_or_auth_correct_client_hash.
* Use VPORT(ExtORPort) instead of V(ExtORPOrt).
  See dfe03d36c8 for details.
2013-07-18 14:59:56 -04:00
George Kadianakis
85b7c73168 Move USERADDR handling to a dedicated function. 2013-07-18 14:59:56 -04:00
George Kadianakis
4a55e39997 Implement Extended ORPort authentication. 2013-07-18 14:59:56 -04:00
George Kadianakis
93b9f85d41 Prepare codebase for the implementation of Extended ORPort auth. 2013-07-18 14:59:56 -04:00
George Kadianakis
d303228eca Create the Extended ORPort authentication cookie file. 2013-07-18 14:59:55 -04:00
George Kadianakis
ba30d635c5 Document code and change the Extended ORPort command numbers. 2013-07-18 14:59:55 -04:00
Nick Mathewson
8bf0382b22 Skeleton ExtORPort implementation. Needs testing, documentation.
Does not implement TransportControlPort yet.
2013-07-18 14:59:55 -04:00
Nick Mathewson
f45e1fbd5b Start of a unit test for options_validate.
I added this so I could write a unit test for ServerTransportOptions,
but it incidentally exercises the succeed-on-defaults case of
options_validate too.
2013-07-18 14:40:12 -04:00
Nick Mathewson
1e78100b25 Add a test for n_cells_in_circuit_queues 2013-07-18 11:23:45 -04:00
Nick Mathewson
ae64197195 Unit tests for cell queues.
This removes some INLINE markers from functions that probably didn't
need them.
2013-07-18 11:23:45 -04:00
Nick Mathewson
1047e7dcb0 Use TOR_SIMPLEQ for packed_cell_t 2013-07-18 11:23:45 -04:00
Nick Mathewson
27ec1fafe4 Remove a redundant declaration 2013-07-18 08:56:02 -04:00
Nick Mathewson
d7ccb6a3b1 Merge branch 'bug8978_rebase_2'
Conflicts:
	src/test/test_pt.c
2013-07-18 08:48:20 -04:00
Nick Mathewson
b551988ef4 Merge branch 'bug8929_rebase_2' 2013-07-18 08:45:13 -04:00
Nick Mathewson
8a01a7c35b Improve test coverage of 8929 code 2013-07-18 08:45:03 -04:00
George Kadianakis
c71809d403 Insert the environment variable only if we have options to pass. 2013-07-18 08:45:03 -04:00
George Kadianakis
1ee3a0cf44 Place the options in the environment after processing them properly. 2013-07-18 08:45:03 -04:00
George Kadianakis
1a0cf08841 Rename tor_escape_str_for_socks_arg() to something more generic.
Since we are going to be using that function to also escape parameters
passed to transport proxies using environment variables.
2013-07-18 08:45:03 -04:00
George Kadianakis
ea72958f25 Pass characters to be escaped to tor_escape_str_for_socks_arg().
This is in preparation for using tor_escape_str_for_socks_arg() to
escape server-side pluggable transport parameters.
2013-07-18 08:45:02 -04:00
George Kadianakis
08d9807125 Write function that parses ServerTransportOptions torrc lines.
And use it to validate them.
2013-07-18 08:45:02 -04:00
Nick Mathewson
e02b6b99f2 Add a basic unit test for pt_get_extra_info_descriptor_string. 2013-07-18 08:43:53 -04:00
George Kadianakis
924946aaaf Write transport ARGS to extra-info descriptor. 2013-07-18 08:43:52 -04:00
George Kadianakis
8bb2ba13c1 Extract ARGS from SMETHOD line and attach them to transport. 2013-07-18 08:43:52 -04:00
Nick Mathewson
f797ac465f Merge remote-tracking branch 'origin/maint-0.2.4' 2013-07-16 14:49:41 -04:00
Nick Mathewson
c36bdbd535 Re-do a cast in order to make old buggy freebsd gcc happy
Fix for #9254.  Bugfix on 0.2.4.14-alpha.

This is not actually a bug in the Tor code.
2013-07-16 14:48:12 -04:00
Andrea Shepard
9b3a166b44 Eliminate an impossible case in replaycache_scrub_if_needed_internal() 2013-07-16 06:01:50 -07:00
Nick Mathewson
55f5caf096 Appease "make check-spaces" 2013-07-15 17:35:56 -04:00
Nick Mathewson
c0391bae75 Merge remote-tracking branch 'public/fancy_test_tricks'
Conflicts:
	src/common/include.am

Conflict was from adding testsupport.h near where sandbox.h had
already been added.
2013-07-15 12:02:18 -04:00
Peter Palfrader
2cb59be999 Fix two pre-coffee typos 2013-07-15 09:43:37 -04:00
Peter Palfrader
783c52b6df Reject relative control socket paths and emit a warning.
Previously we would accept relative paths, but only if they contained a
slash somewhere (not at the end).

Otherwise we would silently not work.  Closes: #9258.  Bugfix on
0.2.3.16-alpha.
2013-07-15 09:04:17 -04:00
Roger Dingledine
6848e29307 cosmetic cleanups 2013-07-14 02:49:34 -04:00
Nick Mathewson
aac732322a Merge remote-tracking branch 'public/gsoc-ctoader-cap-phase1-squashed' 2013-07-12 17:12:43 -04:00
Nick Mathewson
14d5e7f85e Remove a bogus semicolon spotted by Gisle Vanem 2013-07-11 15:53:35 -04:00
Cristian Toader
f9c1ba6493 Add a basic seccomp2 syscall filter on Linux
It's controlled by the new Sandbox argument.  Right now, it's rather
coarse-grained, it's Linux-only, and it may break some features.
2013-07-11 09:13:13 -04:00
Nick Mathewson
ec6c155f82 Add some basic unit tests for the circuit map data structure.
These show off the new mocking code by mocking the circuitmux code
so that we can test the circuit map code in isolation.
2013-07-10 15:26:34 -04:00
Nick Mathewson
17e9fc09c3 Coverage support: build with --enable-coverage to have tests run with gcov
If you pass the --enable-coverage flag on the command line, we build
our testing binaries with appropriate options eo enable coverage
testing.  We also build a "tor-cov" binary that has coverage enabled,
for integration tests.

On recent OSX versions, test coverage only works with clang, not gcc.
So we warn about that.

Also add a contrib/coverage script to actually run gcov with the
appropriate options to generate useful .gcov files.  (Thanks to
automake, the .o files will not have the names that gcov expects to
find.)

Also, remove generated gcda and gcno files on clean.
2013-07-10 15:22:16 -04:00
Nick Mathewson
a3e0a87d95 Completely refactor how FILENAME_PRIVATE works
We previously used FILENAME_PRIVATE identifiers mostly for
identifiers exposed only to the unit tests... but also for
identifiers exposed to the benchmarker, and sometimes for
identifiers exposed to a similar module, and occasionally for no
really good reason at all.

Now, we use FILENAME_PRIVATE identifiers for identifiers shared by
Tor and the unit tests.  They should be defined static when we
aren't building the unit test, and globally visible otherwise. (The
STATIC macro will keep us honest here.)

For identifiers used only by the unit tests and never by Tor at all,
on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS.

This is not the motivating use case for the split test/non-test
build system; it's just a test example to see how it works, and to
take a chance to clean up the code a little.
2013-07-10 15:20:10 -04:00
Nick Mathewson
f7d654b81e Start work on fancy compiler tricks to expose extra stuff to our tests
This is mainly a matter of automake trickery: we build each static
library in two versions now: one with the TOR_UNIT_TESTS macro
defined, and one without.  When TOR_UNIT_TESTS is defined, we can
enable mocking and expose more functions. When it's not defined, we
can lock the binary down more.

The alternatives would be to have alternate build modes: a "testing
configuration" for building the libraries with test support, and a
"production configuration" for building them without.  I don't favor
that approach, since I think it would mean more people runnning
binaries build for testing, or more people not running unit tests.
2013-07-10 15:20:09 -04:00
Nick Mathewson
fab99844fc Merge remote-tracking branch 'origin/maint-0.2.4' 2013-07-08 11:35:48 -04:00
Nick Mathewson
b34279d3ab Add a comment and a check for why flag indices will be <= 63 2013-07-08 11:35:06 -04:00
Nick Mathewson
15cd79f832 FIx undefined behavior in dirvote.c
Fix a bug in the voting algorithm that could yield incorrect results
 when a non-naming authority declared too many flags. Fixes bug 9200;
 bugfix on 0.2.0.3-alpha.

Found by coverity scan.
2013-07-03 12:01:37 -04:00
Nick Mathewson
0c3d676f9e Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-29 03:51:53 -04:00
Nick Mathewson
c955149271 Give a warning when bufferevents are enabled.
Ticket 9147.
2013-06-29 03:45:40 -04:00
Nick Mathewson
cde1a2ca05 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-24 12:55:29 -04:00
Nick Mathewson
ca6aacce16 Fix bug 9122: don't allow newdefaultoptions to be NULL
(This caused a crash that was reported as bug 9122, but the underlying
behavior has been wrong for a while.)

Fix on 0.2.3.9-alpha.
2013-06-24 12:53:37 -04:00
Marek Majkowski
10480dff01 Fix #5584 - raise awareness of safer logging - warn about potentially unsafe config options 2013-06-24 11:22:34 -04:00
Marek Majkowski
1555876d5f Fix #9108 - make global_circuitlist a doubly linked list 2013-06-20 16:56:54 +01:00
Marek Majkowski
d7538b57b4 Don't access global_circuitlist variable directly. Use a getter instead. 2013-06-20 16:40:05 +01:00
Nick Mathewson
f7986269c3 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-18 14:47:15 -04:00
Nick Mathewson
7c4544e5a4 Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4 2013-06-18 14:45:29 -04:00
Nick Mathewson
60d633c73a Fix some problems with the bug9002 fix.
Fixes bug 9090; bug not in any released Tor.
2013-06-18 11:54:57 -04:00
Nick Mathewson
b5d1fded3d Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-18 10:25:30 -04:00
Nick Mathewson
efa342f5fa Tweak bug9063_redux patch: {n_p}_chan_cells, not {n,p}_conn_cells 2013-06-18 10:25:10 -04:00
Nick Mathewson
d3063da691 Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4
Conflicts:
	src/or/config.c
	src/or/relay.c
2013-06-18 10:23:03 -04:00
Nick Mathewson
c37fdc2eef Merge branch 'bug9063_redux_023_squashed' into maint-0.2.3 2013-06-18 10:16:47 -04:00
Nick Mathewson
2e1fe1fcf9 Implement a real OOM-killer for too-long circuit queues.
This implements "algorithm 1" from my discussion of bug #9072: on OOM,
find the circuits with the longest queues, and kill them.  It's also a
fix for #9063 -- without the side-effects of bug #9072.

The memory bounds aren't perfect here, and you need to be sure to
allow some slack for the rest of Tor's usage.

This isn't a perfect fix; the rest of the solutions I describe on
codeable.
2013-06-18 10:15:16 -04:00
Nick Mathewson
2974c83735 Merge remote-tracking branch 'public/bug9082' 2013-06-17 11:57:55 -04:00
Nick Mathewson
0748c06f7c Fix bug 9082: avoid leak when freeing destroy cell queues
In my #7912 fix, there wasn't any code to remove entries from the
(channel, circuit ID)->circuit map corresponding to queued but un-sent
DESTROYs.

Spotted by skruffy. Fixes bug 9082; bug not in any released Tor.
2013-06-17 11:30:56 -04:00
Nick Mathewson
dc516a5436 Limit hidden service descriptors to at most 10 guard nodes.
Fixes bug 9002; bugfix on 0.1.1.11-alpha (which introduced guard
nodes), or on 0.0.6pre1 (which introduced hidden services).
2013-06-16 20:24:48 -04:00
Andrea Shepard
469bd7a3cf Merge branch 'bug9072-024' into bug9072-025 2013-06-15 02:27:23 -07:00
Andrea Shepard
9e45d940d4 Merge branch 'bug9072-023' into bug9072-024 2013-06-15 02:20:19 -07:00
Andrea Shepard
2a95f31716 Disable middle relay queue overfill detection code due to possible guard discovery attack 2013-06-15 02:16:00 -07:00
Nick Mathewson
6f5a720d15 Merge branch 'circuit_queue_cap-0.2.5-squashed'
Conflicts:
	src/or/relay.c
2013-06-14 01:50:17 -04:00
Nick Mathewson
bd6bd1c9be Fix signed/unsigned comparison warning 2013-06-14 01:41:53 -04:00
Nick Mathewson
c974582291 Increase the limit so leaky pipe might work 2013-06-14 01:40:35 -04:00
Nick Mathewson
79cdf81ec1 Increase the limit so leaky pipe might work 2013-06-14 01:37:22 -04:00
Nick Mathewson
9e8c104ab8 Increase the limit so leaky pipe might work 2013-06-14 01:35:21 -04:00
Andrea Shepard
459aada4d0 Don't queue more cells as a middle relay than the spec allows to be in flight 2013-06-13 21:59:01 -07:00
Andrea Shepard
418c2845d0 Don't queue more cells as a middle relay than the spec allows to be in flight 2013-06-13 21:53:36 -07:00
Andrea Shepard
4cce58d3c2 Don't queue more cells as a middle relay than the spec allows to be in flight 2013-06-13 21:39:04 -07:00
Nick Mathewson
483385d2bd Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-13 21:59:27 -04:00
Nick Mathewson
73ca1cf8b7 Rename networkstatus_dl_interval() -> networkstatus_dl_check_interval() 2013-06-13 12:44:46 -04:00
Nick Mathewson
45424b2ca1 Merge remote-tracking branch 'linus/bug8532' 2013-06-13 12:42:49 -04:00
Nick Mathewson
caa0d15c49 If we write the annotation but not the microdescriptor, rewind.
This fixes bug 9047 (and some parts of 9031, 8922, 8883 that weren't
fixed in 8822).  Bugfix on 0.2.2.6-alpha.
2013-06-13 12:29:01 -04:00
Nick Mathewson
4b781e24fb Merge remote-tracking branch 'public/bug7912_squashed' 2013-06-13 10:31:02 -04:00
Nick Mathewson
e61df2ec65 Fix compile warnings wrt printf formating of int64_t 2013-06-13 10:30:34 -04:00
Andrea Shepard
16f9861b22 Add destroy balance tracking and logging to circuitmux 2013-06-13 10:14:36 -04:00
Nick Mathewson
43d53e6d86 Implementation of a fix for bug 7912
I added the code to pass a destroy cell to a queueing function rather
than writing it immediately, and the code to remember that we
shouldn't reuse the circuit id until the destroy is actually sent, and
the code to release the circuit id once the destroy has been sent...
and then I finished by hooking destroy_cell_queue into the rest of
Tor.
2013-06-13 10:14:00 -04:00
Nick Mathewson
801eea03ad Code to track on a circuit whether it has a "pending" delete cell
This will be used in a fix for bug7912.
2013-06-13 10:14:00 -04:00
Nick Mathewson
2949849143 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-13 09:43:53 -04:00
Nick Mathewson
25dddf7a8f Merge remote-tracking branch 'public/bug8822' into maint-0.2.4 2013-06-13 09:40:32 -04:00
Nick Mathewson
d7d6529898 Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-12 20:55:53 -04:00
Nick Mathewson
75b7cc1785 Merge remote-tracking branch 'andrea/bug8639_v3' into maint-0.2.4 2013-06-12 20:55:35 -04:00
Nick Mathewson
e602c4031b Make all consumers of microdesc_t.body tolerate NULL
This is another fix to try to mitigate recurrences of 8031/8822.
2013-06-12 12:12:11 -04:00
Nick Mathewson
f455686b77 Unmap the microdescriptor cache before replacing it.
This is a reprise of the fix in bdff7e3299d78; 6905c1f6 reintroduced
that bug.  Briefly: windows doesn't seem to like deleting a mapped
file.  I tried adding the PROT_SHARED_DELETE flag to the createfile
all, but that didn't actually fix this issue.  Fortunately, the unit
test I added in 4f4fc63fea should
prevent us from making this particular screw-up again.

This patch also tries to limit the crash potential of a failure to
write by a little bit, although it could do a better job of retaining
microdescriptor bodies.

Fix for bug 8822, bugfix on 0.2.4.12-alpha.
2013-06-12 12:04:33 -04:00
Linus Nordberg
c132427db4 Hide consensus download interval, depending on TestingTorNetwork, in a macro. 2013-06-10 23:04:20 +02:00
Nick Mathewson
c300720bfa Merge remote-tracking branch 'origin/maint-0.2.4' 2013-06-10 12:28:30 -04:00
Nick Mathewson
607b29ae1a Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4 2013-06-10 12:26:39 -04:00