]> git.ipfire.org Git - thirdparty/tor.git/log
thirdparty/tor.git
7 years agontor_ref.py: pass only strings to subprocess.Popen
Nick Mathewson [Mon, 2 Jul 2018 18:04:46 +0000 (14:04 -0400)] 
ntor_ref.py: pass only strings to subprocess.Popen

Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug introduced in f4be34f70d6f277a0f3f73e, which
was apparently intended itself as a Python3 workaround.

7 years agoFinally remove our EOL@EOF check.
Nick Mathewson [Mon, 18 Jun 2018 20:10:47 +0000 (16:10 -0400)] 
Finally remove our EOL@EOF check.

This check was added by mistake long ago.  It will be nice to see
these EOLs disappear from our code over time.

(backport from master)

7 years agoFix a memory error in test_shared_random
Nick Mathewson [Fri, 29 Jun 2018 17:49:02 +0000 (13:49 -0400)] 
Fix a memory error in test_shared_random

Bug not in any released Tor.

7 years agoChanges file for 26467
Nick Mathewson [Fri, 29 Jun 2018 17:04:29 +0000 (13:04 -0400)] 
Changes file for 26467

7 years agoMerge remote-tracking branch 'ahf-github/maint-0.2.9' into maint-0.2.9
Nick Mathewson [Fri, 29 Jun 2018 17:00:52 +0000 (13:00 -0400)] 
Merge remote-tracking branch 'ahf-github/maint-0.2.9' into maint-0.2.9

7 years agoMerge branch 'feature26372_029' into maint-0.2.9
Nick Mathewson [Tue, 26 Jun 2018 13:21:55 +0000 (09:21 -0400)] 
Merge branch 'feature26372_029' into maint-0.2.9

7 years agoFix memory leak in test_sr_setup_commits().
Alexander Færøy [Sat, 23 Jun 2018 09:31:59 +0000 (11:31 +0200)] 
Fix memory leak in test_sr_setup_commits().

This patch fixes a memory leak in test_sr_setup_commits() where the
place_holder is allocated, but never freed again.

See: Coverity CID 1437440.

7 years agoFix memory leak in disk_state_parse_commits().
Alexander Færøy [Sat, 23 Jun 2018 09:28:00 +0000 (11:28 +0200)] 
Fix memory leak in disk_state_parse_commits().

This patch fixes a memory leak in disk_state_parse_commits() where if
commit is NULL, we continue the internal loop, but without ever freeing
the args variable.

See: Coverity CID 1437441.

7 years agoFix memory leak in frac_nodes_with_descriptors().
Alexander Færøy [Sat, 23 Jun 2018 01:24:10 +0000 (03:24 +0200)] 
Fix memory leak in frac_nodes_with_descriptors().

This patch fixes a memory leak in frac_nodes_with_descriptors() where
we might return without free'ing the bandwidths variable.

See: Coverity CID 1437451.

7 years agoFix potential memory leak in test_hs_auth_cookies().
Alexander Færøy [Sat, 23 Jun 2018 01:17:09 +0000 (03:17 +0200)] 
Fix potential memory leak in test_hs_auth_cookies().

This patch fixes a potential memory leak in test_hs_auth_cookies() if a
test-case fails and we goto the done label where no memory clean up is
done.

See: Coverity CID 1437453

7 years agoPrefer recent Python 3 in autoconf.
Nick Mathewson [Thu, 21 Jun 2018 13:28:50 +0000 (09:28 -0400)] 
Prefer recent Python 3 in autoconf.

Closes ticket 26372.

7 years agoAdd .editorconfig to follow coding standards style
juga0 [Sun, 3 Jun 2018 10:44:02 +0000 (10:44 +0000)] 
Add .editorconfig to follow coding standards style

7 years agoMerge branch 'dannenberg_ipv6_029' into maint-0.2.9
Nick Mathewson [Tue, 12 Jun 2018 13:44:13 +0000 (09:44 -0400)] 
Merge branch 'dannenberg_ipv6_029' into maint-0.2.9

7 years agoAdd a changelog entry.
Linus Nordberg [Sun, 10 Jun 2018 11:09:38 +0000 (13:09 +0200)] 
Add a changelog entry.

