Commit Graph

16659 Commits

Author SHA1 Message Date
Nick Mathewson 719940df2b Fix a nigh-impossible overflow in cpuworker.c
When we compute the estimated microseconds we need to handle our
pending onionskins, we could (in principle) overflow a uint32_t if
we ever had 4 million pending onionskins before we had any data
about how onionskins take.  Nevertheless, let's compute it properly.

Fixes bug 8210; bugfix on 0.2.4.10. Found by coverity; this is CID
980651.
2013-02-11 16:46:38 -05:00
Nick Mathewson 9b2bb901d7 Fix a null-deref-on-fail in unit tests
If geoip_format_bridge_stats() returned NULL when it should have
returned a string, we would have tried to deref NULL, and died.  Not
a big deal in the unit tests, but still worth fixing.

Found by coverity; This is CID 743384.
2013-02-11 16:32:13 -05:00
Nick Mathewson fc35ee4910 oops; add a missing semicolon 2013-02-11 16:17:33 -05:00
Nick Mathewson 5f29bc71b3 Merge remote-tracking branch 'public/bug7816_023' 2013-02-11 16:14:17 -05:00
Nick Mathewson afca9ab14e Fix another memory leak
This one occurs when changing configuration options. Found by
coverity.
2013-02-11 16:13:52 -05:00
Nick Mathewson fd8ef8dc57 Merge remote-tracking branch 'public/bug8208' 2013-02-11 16:06:02 -05:00
Nick Mathewson e3578d52e4 Check whether ei is non-NULL before altering it.
This fixes a crash bug if we fail to generate an extrainfo
descriptor.

Fixes bug 8208; bugfix on 0.2.3.16-alpha.
2013-02-11 16:05:03 -05:00
Nick Mathewson 43d2f99d54 Suppress a coverity false positive in connection_edge_package_raw_inbuf
Coverity is worried that we're checking entry_conn in some cases,
but not in the case where we set entry_conn->pending_optimistic_data.

This commit should calm it down (CID 718623).
2013-02-11 15:55:50 -05:00
Nick Mathewson 52263b0dda Fix even more dead code and resource leaks in the unit tests
Found by coverity
2013-02-11 15:20:20 -05:00
Nick Mathewson 96b1bd4fb8 Fix a very short-lived socket leak in tor-resolve
This shouldn't actually matter, since tor-resolve will return soon
after this function exits, but it's nice to be warning-free

Found by coverity, fixes CID 718633
2013-02-11 15:13:42 -05:00
Nick Mathewson 717946089b Resolve memory leaks in the unit tests and benchmarks (found by coverity)
These shouldn't really matter, but it's nice to be leak-free.
2013-02-11 14:57:10 -05:00
Nick Mathewson b9432becbe Fix a copy-and-paste issue found by coverity
Fixes CID 980650; bugfix on 0.2.4.10-alpha.
2013-02-11 14:42:33 -05:00
Nick Mathewson ffd6e557cb Speed up the curve25519 unit test by doing fewer iterations
This test was accounting for about 2/3 of our unit tests' runtime,
even on systems with a fast curve25519.  No test should take so long.
2013-02-11 13:55:42 -05:00
Nick Mathewson 01184f164f Merge remote-tracking branch 'public/bug8158' 2013-02-11 13:32:38 -05:00
Nick Mathewson 36e2eb6775 Avoid generating extra spaces when explaining how we guessed our address 2013-02-11 13:29:56 -05:00
Roger Dingledine 92ea0b86de Refactor resolve_my_address() so logs are more accurate / helpful
It returns the method by which we decided our public IP address
(explicitly configured, resolved from explicit hostname, guessed from
interfaces, learned by gethostname).

Now we can provide more helpful log messages when a relay guesses its IP
address incorrectly (e.g. due to unexpected lines in /etc/hosts). Resolves
ticket 2267.

