summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2017-09-05Resolve inconsistencies between buf refactor and HTTP connectNick Mathewson
2017-09-05Merge branch 'http_tunnel_squashed'Nick Mathewson
2017-09-05Add a fuzzer for HTTP CONNECTNick Mathewson
2017-09-05Make preferred_chunk_size nonstatic, and add a prefix to itNick Mathewson
2017-09-05Refactor buffer APIs to put a buf_t first.Nick Mathewson
By convention, a function that frobs a foo_t should be called foo_frob, and it should have a foo_t * as its first argument. But for many of the buf_t functions, the buf_t was the final argument, which is silly.
2017-09-05Repair buffer API so everything starts with buf_.Nick Mathewson
Our convention is that functions which manipulate a type T should be named T_foo. But the buffer functions were super old, and followed all kinds of conventions. Now they're uniform. Here's the perl I used to do this: \#!/usr/bin/perl -w -i -p s/read_to_buf\(/buf_read_from_socket\(/; s/flush_buf\(/buf_flush_to_socket\(/; s/read_to_buf_tls\(/buf_read_from_tls\(/; s/flush_buf_tls\(/buf_flush_to_tls\(/; s/write_to_buf\(/buf_add\(/; s/write_to_buf_compress\(/buf_add_compress\(/; s/move_buf_to_buf\(/buf_move_to_buf\(/; s/peek_from_buf\(/buf_peek\(/; s/fetch_from_buf\(/buf_get_bytes\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/buf_remove_from_front\(/buf_drain\(/; s/peek_buf_startswith\(/buf_peek_startswith\(/; s/assert_buf_ok\(/buf_assert_ok\(/;
2017-09-05Move the tls parts of buffers.c into buffers_tls.cNick Mathewson
2017-09-05Make buffers.c independent of or.hNick Mathewson
Also, put ext_or function in new module; it had accidentally gotten into proto_socks.c
2017-09-05Make buf_pullup() expose the pulled-up data.Nick Mathewson
This lets us drop the testing-only function buf_get_first_chunk_data(), and lets us implement proto_http and proto_socks without looking at buf_t internals.
2017-09-05Move protocol-specific functions out of buffers.cNick Mathewson
This commit does not change the implementation of any function: it only moves code and adds new includes as necessary. Part of #23149.
2017-09-04Merge remote-tracking branch 'dgoulet/bug23366_032_01'Nick Mathewson
2017-08-31config: Make parse_outbound_addresses() return failuresDavid Goulet
The function was never returning an error code on failure to parse the OutboundAddress* options. In the process, it was making our test_options_validate__outbound_addresses() not test the right thing. Fixes #23366 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-30prop224: Clear list of prev hsdirs before we upload all descs.George Kadianakis
This fixes a serious bug in our hsdir set change logic: We used to add nodes in the list of previous hsdirs everytime we uploaded to a new hsdir and we only cleared the list when we built a new descriptor. This means that our prev_hsdirs list could end up with 7 hsdirs, if for some reason we ended up uploading our desc to 7 hsdirs before rebuilding our descriptor (e.g. this can happen if the set of hsdirs changed). After our previous hdsir set had 7 nodes, then our old algorithm would always think that the set has changed since it was comparing a smartlist with 7 elements against a smartlist with 6 elements. This commit fixes this bug, by clearning the prev_hsdirs list before we upload to all hsdirs. This makes sure that our prev_hsdirs list always contains the latest hsdirs!
2017-08-30prop224 test: Improve desc_reupload_logic() test with more nodes.George Kadianakis
2017-08-30prop224 test: Simplify interface for adding nodes to hash ring.George Kadianakis
We want to have tests with big hash rings so let's make it an one-liner to add nodes.
2017-08-28Merge remote-tracking branch 'asn/bug23343'Nick Mathewson
2017-08-28Temporarily disable compilation of the v3 hs fuzzing codeNick Mathewson
Turns out, it wasn't up-to-date with the latest v3 hs API :(
2017-08-28Fix compilation.Nick Mathewson
2017-08-28Merge remote-tracking branch 'haxxpop/fuzzing-hsv3'Nick Mathewson
2017-08-28In test_establish_intro_wrong_purpose, use tt_i64_op on ssize_tNick Mathewson
Since ssize_t is signed and might be 64 bits, we should use tt_i64_op to make sure it's positive. Otherwise, if it is negative, and we use tt_u64_op, we'll be treating it as a uint64_t, and we won't detect negative values. This fixes CID 1416338 and 1416339. Bug not in any released Tor.
2017-08-28prop224: Add test that exposes the #23343 bug.George Kadianakis
2017-08-25prop224: Refactor descriptor reupload logic.George Kadianakis
We refactor the descriptor reupload logic to be similar to the v2 logic where we update a global 'consider_republishing_rend_descriptors' flag and then we use that to check for hash ring changes during the global hidden service callbacks. This fixes bugs where we would inspect the hash ring immediately as we receive new dirinfo (e.g. consensus) but before running the hidden service housekeeping events. That was leaving us in an inconsistent state wrt hsdir indices and causing bugs all around.
2017-08-24test: Fix memory leak in hs_descriptor/decode_bad_signatureDavid Goulet
Fixes #23319 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24Ensure that `make check-spaces` is happy.Alexander Færøy
The `test-operator-cleanup` patch, and related coccinelle patches, don't do any checks for line length. This patch fixes the line length issues caused by the previous commits.
2017-08-24apply ahf's test_assert_null.cocciNick Mathewson
2017-08-24apply ahf's test_assert_int.cocciNick Mathewson
2017-08-24apply ahf's test_assert_zero.cocciNick Mathewson
2017-08-24Fix operator usage in src/test/*.cAlexander Færøy
This patch fixes the operator usage in src/test/*.c to use the symbolic operators instead of the normal C comparison operators. This patch was generated using: ./scripts/coccinelle/test-operator-cleanup src/test/*.[ch]
2017-08-24Merge remote-tracking branch 'dgoulet/ticket17242_032_03-squashed'Nick Mathewson
2017-08-24prop224: Register RP circuit when it opensDavid Goulet
Only register the RP circuit when it opens and not when we send the INTRODUCE1 cell else, when re-extending to a new IP, we would register the same RP circuit with the same cookie twice leading to the circuit being closed. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24test: Fix broken HS upload descriptor testDavid Goulet
We can't trigger a valid upload because it would require us to MOCK a long list of functions ultimately not really testing the upload because we aren't on a running network. Signed-off-by: David Goulet <dgoulet@torproject.org> Conflicts: src/test/test_hs_service.c
2017-08-24prop224: Add client-side rend circuit support to HS circuitmapGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24test: Add tests for fetching descs and handling SOCKS conns.George Kadianakis
- Add tests that ensure that SOCKS requests for v2/v3 addresses get intercepted and handled. - Add test that stores and lookups an HS descriptor in the client-side cache. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Refactor rendclient.c to use the new hsdir_req code.George Kadianakis
- Also add tests for the hidserv_req subsystem. - Introduce purge_v2_hidserv_req() wrapper to simplify v2 code. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-23Add test_hs_descriptor.inc to include.am to unbreak distcheck.Nick Mathewson
2017-08-2122839: Build tor with rust enabled on winTies Stuij
- make tor_util static library name configurable - fix Rust libary dependency order for Windows
2017-08-21Merge branch 'maint-0.3.1'Nick Mathewson
2017-08-21Merge branch 'bug23291_028' into maint-0.3.1Nick Mathewson
2017-08-2122839: fix check_heap_buffer buffer size in test-memwipeTies Stuij
2017-08-21Merge branch 'maint-0.3.1'Nick Mathewson
2017-08-21whitespace fixesNick Mathewson
2017-08-21Fix triggerable BUG() when decoding hsv3 descriptors.George Kadianakis
Also improve the unittest to make sure it catches the right error.
2017-08-21Add unittest for #23233.George Kadianakis
This will fail currently since the bug is not fixed yet.
2017-08-19prop224: Refactor parse_extended_hostname() to parse v3 addrs.George Kadianakis
We need this func so that we recognize SOCKS conns to v3 addresses. - Also rename rend_valid_service_id() to rend_valid_v2_service_id() - Also move parse_extended_hostname() tests to their own unittest, and add a v3 address to the test as well. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-19prop224: Improve descriptor reupload logic.George Kadianakis
We want to reupload our descriptor if its set of responsible HSDirs changed to minimize reachability issues. This patch adds a callback everytime we get new dirinfo which checks if the hash ring changed and reuploads descriptor if needed.
2017-08-19test: Improve get_responsible_hsdirs test.George Kadianakis
2017-08-19prop224: Only upload descriptor if we have good hash ring and SRV.George Kadianakis
Make sure we have a live consensus (for SRV) and enough descriptors (for hash ring). Also fix unittests that broke.
2017-08-13Fuzz outer layer of hsv3 descriptorSuphanat Chunhapanya
The code in fuzz_hsdescv3.c fuzzes the unencrypted layer of the hsv3 descriptor. We need to fuzz the encrypted layer later.
2017-08-11test: Fix typing issues found by clangDavid Goulet
Partially fix #23224. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-11test: Fix memory leak in test_hs_common.cDavid Goulet
Partially fixes #23223 Signed-off-by: David Goulet <dgoulet@torproject.org>