7 years agoAdd IPv6 orport address for dannenberg.
Linus Nordberg [Sun, 10 Jun 2018 09:07:00 +0000 (11:07 +0200)] 
Add IPv6 orport address for dannenberg.

7 years agoUpdate geoip and geoip6 to the June 7 2018 database.
Karsten Loesing [Mon, 11 Jun 2018 19:58:55 +0000 (21:58 +0200)] 
Update geoip and geoip6 to the June 7 2018 database.

7 years agoAvoid out-of-bounds smartlist access in protover_compute_vote()
rl1987 [Mon, 4 Jun 2018 09:27:10 +0000 (12:27 +0300)] 
Avoid out-of-bounds smartlist access in protover_compute_vote()
and contract_protocol_list()

7 years agoMerge branch 'bug26116_029' into maint-0.2.9
Nick Mathewson [Thu, 24 May 2018 13:39:46 +0000 (09:39 -0400)] 
Merge branch 'bug26116_029' into maint-0.2.9

7 years agoAdd a unit test for PEM-encrypted documents.
Nick Mathewson [Thu, 24 May 2018 13:36:33 +0000 (09:36 -0400)] 
Add a unit test for PEM-encrypted documents.

7 years agoMerge branch 'bug26072_029' into maint-0.2.9
Nick Mathewson [Wed, 16 May 2018 16:11:40 +0000 (12:11 -0400)] 
Merge branch 'bug26072_029' into maint-0.2.9

7 years agoReturn -1 from our PEM password callback
Nick Mathewson [Wed, 16 May 2018 15:39:42 +0000 (11:39 -0400)] 
Return -1 from our PEM password callback

Apparently, contrary to its documentation, this is how OpenSSL now
wants us to report an error.

Fixes bug 26116; bugfix on 0.2.5.16.

7 years agoUpdate geoip and geoip6 to the May 1 2018 database.
Karsten Loesing [Tue, 15 May 2018 13:16:47 +0000 (15:16 +0200)] 
Update geoip and geoip6 to the May 1 2018 database.

7 years agoAdd a missing return after marking a stream for bad connected cell
Nick Mathewson [Mon, 14 May 2018 19:54:48 +0000 (15:54 -0400)] 
Add a missing return after marking a stream for bad connected cell

Fixes bug 26072; bugfix on 0.2.4.7-alpha.

7 years agoMerge remote-tracking branch 'juga/ticket26007_029_02' into maint-0.2.9
Nick Mathewson [Thu, 10 May 2018 13:19:09 +0000 (09:19 -0400)] 
Merge remote-tracking branch 'juga/ticket26007_029_02' into maint-0.2.9

7 years agoHaving a ControlPort open doesn't mean we are a client
David Goulet [Wed, 9 May 2018 16:40:06 +0000 (12:40 -0400)] 
Having a ControlPort open doesn't mean we are a client

The any_client_port_set() returns true if the ControlPort is set which is
wrong because we can have that port open but still not behave as a tor client
(like many relays for instance).

Fixes #26062

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoTest read bandwidth measurements with empty file
juga0 [Tue, 8 May 2018 16:23:37 +0000 (16:23 +0000)] 
Test read bandwidth measurements with empty file

7 years agoStop logging stack contents when reading a zero-length bandwidth file
teor [Wed, 2 May 2018 12:33:21 +0000 (22:33 +1000)] 
Stop logging stack contents when reading a zero-length bandwidth file

When directory authorities read a zero-byte bandwidth file, they log
a warning with the contents of an uninitialised buffer. Log a warning
about the empty file instead.

Fixes bug 26007; bugfix on 0.2.2.1-alpha.

7 years agoMerge remote-tracking branch 'catalyst-github/bug25936-029' into maint-0.2.9
Nick Mathewson [Thu, 3 May 2018 17:38:37 +0000 (13:38 -0400)] 
Merge remote-tracking branch 'catalyst-github/bug25936-029' into maint-0.2.9

7 years agoStop logging stack contents when reading a zero-length bandwidth file
teor [Wed, 2 May 2018 12:33:21 +0000 (22:33 +1000)] 
Stop logging stack contents when reading a zero-length bandwidth file

When directory authorities read a zero-byte bandwidth file, they log
a warning with the contents of an uninitialised buffer. Log a warning
about the empty file instead.