While we're at it, stop sending a stray "(null)" in some cases for the
server status "EXTERNAL_ADDRESS" controller event. Resolves bug 8200.
2013-02-11 13:29:56 -05:00
Roger Dingledine dfbb12cabf log the hostname that resolve_my_address() used to guess our IP 2013-02-11 13:29:56 -05:00
Nick Mathewson 2b4d4ccb3d Merge remote-tracking branch 'public/bug7801_v2' 2013-02-11 11:28:08 -05:00
Nick Mathewson d86a45f991 Wrap more macro definitions in (parentheses)
To avoid surprises, good coding practice suggests parenthesizing every
macro definition -- or at the very least, all those involving an
expression.
2013-02-09 00:16:04 -05:00
Nick Mathewson 69ab7cd828 Improve comment at Andrea's request 2013-02-08 17:13:11 -05:00
Nick Mathewson 561e9becbd Merge remote-tracking branch 'public/signof_enum' 2013-02-08 16:48:50 -05:00
Nick Mathewson e998bbcdd5 changes file for bug7801 2013-02-08 16:46:50 -05:00
Nick Mathewson 029d2c6587 Unit test for tor_weak_random_range 2013-02-08 16:46:35 -05:00
Nick Mathewson 4bfd7806bf Add explicit check for !first_conn in ...resume_edge_reading_helper
This check isn't necessary (see comment on #7801), but it took at
least two smart people a little while to see why it wasn't necessary,
so let's have it in to make the code more readable.
2013-02-08 16:32:58 -05:00
Nick Mathewson 018fe7d11e Improve comment about our random stream choice algorithm 2013-02-08 16:31:46 -05:00
Nick Mathewson 8cdd8b8353 Fix numerous problems with Tor's weak RNG.
We need a weak RNG in a couple of places where the strong RNG is
both needless and too slow.  We had been using the weak RNG from our
platform's libc implementation, but that was problematic (because
many platforms have exceptionally horrible weak RNGs -- like, ones
that only return values between 0 and SHORT_MAX) and because we were
using it in a way that was wrong for LCG-based weak RNGs.  (We were
counting on the low bits of the LCG output to be as random as the
high ones, which isn't true.)

This patch adds a separate type for a weak RNG, adds an LCG
implementation for it, and uses that exclusively where we had been
using the platform weak RNG.
2013-02-08 16:28:05 -05:00
Nick Mathewson c8f5f35d62 Add doxygen for bug8158 functions 2013-02-08 12:12:09 -05:00
Nick Mathewson 2403ef66ba Coalesce identical adjacent microdescriptor vote lines. 2013-02-08 12:09:46 -05:00
Nick Mathewson 194bd56c8a Refactor generating the m lines in a vote into its own function 2013-02-08 11:52:51 -05:00
Nick Mathewson fd1c2a13e7 Merge remote-tracking branch 'karsten/geoip-manual-update' 2013-02-08 10:37:34 -05:00
Nick Mathewson a24f29ec5d Merge remote-tracking branch 'origin/maint-0.2.3' 2013-02-08 10:36:51 -05:00
Nick Mathewson b840b76b04 Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3 2013-02-08 10:36:34 -05:00
Karsten Loesing 7f805b6048 Comment out now obsolete change in geoip-manual. 2013-02-08 14:42:07 +01:00
Karsten Loesing adff7f944a Update to the February 2013 GeoIP database. 2013-02-08 14:39:25 +01:00
Nick Mathewson 3433216268 Merge remote-tracking branch 'public/easy_ratelim'
Conflicts:
	src/or/connection.c
2013-02-07 17:13:51 -05:00
Nick Mathewson 41200b4770 Have autoconf check whether enums are signed.
Fixes bug 7727; fix on 0.2.4.10-alpha.
2013-02-07 16:30:32 -05:00
Nick Mathewson 0e597471af Use a nicely written autoconf macro to determine the sign of a type
This beats our old implementation, which wouldn't work when cross-compiling
2013-02-07 16:23:48 -05:00
Nick Mathewson e5b07ba179 Merge remote-tracking branch 'arma/bug7054' 2013-02-07 15:22:36 -05:00
Nick Mathewson ba7d93db16 Merge remote-tracking branch 'public/bug7816_023'
Conflicts:
	src/common/util.c
2013-02-07 15:20:50 -05:00
Nick Mathewson 0061d42890 Merge remote-tracking branch 'public/bug7816_024' 2013-02-07 15:13:21 -05:00
Nick Mathewson ad28397bbf Merge branch 'bug7902' 2013-02-07 15:04:11 -05:00
Nick Mathewson 522b312a51 whitespace fix 2013-02-07 14:31:51 -05:00
Nick Mathewson 12c6475c06 Merge branch 'ticket8161_squashed' 2013-02-07 14:31:04 -05:00
Mike Perry eb15be3d45 Mention a trac ticket relevant to an XXX comment. 2013-02-07 14:30:58 -05:00
Mike Perry bbd38f293f Better document an XXX comment about refactoring. 2013-02-07 14:30:58 -05:00
Mike Perry 3fb40fa3ff Changes file for path use bias threshold changes. 2013-02-07 14:30:58 -05:00
Mike Perry b03553737c Separate the flags for logging use bias.
I think we want both sets of messages to appear independently to help us know
what needs tuning.
2013-02-07 14:30:58 -05:00
Nick Mathewson 0175209e6b Merge branch 'bug8121_squashed' 2013-02-07 14:09:17 -05:00
Nick Mathewson 266419d244 Tolerate curve25519 backends where the high bit of the pk isn't ignored
Right now, all our curve25519 backends ignore the high bit of the
public key. But possibly, others could treat the high bit of the
public key as encoding out-of-bounds values, or as something to be
preserved. This could be used to distinguish clients with different
backends, at the cost of killing a circuit.

As a workaround, let's just clear the high bit of each public key
indiscriminately before we use it. Fix for bug 8121, reported by
rransom. Bugfix on 0.2.4.8-alpha.
2013-02-07 14:09:01 -05:00
Roger Dingledine b4a68d1747 revise history 2013-02-05 00:48:24 -05:00