Nick Mathewson
b152d62cee
Merge branch 'token_bucket_refactor_squashed'
2018-04-13 10:47:24 -04:00
Nick Mathewson
3f514fe3b1
Accept small hops backward in the monotonic timer.
2018-04-13 10:41:15 -04:00
Nick Mathewson
8a85239746
Add a helper function to decrement read and write at the same time
2018-04-13 10:41:14 -04:00
Nick Mathewson
c376200f6a
Add a new token-bucket backend abstraction, with tests
...
This differs from our previous token bucket abstraction in a few
ways:
1) It is an abstraction, and not a collection of fields.
2) It is meant to be used with monotonic timestamps, which should
produce better results than calling gettimeofday over and over.
2018-04-13 10:41:14 -04:00
Nick Mathewson
d8ef9a2d1e
Expose a function that computes stamp units from msec.
...
(It turns out we can't just expose STAMP_TICKS_PER_SECOND, since
Apple doesn't have that.)
2018-04-13 10:41:08 -04:00
Nick Mathewson
d3b9b5a3dd
Remove windows log_from_handle as unused.
...
This function was only used by PortForwardingHelper, which was
removed in 9df110cd72
. Its presence caused warnings on windows.
2018-04-12 12:38:46 -04:00
Nick Mathewson
037fb0c804
Merge branch 'maint-0.3.3'
2018-04-12 11:14:42 -04:00
Alexander Færøy
bd42367a1e
Make get_total_system_memory mockable.
...
This patch makes get_total_system_memory mockable, which allows us to
alter the return value of the function in tests.
See: https://bugs.torproject.org/24782
2018-04-12 10:51:45 -04:00
Nick Mathewson
6e467a7a34
Merge remote-tracking branch 'isis-github/bug25409'
2018-04-10 15:27:09 -04:00
David Goulet
395fa0258d
compat: Fix unchecked return value from event_del()
...
Explicitly tell the compiler we don't care about it.
Coverity CID 1434156
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-09 14:12:45 -04:00
Nick Mathewson
6a5f62f68f
Move responsibility for threadpool reply-handler events to workqueue
...
This change makes cpuworker and test_workqueue no longer need to
include event2/event.h. Now workqueue.c needs to include it, but
that is at least somewhat logical here.
2018-04-05 12:36:28 -04:00
Nick Mathewson
b3586629c9
Wrap the function we use to run the event loop.
...
Doing this lets us remove the event2/event.h header from a few more
modules, particularly in the tests.
Part of work on 23750.
2018-04-05 12:36:27 -04:00
Nick Mathewson
39cb04335f
Add wrappers for event_base_loopexit and event_base_loopbreak.
2018-04-05 12:36:05 -04:00
Nick Mathewson
f0d2733b46
Revise procmon.c to use periodic_timer_t
...
This removes its need to use event2/event.h, and thereby fixes
another instance of 23750.
2018-04-05 12:35:11 -04:00
Nick Mathewson
871ff0006d
Add an API for a scheduled/manually activated event in the mainloop
...
Using this API lets us remove event2/event.h usage from half a dozen
modules, to better isolate libevent. Implements part of ticket
23750.
2018-04-05 12:35:11 -04:00
Neel Chauhan
9df110cd72
Remove PortForwarding options
...
Signed-off-by: Isis Lovecruft <isis@torproject.org>
2018-04-04 00:19:33 +00:00
Nick Mathewson
f4bcf3f34c
Remove event2/event.h include from compat_libevent.h
...
Only one module was depending on this include (test_helpers.c), and
it was doing so incorrectly.
2018-04-02 11:11:31 -04:00
Nick Mathewson
2f872f9762
Merge remote-tracking branch 'hello71/bug25398'
2018-03-28 14:47:05 -04:00
Nick Mathewson
6317aa2cc0
Merge branch 'maint-0.3.3'
2018-03-28 07:50:47 -04:00
Nick Mathewson
d4bf1f6c8e
Add a paranoia check in string_is_valid_nonrfc_hostname()
...
The earlier checks in this function should ensure that components is
always nonempty. But in case somebody messes with them in the
future, let's add an extra check to make sure we aren't crashing.
2018-03-28 07:48:18 -04:00
Nick Mathewson
b504c854d3
Rename string_is_valid_hostname -> string_is_valid_nonrfc_hostname
...
Per discussion on 25055.
2018-03-28 07:42:27 -04:00
rl1987
09351c34e9
Don't strlen before checking for NULL
2018-03-28 07:39:03 -04:00
rl1987
a28e350cff
Tweak loop condition
2018-03-28 07:39:03 -04:00
rl1987
6b6d003f43
Don't explode on NULL or empty string
2018-03-28 07:39:03 -04:00
rl1987
ee1fca727c
Simplify hostname validation code
2018-03-28 07:39:03 -04:00
rl1987
dbb7c8e6fd
Validate hostnames with punycode TLDs correctly
2018-03-28 07:39:03 -04:00
rl1987
4413e52f9e
Improve handling of trailing dot
2018-03-28 07:39:03 -04:00
rl1987
6335db9fce
Refrain from including <ctype.h>
2018-03-28 07:39:03 -04:00
rl1987
5986589b48
Call strlen() once
2018-03-28 07:39:03 -04:00
rl1987
b0ba4aa7e9
Fix bracketed IPv6 string validation
2018-03-28 07:39:03 -04:00
rl1987
1af016e96e
Do not consider IP strings valid DNS names. Fixes #25055
2018-03-28 07:39:03 -04:00
rl1987
0e453929d2
Allow IPv6 address strings to be used as hostnames in SOCKS5 requests
2018-03-28 07:39:03 -04:00
Nick Mathewson
0eed0899cd
Merge branch 'bug24658-rm-curve25519-header' into bug24658-merge
2018-03-26 20:12:59 -04:00
Nick Mathewson
c68bfc556c
Merge branch 'maint-0.3.3'
2018-03-26 10:29:29 -04:00
Nick Mathewson
33606405e3
Merge branch 'maint-0.3.2' into maint-0.3.3
2018-03-26 10:29:29 -04:00
Nick Mathewson
b5a6c03998
Merge branch 'maint-0.3.1' into maint-0.3.2
2018-03-26 10:29:29 -04:00
Nick Mathewson
068d092749
Merge branch 'maint-0.2.9' into maint-0.3.1
2018-03-26 10:29:29 -04:00
Nick Mathewson
24abcf9771
Merge branch 'bug25399_squashed'
2018-03-22 08:49:43 -04:00
Alex Xu (Hello71)
946ed24ca5
Do not page-align mmap length. #25399
2018-03-22 08:47:37 -04:00
Nick Mathewson
9f93bcd16d
Remove sb_poll check: all poll() calls are ok.
2018-03-20 08:30:21 -04:00
Nick Mathewson
070eda5a21
Add the poll() syscall as permitted by the sandbox
...
Apparently, sometimes getpwnam will call this.
Fixes bug 25513.
2018-03-20 08:23:44 -04:00
Nick Mathewson
228b655935
Move rust-specific declarations outside of #else block
...
These declarations need to exist unconditionally, but they were
trapped inside an "#else /* !(defined(HAVE_SYSLOG_H)) */" block.
Fixes a travis regression caused by 23881; bug not in any released tor.
2018-03-19 19:18:23 -04:00
Nick Mathewson
d8893bc93c
Merge remote-tracking branch 'isis/bug23881_r1'
2018-03-19 17:20:37 -04:00
Nick Mathewson
338dbdab93
Merge branch 'maint-0.3.3'
2018-03-03 11:59:27 -05:00
Alexander Færøy
59a7b00384
Update tor.1.txt with the currently available log domains.
...
See: https://bugs.torproject.org/25378
2018-03-03 11:58:14 -05:00
Alex Xu (Hello71)
45d3b5fa4c
Remove uncompilable tor_mmap_file fallback. #25398
2018-03-02 09:51:53 -05:00
Isis Lovecruft
7759ac8df2
crypto: Remove crypto_rsa.h from crypto_digest.c.
...
* ADD include for "crypto_openssl_mgt.h" so that we have OpenSSL
defined SHA* types and functions.
* FIXES part of #24658 : https://bugs.torproject.org/24658#comment:30
2018-02-20 20:29:54 +00:00
Isis Lovecruft
3e9140e79a
crypto: Remove unnecessary curve25519 header from crypto_digest.h.
...
* ADD includes for "torint.h" and "container.h" to crypto_digest.h.
* ADD includes for "crypto_digest.h" to a couple places in which
crypto_digest_t was then missing.
* FIXES part of #24658 : https://bugs.torproject.org/24658#comment:30
2018-02-20 20:29:54 +00:00
Nick Mathewson
4438ef3288
Remove a bunch of other redundant #includes
...
Folks have found two in the past week or so; we may as well fix the
others.
Found with:
\#!/usr/bin/python3
import re
def findMulti(fname):
includes = set()
with open(fname) as f:
for line in f:
m = re.match(r'^\s*#\s*include\s+["<](\S+)[>"]', line)
if m:
inc = m.group(1)
if inc in includes:
print("{}: {}".format(fname, inc))
includes.add(m.group(1))
import sys
for fname in sys.argv[1:]:
findMulti(fname)
2018-02-20 10:14:15 -05:00
Nick Mathewson
5199b9b337
Use autoconf to check for optional zstd functionality.
...
Fixes a bug in our zstd-static code. Bug not in any released
version of Tor.
2018-02-18 16:19:43 -05:00