Fixes bug 26007; bugfix on 0.2.2.1-alpha.

7 years agoShow test-suite.log for distcheck on Travis CI
Taylor Yu [Thu, 26 Apr 2018 19:22:52 +0000 (14:22 -0500)] 
Show test-suite.log for distcheck on Travis CI

When Travis CI runs make distcheck, test-suite.log doesn't exist in
the expected place.  Add a new make target to show this file and use
it when DISTCHECK=yes in .travis.yml.  Fixes bug 25814; bug not in any
released Tor.

7 years agoMerge branch 'travis_distcheck_029' into maint-0.2.9
Nick Mathewson [Tue, 24 Apr 2018 14:38:19 +0000 (10:38 -0400)] 
Merge branch 'travis_distcheck_029' into maint-0.2.9

7 years agoMerge branch 'bug24969_029_v2' into maint-0.2.9
Nick Mathewson [Mon, 23 Apr 2018 13:23:25 +0000 (09:23 -0400)] 
Merge branch 'bug24969_029_v2' into maint-0.2.9

7 years agoPermit the nanosleep system call in the seccomp2 callbox
Nick Mathewson [Wed, 18 Apr 2018 14:25:42 +0000 (10:25 -0400)] 
Permit the nanosleep system call in the seccomp2 callbox

Fixes bug 24969; bugfix on 0.2.5.1-alpha when the sandbox was introduced.

7 years agoAdd distcheck support to travis configuration.
Nick Mathewson [Wed, 18 Apr 2018 18:24:54 +0000 (14:24 -0400)] 
Add distcheck support to travis configuration.

Implements 25814.

7 years agoAdd support for the coveralls.io coverage tool in travis config
Nick Mathewson [Mon, 16 Apr 2018 18:42:28 +0000 (14:42 -0400)] 
Add support for the coveralls.io coverage tool in travis config

Closes ticket 25818.

7 years agoFix an LCOV exclusion pattern in address.c
Nick Mathewson [Mon, 16 Apr 2018 17:48:21 +0000 (13:48 -0400)] 
Fix an LCOV exclusion pattern in address.c

7 years agoMerge remote-tracking branch 'ahf-github/bugs/24854_029_2' into maint-0.2.9
Nick Mathewson [Tue, 10 Apr 2018 18:25:57 +0000 (14:25 -0400)] 
Merge remote-tracking branch 'ahf-github/bugs/24854_029_2' into maint-0.2.9

7 years agoLift the list of default directory servers into their own file.
Alexander Færøy [Fri, 6 Apr 2018 01:58:16 +0000 (03:58 +0200)] 
Lift the list of default directory servers into their own file.

This patch lifts the list of default directory authorities from config.c
into their own auth_dirs.inc file, which is then included in config.c
using the C preprocessor.

Patch by beastr0.

See: https://bugs.torproject.org/24854

7 years agoMerge branch 'maint-0.2.5' into maint-0.2.9
Nick Mathewson [Thu, 5 Apr 2018 12:22:33 +0000 (08:22 -0400)] 
Merge branch 'maint-0.2.5' into maint-0.2.9

7 years agoUpdate geoip and geoip6 to the April 3 2018 database. maint-0.2.5
Karsten Loesing [Thu, 5 Apr 2018 08:42:25 +0000 (10:42 +0200)] 
Update geoip and geoip6 to the April 3 2018 database.

7 years agoFix CID 1430932
Taylor Yu [Mon, 26 Mar 2018 22:51:50 +0000 (17:51 -0500)] 
Fix CID 1430932

Coverity found a null pointer reference in nodelist_add_microdesc().
This is almost certainly impossible assuming that the routerstatus_t
returned by router_get_consensus_status_by_descriptor_digest() always
corresponds to an entry in the nodelist.  Fixes bug 25629.

7 years agoRemove sb_poll check: all poll() calls are ok.
Nick Mathewson [Tue, 20 Mar 2018 12:30:21 +0000 (08:30 -0400)] 
Remove sb_poll check: all poll() calls are ok.

7 years agoAdd the poll() syscall as permitted by the sandbox
Nick Mathewson [Tue, 20 Mar 2018 12:22:28 +0000 (08:22 -0400)] 
Add the poll() syscall as permitted by the sandbox

Apparently, sometimes getpwnam will call this.

