Karsten Loesing [Fri, 12 Jun 2009 09:39:35 +0000 (11:39 +0200)]
Apply fix for bug 997.
Hidden service clients didn't use a cached service descriptor that
was older than 15 minutes, but wouldn't fetch a new one either. Now,
use a cached descriptor no matter how old it is and only fetch a new
one when all introduction points fail. Fix for bug 997. Patch from
Marcus Griep.
Nick Mathewson [Wed, 3 Jun 2009 17:52:03 +0000 (13:52 -0400)]
Fix gprof bottlenecks on exit nodes found by Jacob.
Apparently all the stuff that does a linear scan over all the DNS
cache entries can get really expensive when your DNS cache is very
large. It's hard to say how much this will help performance, since
gprof doesn't count time spent in OpenSSL or zlib, but I'd guess 10%.
Also, this patch removes calls to assert_connection_ok() from inside
the read and write callbacks, which are similarly unneeded, and a
little costlier than I'm happy with.
Nick Mathewson [Wed, 27 May 2009 18:07:41 +0000 (14:07 -0400)]
Do not report a node as a "chosen exit" when it is not in fact an exit.
Provide a useful warning when launch_circuit tries to make us use a
node we don't want to use. Just give an info message when this is a
normal and okay situation. Fix for logging issues in bug 984.
Nick Mathewson [Fri, 29 May 2009 14:18:50 +0000 (10:18 -0400)]
Don't attempt to log messages to a controller from a worker thread.
This patch adds a function to determine whether we're in the main
thread, and changes control_event_logmsg() to return immediately if
we're in a subthread. This is necessary because otherwise we will
call connection_write_to_buf, which modifies non-locked data
structures.
Bugfix on 0.2.0.x; fix for at least one of the things currently
called "bug 977".
Sebastian Hahn [Tue, 26 May 2009 10:41:45 +0000 (12:41 +0200)]
Consider *ListenAddress when warning about low ports and hibernation
Tas (thanks!) noticed that when *ListenAddress is set, Tor would
still warn on startup when *Port is low and hibernation is active.
The patch parses all the *ListenAddress lines, and checks the
ports. Bugfix on 0.2.1.15-rc
Karsten Loesing [Wed, 27 May 2009 21:47:59 +0000 (23:47 +0200)]
Fix unit tests that were broken after last fix of #932.
With the last fix of task 932 (5f03d6c), client requests are only added to
the history when they happen after the start of the current history. This
conflicts with the unit tests that insert current requests first (defining
the start of the client request history) followed by requests in the past.
The fix is to insert requests in chronological order in the unit tests.
Karsten Loesing [Wed, 27 May 2009 15:52:46 +0000 (17:52 +0200)]
Change the way how directories that are configured with --enable-geoip-stats write geoip stats to disk.
- Write geoip stats to disk every 24 hours, not every hour.
- Remove configuration options and define reasonable defaults.
- Clear history of client requests every 24 hours (which wasn't done at
all before).
Jacob Appelbaum [Sat, 23 May 2009 03:33:44 +0000 (23:33 -0400)]
Log the number and size of DNS cache entries on SIGUSR1.
Specifically if you send SIGUSR1, it will add two lines to the log file:
May 22 07:41:59.576 [notice] Our DNS cache has 3364 entries.
May 22 07:41:59.576 [notice] Our DNS cache size is approximately 1022656
bytes.
Nick Mathewson [Fri, 22 May 2009 18:06:39 +0000 (14:06 -0400)]
Improved bug-957 fix for 0.2.2.
Really, our idiocy was that we were calling event_set() on the same
event more than once, which sometimes led to us calling event_set() on
an event that was already inserted, thus making it look uninserted.
With this patch, we just initialize the timeout events when we create
the requests and nameservers, and we don't need to worry about
double-add and double-del cases at all.
Nick Mathewson [Mon, 18 May 2009 20:12:39 +0000 (16:12 -0400)]
Possible fix for crash bug related to event timeouts. [Bug 957]
If we ever add an event, then set it, then add it again, there will be
now two pointers to the event in the event base. If we delete one and
free it, the first pointer will still be there, and possibly cause a
crash later.
This patch adds detection for this case to the code paths in
eventdns.c, and works around it. If the warning message ever
displays, then a cleverer fix is in order.
{I am not too confident that this *is* the fix, since bug 957 is very
tricky. If it is, it is a bugfix on 0.2.0.}
Nick Mathewson [Sun, 17 May 2009 06:01:09 +0000 (02:01 -0400)]
Fix valgrind error when marking a descriptor as never-downloadable.
When we got a descriptor that we (as an authority) rejected as totally
bad, we were freeing it, then using the digest in its RAM to look up its
download status. Caught by arma with valgrind. Bugfix on 0.2.1.9-alpha.
Nick Mathewson [Sun, 17 May 2009 03:57:30 +0000 (23:57 -0400)]
Fix an assertion-failure in memarea_alloc() on 64-bit platforms.
The trick is that we should assert that our next_mem pointer has not
run off the end of the array _before_ we realign the pointer, since
doing that could take us over the end... but only if we're on a system
where malloc() gives us ram in increments smaller than sizeof(void*).
Karsten Loesing [Wed, 13 May 2009 16:14:29 +0000 (18:14 +0200)]
Prevent bridges from publishing router descriptors.
Bridges are not supposed to publish router descriptors to the directory
authorities. It defeats the point of bridges when they are included in the
public relay directory.
This patch puts out a warning and exits when the node is configured as
a bridge and to publish v1, v2, or v3 descriptors at the same time.
Nick Mathewson [Tue, 12 May 2009 20:17:32 +0000 (16:17 -0400)]
Use a mutex to protect the count of open sockets.
This matters because a cpuworker can close its socket when it
finishes. Cpuworker typically runs in another thread, so without a
lock here, we can have a race condition and get confused about how
many sockets are open. Possible fix for bug 939.
Nick Mathewson [Tue, 12 May 2009 19:10:23 +0000 (15:10 -0400)]
Add sentinel values to the end of memarea chunks.
This might detect some possible causes of bug 930, and will at least
make sure we aren't doing some dumb memory-corruption stuff with the heap
and router-parsing.