Fixes bug 25513.

7 years agoMerge branch 'maint-0.2.5' into maint-0.2.9
Nick Mathewson [Mon, 19 Mar 2018 09:42:43 +0000 (05:42 -0400)] 
Merge branch 'maint-0.2.5' into maint-0.2.9

7 years agoMerge remote-tracking branch 'catalyst-github/bug25388-025' into maint-0.2.5
Nick Mathewson [Mon, 19 Mar 2018 09:42:38 +0000 (05:42 -0400)] 
Merge remote-tracking branch 'catalyst-github/bug25388-025' into maint-0.2.5

7 years agoMerge branch 'maint-0.2.5' into maint-0.2.9
Nick Mathewson [Tue, 13 Mar 2018 14:58:02 +0000 (10:58 -0400)] 
Merge branch 'maint-0.2.5' into maint-0.2.9

7 years agoUpdate geoip and geoip6 to the March 8 2018 database.
Karsten Loesing [Mon, 12 Mar 2018 13:47:06 +0000 (14:47 +0100)] 
Update geoip and geoip6 to the March 8 2018 database.

7 years agoBump version to 0.2.9.15-dev
Nick Mathewson [Sat, 3 Mar 2018 16:32:16 +0000 (11:32 -0500)] 
Bump version to 0.2.9.15-dev

7 years agoversion bump to 0.2.9.15
Nick Mathewson [Thu, 1 Mar 2018 21:42:17 +0000 (16:42 -0500)] 
version bump to 0.2.9.15

7 years agoProtover tests: disable some obsoleted tests
Nick Mathewson [Thu, 15 Feb 2018 23:56:29 +0000 (18:56 -0500)] 
Protover tests: disable some obsoleted tests

These were meant to demonstrate old behavior, or old rust behavior.

One of them _should_ work in Rust, but won't because of
implementation details.  We'll fix that up later.

7 years agoSpec conformance on protover: always reject ranges where lo>hi
Nick Mathewson [Thu, 15 Feb 2018 15:49:47 +0000 (10:49 -0500)] 
Spec conformance on protover: always reject ranges where lo>hi

7 years agoForbid UINT32_MAX as a protocol version
Nick Mathewson [Thu, 15 Feb 2018 14:05:55 +0000 (09:05 -0500)] 
Forbid UINT32_MAX as a protocol version

The C code and the rust code had different separate integer overflow
bugs here.  That suggests that we're better off just forbidding this
pathological case.

Also, add tests for expected behavior on receiving a bad protocol
list in a consensus.

Fixes another part of 25249.

7 years agoForbid "-0" as a protocol version.
Nick Mathewson [Thu, 15 Feb 2018 13:46:13 +0000 (08:46 -0500)] 
Forbid "-0" as a protocol version.

Fixes part of 24249; bugfix on 0.2.9.4-alpha.

7 years agoAdd more of Teor's protover tests.
Nick Mathewson [Wed, 14 Feb 2018 16:56:03 +0000 (11:56 -0500)] 
Add more of Teor's protover tests.

These are as Teor wrote them; I've disabled the ones that don't pass
yet, with XXXX comments.

7 years agoAdd some protover vote round-trip tests from Teor.
Nick Mathewson [Wed, 14 Feb 2018 16:47:05 +0000 (11:47 -0500)] 
Add some protover vote round-trip tests from Teor.

I've refactored these to be a separate function, to avoid tricky
merge conflicts.

Some of these are disabled with "XXXX" comments; they should get
fixed moving forward.

7 years agoAdd another NULL-pointer fix for protover.c.
Nick Mathewson [Wed, 14 Feb 2018 15:45:57 +0000 (10:45 -0500)] 
Add another NULL-pointer fix for protover.c.

This one can only be exploited if you can generate a correctly
signed consensus, so it's not as bad as 25074.

Fixes bug 25251; also tracked as TROVE-2018-004.

7 years agoCorrectly handle NULL returns from parse_protocol_list when voting.
Nick Mathewson [Thu, 1 Feb 2018 21:33:52 +0000 (16:33 -0500)] 
Correctly handle NULL returns from parse_protocol_list when voting.

In some cases we had checked for it, but in others we had not.  One
of these cases could have been used to remotely cause
denial-of-service against directory authorities while they attempted
to vote.

Fixes TROVE-2018-001.

7 years agoDocument how to allow partial Travis failures
Taylor Yu [Wed, 28 Feb 2018 18:28:45 +0000 (12:28 -0600)] 
Document how to allow partial Travis failures

Add some commented-out allow_failures clauses to make it easier to
temporarily allow less-critical sub-builds to fail while still
reporting success.

7 years agoMerge remote-tracking branch 'dgoulet/ticket24902_029_05' into maint-0.2.9
Nick Mathewson [Fri, 16 Feb 2018 14:41:06 +0000 (09:41 -0500)] 
Merge remote-tracking branch 'dgoulet/ticket24902_029_05' into maint-0.2.9

7 years agostop calling channel_mark_client in response to a create_fast
Roger Dingledine [Wed, 31 Jan 2018 08:21:27 +0000 (03:21 -0500)] 
stop calling channel_mark_client in response to a create_fast

since all it does is produce false positives

this commit should get merged into 0.2.9 and 0.3.0 *and* 0.3.1, even
though the code in the previous commit is already present in 0.3.1. sorry
for the mess.

7 years agobackport to make channel_is_client() accurate
Roger Dingledine [Tue, 30 Jan 2018 23:05:39 +0000 (18:05 -0500)] 
backport to make channel_is_client() accurate

This commit takes a piece of commit af8cadf3a9 and a piece of commit
46fe353f25, with the goal of making channel_is_client() be based on what
sort of connection handshake the other side used, rather than seeing
whether the other side ever sent a create_fast cell to us.

7 years agofix make check-changes
Taylor Yu [Tue, 13 Feb 2018 21:06:04 +0000 (15:06 -0600)] 
fix make check-changes

7 years agoMake check-changes happy
David Goulet [Tue, 13 Feb 2018 19:56:31 +0000 (14:56 -0500)] 
Make check-changes happy

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoman: Document default values if not in the consensus for DoS mitigation
David Goulet [Tue, 13 Feb 2018 15:53:47 +0000 (10:53 -0500)] 
man: Document default values if not in the consensus for DoS mitigation

Fixes #25236

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge remote-tracking branch 'dgoulet/bug25223_029_01' into ticket24902_029_05
David Goulet [Tue, 13 Feb 2018 18:11:10 +0000 (13:11 -0500)] 
Merge remote-tracking branch 'dgoulet/bug25223_029_01' into ticket24902_029_05

7 years agodos: Add extra safety asserts in cc_stats_refill_bucket()
David Goulet [Tue, 13 Feb 2018 15:41:21 +0000 (10:41 -0500)] 
dos: Add extra safety asserts in cc_stats_refill_bucket()

Never allow the function to set a bucket value above the allowed circuit
burst.

Closes #25202

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Don't set consensus param if we aren't a public relay
David Goulet [Tue, 13 Feb 2018 15:29:41 +0000 (10:29 -0500)] 
dos: Don't set consensus param if we aren't a public relay

We had this safeguard around dos_init() but not when the consensus changes
which can modify consensus parameters and possibly enable the DoS mitigation
even if tor wasn't a public relay.

Fixes #25223

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodirserv: Improve returned message when relay is rejected
David Goulet [Thu, 8 Feb 2018 14:42:26 +0000 (09:42 -0500)] 
dirserv: Improve returned message when relay is rejected

Explicitly inform the operator of the rejected relay to set a valid email
address in the ContactInfo field and contact bad-relays@ mailing list.

Fixes #25170

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoHave tor_addr hashes return a randomized hash for AF_UNSPEC.
Nick Mathewson [Mon, 12 Feb 2018 16:08:33 +0000 (11:08 -0500)] 
Have tor_addr hashes return a randomized hash for AF_UNSPEC.

We don't expect this to come up very much, but we may as well make
sure that the value isn't predictable (as we do for the other
addresses) in case the issue ever comes up.

Spotted by teor.

7 years agoFix a typo in an address_set.c comment.
Nick Mathewson [Mon, 12 Feb 2018 15:59:46 +0000 (10:59 -0500)] 
Fix a typo in an address_set.c comment.

7 years agoMerge branch 'bug23318-redux_029' into maint-0.2.9
Nick Mathewson [Mon, 12 Feb 2018 13:33:03 +0000 (08:33 -0500)] 
Merge branch 'bug23318-redux_029' into maint-0.2.9

7 years agoMerge remote-tracking branch 'public/bug24198_029' into maint-0.2.9
Nick Mathewson [Sun, 11 Feb 2018 23:10:59 +0000 (18:10 -0500)] 
Merge remote-tracking branch 'public/bug24198_029' into maint-0.2.9

7 years agoMerge branch 'ticket24315_029' into maint-0.2.9
Nick Mathewson [Sun, 11 Feb 2018 23:07:37 +0000 (18:07 -0500)] 
Merge branch 'ticket24315_029' into maint-0.2.9

7 years agoMerge remote-tracking branch 'public/bug21074_029' into maint-0.2.9
Nick Mathewson [Sun, 11 Feb 2018 21:51:53 +0000 (16:51 -0500)] 
Merge remote-tracking branch 'public/bug21074_029' into maint-0.2.9

7 years agoMerge branch 'bug24978_029_enable' into maint-0.2.9
Nick Mathewson [Sat, 10 Feb 2018 21:08:58 +0000 (16:08 -0500)] 
Merge branch 'bug24978_029_enable' into maint-0.2.9

7 years agotest: DoS test to make sure we exclude known relays
David Goulet [Fri, 9 Feb 2018 16:31:01 +0000 (11:31 -0500)] 
test: DoS test to make sure we exclude known relays

Part of #25193

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Exclude known relays from client connection count
David Goulet [Fri, 9 Feb 2018 16:11:41 +0000 (11:11 -0500)] 
dos: Exclude known relays from client connection count

This is to avoid positively identifying Exit relays if tor client connection
comes from them that is reentering the network.

One thing to note is that this is done only in the DoS subsystem but we'll
still add it to the geoip cache as a "client" seen. This is done that way so
to avoid as much as possible changing the current behavior of the geoip client
cache since this is being backported.

Closes #25193

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge branch 'ticket25183_029_01' into ticket24902_029_05
David Goulet [Thu, 8 Feb 2018 21:56:21 +0000 (16:56 -0500)] 
Merge branch 'ticket25183_029_01' into ticket24902_029_05

7 years agotest: Add unit tests for addressset.c
David Goulet [Thu, 8 Feb 2018 19:35:22 +0000 (14:35 -0500)] 
test: Add unit tests for addressset.c

This also adds one that tests the integration with the nodelist.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoAdd an address_set to the nodelist.
Nick Mathewson [Thu, 8 Feb 2018 17:14:42 +0000 (12:14 -0500)] 
Add an address_set to the nodelist.

This set is rebuilt whenever a consensus arrives.  In between
consensuses, it is add-only.

7 years agoFunction to add an ipv4 address to an address_set
Nick Mathewson [Thu, 8 Feb 2018 17:13:56 +0000 (12:13 -0500)] 
Function to add an ipv4 address to an address_set

This is a convenience function, so callers don't need to wrap
the IPv4 address.

7 years agoAdd an address-set backend using a bloom filter.
Nick Mathewson [Wed, 7 Feb 2018 14:49:35 +0000 (09:49 -0500)] 
Add an address-set backend using a bloom filter.

We're going to need this to make our anti-DoS code (see 24902) more
robust.

7 years agoMerge branch 'maint-0.2.5' into maint-0.2.9
Nick Mathewson [Thu, 8 Feb 2018 15:29:05 +0000 (10:29 -0500)] 
Merge branch 'maint-0.2.5' into maint-0.2.9

7 years agoUpdate geoip and geoip6 to the February 7 2018 database.
Karsten Loesing [Thu, 8 Feb 2018 09:32:41 +0000 (10:32 +0100)] 
Update geoip and geoip6 to the February 7 2018 database.

7 years agoremove a redundant semicolon
Nick Mathewson [Tue, 30 Jan 2018 23:11:16 +0000 (18:11 -0500)] 
remove a redundant semicolon

7 years agogeoip: Make geoip_client_cache_total_allocation() return the counter
David Goulet [Mon, 5 Feb 2018 15:39:10 +0000 (10:39 -0500)] 
geoip: Make geoip_client_cache_total_allocation() return the counter

The HT_FOREACH() is insanely heavy on the CPU and this is part of the fast
path so make it return the nice memory size counter we added in
4d812e29b9b1ec88.

Fixes #25148

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: We can put less token than the current amount
David Goulet [Fri, 2 Feb 2018 22:04:12 +0000 (17:04 -0500)] 
dos: We can put less token than the current amount

Becasue the circuit creation burst and rate can change at runtime it is
possible that between two refill of a bucket, we end up setting the bucket
value to less than there currently is.

Fixes #25128

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoUse tt_u64_op() for uint64_t inputs.
Nick Mathewson [Fri, 2 Feb 2018 20:23:55 +0000 (15:23 -0500)] 
Use tt_u64_op() for uint64_t inputs.

7 years agoMerge branch 'ticket25122_029_02' into ticket24902_029_05
David Goulet [Fri, 2 Feb 2018 19:55:01 +0000 (14:55 -0500)] 
Merge branch 'ticket25122_029_02' into ticket24902_029_05

7 years agogeoip: Add clientmap_entry_new() function
David Goulet [Fri, 2 Feb 2018 18:24:37 +0000 (13:24 -0500)] 
geoip: Add clientmap_entry_new() function

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agogeoip: Increment and decrement functions for the geoip client cache
David Goulet [Fri, 2 Feb 2018 18:14:50 +0000 (13:14 -0500)] 
geoip: Increment and decrement functions for the geoip client cache

These functions protect againts over and underflow. They BUG() in case we
overflow the counter.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agogeoip: Hook the client history cache into the OOM handler
David Goulet [Fri, 2 Feb 2018 15:15:28 +0000 (10:15 -0500)] 
geoip: Hook the client history cache into the OOM handler

If the cache is using 20% of our maximum allowed memory, clean 10% of it. Same
behavior as the HS descriptor cache.

Closes #25122

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agochannel_tls_get_remote_addr_method now returns real_addr.
Fernando Fernandez Mancera [Mon, 22 Jan 2018 14:20:17 +0000 (15:20 +0100)] 
channel_tls_get_remote_addr_method now returns real_addr.

The accurate address of a connection is real_addr, not the addr member.
channel_tls_get_remote_addr_method() now returns real_addr instead.

Fixes #24952; bugfix on 707c1e2 in 0.2.4.11-alpha.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
7 years agotest: Add unit tests for overflows and underflows in cc_stats_refill_bucket
teor [Wed, 31 Jan 2018 00:22:20 +0000 (11:22 +1100)] 
test: Add unit tests for overflows and underflows in cc_stats_refill_bucket

Closes #25094.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Make sure cc_stats_refill_bucket can't overflow while calculating
teor [Wed, 31 Jan 2018 00:13:17 +0000 (11:13 +1100)] 
dos: Make sure cc_stats_refill_bucket can't overflow while calculating

Debug log the elapsed time in cc_stats_refill_bucket

Part of #25094.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agotest: Remove a redundant round from test_dos_bucket_refill
teor [Wed, 31 Jan 2018 00:11:08 +0000 (11:11 +1100)] 
test: Remove a redundant round from test_dos_bucket_refill

This round is left over from the tenths of a second code.

Part of #25094.

7 years agodos: Add changes file for ticket 24902
David Goulet [Tue, 30 Jan 2018 14:15:33 +0000 (09:15 -0500)] 
dos: Add changes file for ticket 24902

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Make circuit rate limit per second, not tenths anymore
David Goulet [Mon, 29 Jan 2018 16:50:11 +0000 (11:50 -0500)] 
dos: Make circuit rate limit per second, not tenths anymore

Because this touches too many commits at once, it is made into one single
commit.

Remove the use of "tenths" for the circuit rate to simplify things. We can
only refill the buckets at best once every second because of the use of
approx_time() and our token system is set to be 1 token = 1 circuit so make
the rate a flat integer of circuit per second.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Man page entry for DoS mitigation
David Goulet [Fri, 26 Jan 2018 14:00:17 +0000 (09:00 -0500)] 
dos: Man page entry for DoS mitigation

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agotest: Add unit tests for the DoS subsystem
George Kadianakis [Thu, 25 Jan 2018 21:38:59 +0000 (16:38 -0500)] 
test: Add unit tests for the DoS subsystem

Signed-off-by: David Goulet <dgoulet@torproject.org>