Commit Graph

6880 Commits

Author SHA1 Message Date
Nick Mathewson
f89323afda Fix behavior of adding a cell to a blocked queue.
We frequently add cells to stream-blocked queues for valid reasons
that don't mean we need to block streams.  The most obvious reason
is if the cell arrives over a circuit rather than from an edge: we
don't block circuits, no matter how full queues get.  The next most
obvious reason is that we allow CONNECTED cells from a newly created
stream to get delivered just fine.

This patch changes the behavior so that we only iterate over the
streams on a circuit when the cell in question came from a stream,
and we only block the stream that generated the cell, so that other
streams can still get their CONNECTEDs in.
2010-09-02 15:26:17 -04:00
Nick Mathewson
2081740317 Merge branch 'ratelim' 2010-08-31 12:59:36 -04:00
Nick Mathewson
285addbd94 Fix some issues in rate-limiting noticed by Sebastian 2010-08-31 12:52:11 -04:00
Sebastian Hahn
2af6aadfe9 Fix a compile warning on OpenBSD 2010-08-22 13:58:23 +02:00
Sebastian Hahn
33ae3f4b5c Allow clients to use relays as bridges 2010-08-20 23:45:00 +02:00
Nick Mathewson
c0c7868250 Make the windows build succeed with or without -DUNICODE enabled.
This should keep WinCE working (unicode always-on) and get Win98
working again (unicode never-on).

There are two places where we explicitly use ASCII-only APIs, still:
in ntmain.c and in the unit tests.

This patch also fixes a bug in windoes tor_listdir that would cause
the first file to be listed an arbitrary number of times that was
also introduced with WinCE support.

Should fix bug 1797.
2010-08-20 13:40:01 -04:00
Sebastian Hahn
219f7415d1 Warn for bad combination of cookie options
Setting CookieAuthFileGroupReadable but without setting CookieAuthFile makes
no sense, because unix directory permissions for the data directory prevent
the group from accessing the file anyways.
2010-08-20 02:45:10 +02:00
Nick Mathewson
69deb22f34 Fix up compilation on windows. 2010-08-19 14:59:44 -04:00
Nick Mathewson
6f9f1f3324 Make the "2 unknown, 7 missing key..." messages easier to understand
This patch should fix the cases we care about for bugs 1290 and 1145.

     "30-56-99 are correct. Limited 4 and 8 are missing".
2010-08-19 11:13:35 -04:00
Roger Dingledine
c1260cb6ec delay geoip stats even more for relays-turned-bridges 2010-08-18 16:12:44 -04:00
Nick Mathewson
ba9c1275c4 Add a generic rate-limited log mechanism, and use it in a few places
Incidentally fixes bug 1042.
2010-08-18 15:55:49 -04:00
Nick Mathewson
8782dcf6a2 Detect if we try to put a cell onto a supposedly blocked cell queue.
When this happens, run through the streams on the circuit and make
sure they're all blocked.  If some aren't, that's a bug: block them
all and log it!  If they all are, where did the cell come from?  Log
it!

(I suspect that this actually happens pretty frequently, so I'm making
these log messages appear at INFO.)
2010-08-18 14:33:41 -04:00
Nick Mathewson
80391b88a5 Decide whether to ignore SENDMEs based on streams_blocked, not queue size 2010-08-18 14:33:41 -04:00
yetonetime
4dd3245abb Avoid over-filling cell queues when we receive a SENDME
Do not start reading on exit streams when we get a SENDME unless we
have space in the appropriate circuit's cell queue.

Draft fix for bug 1653.

(commit message by nickm)
2010-08-18 14:33:37 -04:00
Nick Mathewson
8c528bc320 Merge commit 'origin/maint-0.2.1'
Conflicts:
	src/or/reasons.c
2010-08-18 13:48:39 -04:00
Nick Mathewson
5926d9cfcc Move code for launching tests out of router_add_to_routerlist()
router_add_to_routerlist() is supposed to be a nice minimal function
that only touches the routerlist structures, but it included a call to
dirserv_single_reachability_test().

We have a function that gets called _after_ adding descriptors
successfully: routerlist_descriptors_added.  This patch moves the
responsibility for testing there.

Because the decision of whether to test or not depends on whether
there was an old routerinfo for this router or not, we have to first
detect whether we _will_ want to run the tests if the router is added.
We make this the job of
routers_update_status_from_consensus_networkstatus().

Finally, this patch makes the code notice if a router is going from
hibernating to non-hibernating, and if so causes a reachability test
to get launched.
2010-08-18 13:36:09 -04:00
Nick Mathewson
23fdf0b30f Allow some skew in checking when a router said it was hibernating
This solves the problem Roger noted as:
   What if the router has a clock that's 5 minutes off, so it
   publishes a descriptor for 5 minutes in the future, and we test it
   three minutes in. In this edge case, we will continue to advertise
   it as Running for the full 45 minute period.
2010-08-18 11:40:22 -04:00
Nick Mathewson
a4c5287e1b Clarify AssumeReachable semantics wrt hibernation 2010-08-18 11:31:19 -04:00
Nick Mathewson
5063a1c538 Add some braces to make arma happy 2010-08-18 11:28:51 -04:00
Sebastian Hahn
78e4aa63fb Backport END_STREAM_REASON_NOROUTE for client use.
(Partial backport of 150ed553df, 161b275028, and 4c948ffd6.)
2010-08-18 11:12:32 -04:00
Nick Mathewson
a509dbba50 Merge commit 'karsten/dirbytes2'
Conflicts:
	src/or/rephist.h
2010-08-18 10:06:14 -04:00
Karsten Loesing
58b6195455 Correctly report written bytes on linked connections. 2010-08-18 13:54:41 +02:00
Karsten Loesing
db94b7f46e Count bytes we spend on answering directory requests. 2010-08-18 13:54:41 +02:00
Sebastian Hahn
d5c83f2014 Remove unused function declarations
Also remove some #if 0'd code from the unit tests for buffers. The
code was killed in e6794e5808 (5 years
ago), and is now broken anyways.
2010-08-17 23:49:39 +02:00
Nick Mathewson
5ffe105598 Merge branch 'maint-0.2.1'
Resolved conflict in
	src/or/networkstatus.c
2010-08-17 12:07:19 -04:00
Nick Mathewson
6f58481335 Scale CONSENSUS_MIN_SECONDS_BEFORE_CACHING by voting interval
If the voting interval was short enough, the two-minutes delay
of CONSENSUS_MIN_SECONDS_BEFORE_CACHING would confuse bridges
to the point where they would assert before downloading a consensus.
It it was even shorter (<4 minutes, I think), caches would
assert too.  This patch fixes that by having replacing the
two-minutes value with MIN(2 minutes, interval/16).

Bugfix for 1141; the cache bug could occur since 0.2.0.8-alpha, so
I'm calling this a bugfix on that.  Robert Hogan diagnosed this.
Done as a patch against maint-0.2.1, since it makes it hard to
run some kinds of testing networks.
2010-08-17 11:55:39 -04:00
Robert Hogan
d6744d611f Fall back to direct descriptor request to bridges when
requests to authorities fail due to a network error.

Bug#1138
"When a Tor client starts up using a bridge, and UpdateBridgesFromAuthority
is set, Tor will go to the authority first and look up the bridge by
fingerprint. If the bridge authority is filtered, Tor will never notice that
the bridge authority lookup failed. So it will never fall back."

Add connection_dir_bridge_routerdesc_failed(), a function for unpacking
the bridge information from a failed request, and ensure
connection_dir_request_failed() calls it if the failed request
was for a bridge descriptor.

Test:

1. for ip in `grep -iR 'router ' cached-descriptors|cut -d ' ' -f 3`;
do sudo iptables -A OUTPUT -p tcp -d $ip -j DROP; done
2. remove all files from user tor directory
3. Put the following in torrc:

UseBridges 1
UpdateBridgesFromAuthority 1
Bridge 85.108.88.19:443 7E1B28DB47C175392A0E8E4A287C7CB8686575B7

4. Launch tor - it should fall back to downloading descriptors
   directly from the bridge.

Initial patch reviewed and corrected by mingw-san.
2010-08-16 21:15:49 +01:00
Nick Mathewson
bf8d66364f Merge commit 'public/warn1125' 2010-08-16 00:27:05 -04:00
Karsten Loesing
15379a7254 Fix compilation with --with-dmalloc
Fixes 1832; bugfix on 0.2.2.6-alpha
2010-08-16 00:14:06 -04:00
Roger Dingledine
4c948ffd6c 161b2750 didn't really retry the stream. this does. 2010-08-16 00:04:49 -04:00
Nick Mathewson
b51f1a64e4 Make Sebastian's bug1831 branch build with --enable-gcc-warnings 2010-08-15 23:46:09 -04:00
Nick Mathewson
a856f446c7 Merge commit 'sebastian/bug1831' 2010-08-15 23:43:36 -04:00
Nick Mathewson
6a77bde8d8 Make Sebastian's misc-reasons branch compile; frob the changes file 2010-08-15 21:32:06 -04:00
Nick Mathewson
9bcea4a8ef Merge commit 'sebastian/misc-reason' 2010-08-15 21:27:32 -04:00
Nick Mathewson
8351881b2e Merge commit 'karsten/stats-tests' 2010-08-15 20:49:37 -04:00
Sebastian Hahn
561ca9b987 Fix misplaced labels 2010-08-16 00:46:44 +02:00
Sebastian Hahn
b2dcff5766 Fix a memory leak in dirvote_compute_consensuses() 2010-08-16 00:46:44 +02:00
Sebastian Hahn
527581194c Fix a memory leak
It happened in dirvote_add_signatures_to_pending_consesus().
2010-08-16 00:46:42 +02:00
Sebastian Hahn
4c49d3c27e Refactor circuit_build_times_parse_state
Remove the msg parameter to pass an error message out. This
wasn't needed and made it harder to detect a memory leak.
2010-08-16 00:45:32 +02:00
Sebastian Hahn
70f0ba1495 Fix a memory leak in circuit_build_times_parse_state
Thanks weasel for noticing.
2010-08-16 00:33:29 +02:00
Karsten Loesing
69545efbaf Give rep_hist_exit_stats_history() a better name. 2010-08-15 14:15:58 +02:00
Karsten Loesing
3d77c67d93 Fix memory leak spotted by Nick. 2010-08-15 13:34:57 +02:00
Roger Dingledine
8d588e7b1a reinit per-conn token buckets on config or consensus change 2010-08-15 04:01:42 -04:00
Roger Dingledine
2bc1842aaa factor out rate/burst setting. no actual changes. 2010-08-15 02:27:07 -04:00
Roger Dingledine
a207d9db4c fix another piece of 1741 2010-08-14 04:22:08 -04:00
Roger Dingledine
e50857b67f changes entry for bug 1741 2010-08-13 20:50:51 -04:00
Mike Perry
5b0c0e1f89 Add check for CIRCUIT_PURPOSE_S_REND_JOINED.
These circuits stick around much longer than others on the server side for
performance reasons. Their lifetime is controlled by the client.
2010-08-13 20:46:33 -04:00
Roger Dingledine
b1a5888553 fix a memory leak introduced by df1ef2f0f0 2010-08-13 17:30:50 -04:00
Roger Dingledine
1ac1f048ef minor formatting / comment fixes 2010-08-13 17:18:45 -04:00
Karsten Loesing
acd25558b8 Refactor exit port statistics code and add unit tests. 2010-08-11 16:19:54 +02:00
Roger Dingledine
45c6b5de17 tiny change i found in my other sandbox 2010-08-11 01:48:29 -04:00
Nick Mathewson
8150e2ad24 Make buf_shrink_freelists warn, not crash, when n_to_skip is too high
This mitigates bug 1125, but doesn't fix its root cause (whatever
that is).
2010-08-10 15:58:41 -04:00
Roger Dingledine
0087a37bed tiny changes i found in my sandbox 2010-08-09 18:50:49 -04:00
Sebastian Hahn
162c8847de Update some documentation for the bug 1525 fix 2010-08-08 15:20:24 +02:00
Robert Hogan
462568674a Ensure controller RESOLVE commands respect __LeaveStreamsUnattached
https://trac.torproject.org/projects/tor/ticket/1525

"The codepath taken by the control port "RESOLVE" command to create a
synthetic SOCKS resolve request isn't the same as the path taken by
a real SOCKS request from 'tor-resolve'.
This prevents controllers who set LeaveStreamsUnattached=1 from
being able to attach RESOLVE streams to circuits of their choosing."

Create a new function connection_ap_rewrite_and_attach_if_allowed()
and call that when Tor needs to attach a stream to a circuit but
needs to know if the controller permits it.

No tests added.
2010-08-08 12:37:59 +01:00
Karsten Loesing
83626ec91c Move exit-stats code to the end of rephist.c. 2010-08-05 13:05:33 +02:00
Sebastian Hahn
d365bc965d Only delay counting bridge users if we were a relay before 2010-08-05 13:05:32 +02:00
Karsten Loesing
166c2f4d92 Allow enabling or disabling *Statistics while Tor is running.
With this patch we stop scheduling when we should write statistics using a
single timestamp in run_scheduled_events(). Instead, we remember when a
statistics interval starts separately for each statistic type in geoip.c
and rephist.c. Every time run_scheduled_events() tries to write stats to
disk, it learns when it should schedule the next such attempt.

This patch also enables all statistics to be stopped and restarted at a
later time.

This patch comes with a few refactorings, some of which were not easily
doable without the patch.
2010-08-05 13:05:25 +02:00
Sebastian Hahn
161b275028 Retry streams that ended with NOROUTE error
Also add the NOROUTE reason to control-spec.
2010-08-04 00:51:39 +02:00
Sebastian Hahn
150ed553df Introduce END_STREAM_REASON_NOROUTE 2010-08-03 16:46:28 +02:00
Sebastian Hahn
b8aa14a39b Handle EHOSTUNREACH in errno_to_stream_end_reason()
We used to not recognize it and returned END_STREAM_REASON_MISC.
Instead, return END_STREAM_REASON_INTERNAL.
2010-08-03 14:03:36 +02:00
Sebastian Hahn
ddf5020ea8 Fix 'make distcheck'
We were leaving doc/config.log and src/or/micro-revision.i in
place during a make clean. Fix that.
2010-08-03 00:48:59 +02:00
Nick Mathewson
9265190b16 Merge branch 'bug1384' 2010-08-02 12:53:52 -04:00
Sebastian Hahn
a9d055c5c5 Fix a compile warning on OS X 10.6
Also update the changes file to contain a note on which bug was
fixed by this.
2010-08-02 18:45:17 +02:00
Chris Ball
73a4c0690e Bug #919: Don't rebind ports if we receive SIGHUP while hibernating. 2010-08-02 12:14:01 -04:00
Chris Ball
9ffa977981 Bug #928: Disallow BridgeRelay 1 and ORPort 0 configuration 2010-08-02 12:04:04 -04:00
Chris Ball
600ba86f4a Bug #1107: Complain if PublishServerDescriptor receives 0 or 1 in a list
0 or 1 should only be passed as the sole argument. Warn for now, reject
in 0.2.3.x.
2010-08-02 12:02:06 -04:00
Nick Mathewson
fbfaa7bbc4 Merge commit 'sebastian/bug1776_v2' 2010-08-02 11:32:49 -04:00
Nick Mathewson
4504640b10 Merge branch 'bug1094_v2' 2010-08-02 11:11:02 -04:00
Chris Ball
1470eb2e91 Bug #1222: Clarify new circuit after sleep notice
("Application request when we're believed to be offline." ->
 "Application request when we haven't used client functionality lately.")
2010-07-31 16:58:49 -04:00
Nick Mathewson
fac272da31 If a router is hibernating, never vote that it is Running.
Also, clean up and comment some of the logic in
dirserv_set_router_is_running.
2010-07-31 16:33:45 -04:00
Nick Mathewson
b175c584d5 Set up the geoip country table right even if not called normally 2010-07-31 15:21:08 -04:00
Nick Mathewson
4dd4d240b7 Move the "nowhereland" logic into geoip.c 2010-07-31 15:21:00 -04:00
Nick Mathewson
8fca6fb2aa Make "Nowhere" explicitly listable in torrc.
We already had the country code ?? indicating an unknown country, so all we
needed to do to make unknown countries excludable was to make the ?? code
discoverable.
2010-07-31 15:00:06 -04:00
Nick Mathewson
39378bf182 Warn when encounter the same (non-list) option twice in the same place
It's okay to get (say) a SocksPort line in the torrc, and then a
SocksPort on the command line to override it, and then a SocksPort via
a controller to override *that*.  But if there are two occurrences of
SocksPort in the torrc, or on the command line, or in a single SETCONF
command, then the user is likely confused.  Our old code would not
help unconfuse the user, but would instead silently ignore all but
the last occurrence.

This patch changes the behavior so that if the some option is passed
more than once to any torrc, command line, or SETCONF (each of which
coincidentally corresponds to a call to config_assign()), and the
option is not a type that allows multiple occurrences (LINELIST or
LINELIST_X), then we can warn the user.

This closes trac entry 1384.
2010-07-31 13:16:48 -04:00
Sebastian Hahn
9ca311f622 Allow using regular relays as bridges 2010-07-31 10:24:24 +02:00
Nick Mathewson
6f45101327 Clear cell queues when marking or truncating a circuit.
At best, this patch helps us avoid sending queued relayed cells that
would get ignored during the time between when a destroy cell is
sent and when the circuit is finally freed.  At worst, it lets us
release some memory a little earlier than it would otherwise.

Fix for bug #1184.  Bugfix on 0.2.0.1-alpha.
2010-07-30 18:55:24 -04:00
Linus Nordberg
da49a7267f Fix typos, make all \brief's conformant, end sentences with a period. 2010-07-28 17:42:33 +02:00
Sebastian Hahn
986dd554f4 Move the header for bandwidth_weight_rule_to_string into reasons.h 2010-07-27 10:00:47 +02:00
Sebastian Hahn
7b2b1b587d Don't include crypto, compat and util.h in or.h 2010-07-27 10:00:46 +02:00
Sebastian Hahn
02a57bbda5 Add the new header files to noinst_HEADERS
Also add a changes/ file.
2010-07-27 10:00:46 +02:00
Sebastian Hahn
05072723cb Create routerparse.h 2010-07-27 10:00:46 +02:00
Sebastian Hahn
df9d42cef5 Create rephist.h 2010-07-27 10:00:46 +02:00
Sebastian Hahn
52e6e915fb Create rendmid.h 2010-07-27 10:00:45 +02:00
Sebastian Hahn
b0cd4551ab Create relay.h 2010-07-27 10:00:45 +02:00
Sebastian Hahn
cc060ea220 Create reasons.h 2010-07-27 10:00:45 +02:00
Sebastian Hahn
7bd8dee463 Create policies.h 2010-07-27 10:00:45 +02:00
Sebastian Hahn
f6852fe031 Create onion.h 2010-07-27 10:00:45 +02:00
Sebastian Hahn
af0c954bc5 Create ntmain.h 2010-07-27 10:00:39 +02:00
Sebastian Hahn
69fcbbaa89 Create networkstatus.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
86d6bfe448 Create microdesc.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
0f1548ab18 Create main.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
a86f464f6b Create hibernate.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
dc2f1666ff Create dns.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
85f7d54418 Create dirvote.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
7d4c027fb0 Create dirserv.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
bec1c838ca Create directory.h 2010-07-27 07:58:15 +02:00
Sebastian Hahn
98d1314c7e Create cpuworker.h 2010-07-27 07:58:15 +02:00
Sebastian Hahn
0bfa34e1f6 Create control.h 2010-07-27 07:58:15 +02:00
Sebastian Hahn
0d33120c26 Create connection_or.h 2010-07-27 07:58:15 +02:00
Sebastian Hahn
78b6a4650b Create connection_edge.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
2a74101f7a Create connection.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
c4f8f1316e Create config.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
3074d5a221 Create command.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
01c7b60a80 Create circuituse.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
174a88dd79 Create circuitlist.h 2010-07-27 07:58:13 +02:00
Sebastian Hahn
21155204c6 Create circuitbuild.h 2010-07-27 07:58:13 +02:00
Sebastian Hahn
34dfce0d82 Create buffers.h 2010-07-27 07:56:26 +02:00
Sebastian Hahn
85a1d635d5 Create rendservice.h 2010-07-27 07:56:26 +02:00
Sebastian Hahn
7caa8351b8 Create rendclient.h 2010-07-27 07:56:26 +02:00
Sebastian Hahn
31e81439e1 Create rendcommon.h 2010-07-27 07:56:25 +02:00
Sebastian Hahn
cbee969f40 Create routerlist.h 2010-07-27 07:56:25 +02:00
Sebastian Hahn
c53b6cc831 Create router.h 2010-07-27 07:56:25 +02:00
Sebastian Hahn
ff4030f621 Create geoip.h 2010-07-27 07:56:25 +02:00
Sebastian Hahn
e69dc22f4e Split headers for dnsserv.c functions out of or.h
The next series of commits begins addressing the issue that we're
currently including the complete or.h file in all of our source files.
To change that, we're splitting function definitions into new header
files (one header file per source file).
2010-07-27 07:56:25 +02:00
Roger Dingledine
1d6656fcb3 mike needs DEFAULT_ROUTE_LEN in other files 2010-07-21 09:30:26 -04:00
Roger Dingledine
b178c81de3 whitespace fix 2010-07-21 09:24:14 -04:00
Roger Dingledine
66d5ce266e naked constants are bad 2010-07-20 08:07:44 -04:00
Nick Mathewson
d461799f0b Fix getinfo_helper_networkstatus to return 0 on question-not-known
It erroneously returned -1 instead, which made it say "Internal error"
rather than "Unrecognized key."
2010-07-18 17:13:25 +02:00
Nick Mathewson
0b4b51314f Make the controller act more usefully when GETINFO fails
Right now it says "552 internal error" because there's no way for
getinfo_helper_*() countries to specify an error message.  This
patch changes the getinfo_helper_*() interface, and makes most of the
getinfo helpers give useful error messages in response to failures.

This should prevent recurrences of bug 1699, where a missing GeoIPFile
line in the torrc made GETINFO ip-to-county/* fail in a "not obvious
how to fix" way.
2010-07-18 17:05:58 +02:00
Mike Perry
9d5d0f040f Alter how guard flags are chosen.
V3 authorities no longer decide not to vote on Guard+Exit. The bandwidth
weights should take care of this now.

Also, lower the max threshold for WFU to 0.98, to allow more nodes to become
guards.
2010-07-14 20:49:19 -07:00
Roger Dingledine
54cdac97f1 print right controller purpose string for measure-timeout circs 2010-07-14 21:06:49 -04:00
Roger Dingledine
c6f5792404 No dirport should mean no hsdir flag (bug 1693) 2010-07-14 13:20:57 -04:00
Nick Mathewson
14bc4dcc22 Rename log.h to torlog.h
This should make us conflict less with system files named "log.h".
Yes, we shouldn't have been conflicting with those anyway, but some
people's compilers act very oddly.

The actual change was done with one "git mv", by editing
Makefile.am, and running
   find . -name '*.[ch]' | xargs perl -i -pe 'if (/^#include.*\Wlog.h/) {s/log.h/torlog.h/; }'
2010-07-09 22:05:38 -04:00
Mike Perry
a9edb0b4f6 More gracefully handle corrupt state files.
Save a backup if we get odd circuitbuildtimes and other state info.

In the case of circuit build times, we no longer assert, and reset our state.
2010-07-06 12:11:22 -07:00
Mike Perry
7bbdf71a82 Fix unittest failure in bug 1660.
We now record large times as abandoned, to prevent a filter step from
happening and skewing our results.

Also, issue a warn for a rare case that can happen for funky values of Xm or
too many abandoned circuits. Can happen (very rarely) during unit tests, but
should not be possble during live operation, due to network liveness filters
and discard logic.
2010-07-06 12:11:13 -07:00
Karsten Loesing
6bb8747ffb Make directory mirrors report non-zero dirreq-v[23]-shares again. 2010-07-05 10:45:24 +02:00
Nick Mathewson
741ab2a47a Fix bugs with assuming time_t can be implicitly cast to long
Many friendly operating systems have 64-bit times, and it's not nice
to pass them to an %ld format.

It's also extremely not-nice to write a time to the log as an
integer.  Most people think it's 2010 June 29 23:57 UTC+epsilon, not
1277855805+epsilon.
2010-06-29 19:55:10 -04:00
Nick Mathewson
485cab869d Merge remote branch 'public/rand_double2' 2010-06-29 18:57:59 -04:00
Nick Mathewson
bea55766af Merge remote branch 'mikeperry/cbt-bugfixes3' 2010-06-29 18:57:50 -04:00
Roger Dingledine
1def582217 Group in torrc is obsolete, so stop checking it 2010-06-27 02:31:00 -04:00
Nick Mathewson
b111a7cd9c Make cbt_generate_sample use crypto_rand_double()
Possible workaround for bug 1139, if anybody cares.
2010-06-25 21:33:22 -04:00
Nick Mathewson
ad2d8ac073 Use Libevent 2.0's periodic timers where available.
These timers behave better with non-monotonic clocks than our old
ones, and also try harder to make once-per-second events get called
one second apart, rather than one-plus-epsilon seconds apart.

This fixes bug 943 for everybody using Libevent 2.0 or later.
2010-06-25 15:31:46 -04:00
Kat Magic
e2b117eb80 Remove the extra space that is sent in certain STREAM messages from the controller. (closes #1583) 2010-06-22 20:49:29 -04:00
Mike Perry
5dbf99d9ff Mention the purpose field for leaked circuits. 2010-06-16 18:13:27 -07:00
Mike Perry
2abe1ceccf Add CLOSE_MS and CLOSE_RATE keywords to buildtimeout event. 2010-06-15 20:04:49 -07:00
Mike Perry
82922ea45a Be more proactive about closing unused circuits.
We need to ensure that we close timeout measurement circuits. While
we're at it, we should close really old circuits of certain types that
aren't in use, and log really old circuits of other types.
2010-06-15 20:04:46 -07:00
Mike Perry
c6c8fbf852 Split the circuit timeout and close codepaths.
We need to record different statistics at point of timeout, vs the point
of forcible closing.

Also, give some better names to constants and state file variables
to indicate they are not dealing with timeouts, but abandoned circuits.
2010-06-15 20:04:42 -07:00
Mike Perry
f528a6e62b Fix initialization and reset issues with close_ms.
Also clean up some log messages.
2010-06-15 16:41:24 -07:00
Nick Mathewson
7be7f15198 Answer question from Roger. 2010-06-14 18:32:44 -04:00
Roger Dingledine
9f31a0098d a line that's been sitting in my sandbox for months 2010-06-14 18:25:37 -04:00
Nick Mathewson
945633476a Merge commit 'sebastian/hostnamewarn' 2010-06-11 13:21:31 -04:00
Nick Mathewson
be1c4672c4 Merge commit 'origin/maint-0.2.1' 2010-06-11 13:20:20 -04:00
Karsten Loesing
6c49b6bb77 Add maatuska as eighth v3 directory authority. 2010-06-11 19:10:55 +02:00
Sebastian Hahn
f7b40f45b7 Don't crash when reading cached*consensus files on startup
Fixes bug 1352
2010-06-10 16:18:26 +02:00
Mike Perry
c96206090e Keep circuits open until the greater of 95th CDF percentile or 60s.
This is done to provide better data to our right-censored Pareto model.

We do this by simply marking them with a new purpose.
2010-06-09 00:22:39 -07:00
Mike Perry
f897154b26 Make the Xm mode selection a consensus parameter. 2010-06-09 00:22:39 -07:00
Mike Perry
38770dd6a5 Add timeout count state variable. 2010-06-09 00:22:34 -07:00
Mike Perry
848d9f8b43 Remove synthetic timeout code in favor of better Pareto model. 2010-06-09 00:22:17 -07:00
Mike Perry
dc880924b7 Arma hates (\d+). Remove mine and some others. 2010-06-09 00:22:17 -07:00
Mike Perry
d76ebb79aa Improve log message about large timeouts and fix some typos. 2010-06-09 00:22:13 -07:00
Sebastian Hahn
10fdb9ee0a Add option to not warn when getting an IP instead of hostname 2010-06-07 12:44:25 +02:00
Sebastian Hahn
faf51fa52a Don't cannibalize one-hop circuits
In rare cases, we could cannibalize a one-hop circuit, ending up
with a two-hop circuit. This circuit would not be actually used,
but we should prevent its creation in the first place.

Thanks to outofwords and swissknife for helping to analyse this.
2010-06-04 21:04:08 +02:00
Roger Dingledine
7e300cbba3 Let bridge users use the non-primary address of a multi-homed bridge 2010-06-03 20:29:29 -04:00
valerino
076063ca90 moved wince related includes and defs to compat.h where possible, removed unused/redundant wince includes 2010-05-24 11:46:54 -04:00
valerino
8d31141ccb Port Tor to work on Windows CE
Most of the changes here are switches to use APIs available on Windows
CE.  The most pervasive change is that Windows CE only provides the
wide-character ("FooW") variants of most of the windows function, and
doesn't support the older ASCII verions at all.

This patch will require use of the wcecompat library to get working
versions of the posix-style fd-based file IO functions.

[commit message by nickm]
2010-05-24 11:46:45 -04:00
valerino
ddf250119d Log the correct address when purging a mismatchd DNS cache address 2010-05-20 22:51:47 -04:00
valerino
afe58cfa89 Don't use "try" as an identifier
C allows try, but some windows CE headers like to redefine 'try' to be
a reserved word.
2010-05-20 22:50:37 -04:00
Nick Mathewson
d8a1e2dabb Make rotate_request_period use BEGIN/END versions of FOREACH
This appeases some versions of MSVC, which don't like it when you
have preprocessor commands inside a set of macro arguments.
2010-05-17 12:20:52 -04:00
Mike Perry
d9be6f3845 Fix CBT unit tests. 2010-05-12 15:31:22 -07:00
Nick Mathewson
03dc1c786a Clarify 'marking connection as too old' messages
Back when we changed the idea of a connection being "too old" for new
circuits into the connection being "bad" for new circuits, we didn't
actually change the info messages.  This led to telling the user that
we were labelling connections as "too old" for being worse than
connections that were actually older than them.

Found by Scott on or-talk.
2010-05-12 14:15:39 -04:00
Mike Perry
a5ac96b58d Fix comments from Sebastian + Nick's code review.
Check for overflow in one place, and be consistent about type usage.
2010-05-10 19:56:27 -07:00
Mike Perry
29e0d70814 Bug 1296: Add option+logic to disable CBT learning.
There are now four ways that CBT can be disabled:

1. Network-wide, with the cbtdisabled consensus param.
2. Via config, with "LearnCircuitBuildTimeout 0"
3. Via config, with "AuthoritativeDirectory 1"
4. Via a state file write failure.
2010-05-10 13:11:48 -07:00
Mike Perry
0a6191cf70 Bug 1357: Store the suspended timeout value to resume.
This prevents a spurious warning where we have a timeout just after
deciding our network came back online.
2010-05-10 13:11:47 -07:00
Mike Perry
728e946efd Bug 1245: Ignore negative and large timeouts.
This should prevent some asserts and storage of incorrect build times
for the cases where Tor is suspended during a circuit construction, or
just after completing a circuit. The idea is that if the circuit
build time is much greater than we would have cut it off at, we probably
had a suspend event along this codepath, and we should discard the
value.
2010-05-10 13:11:46 -07:00
Mike Perry
e40e35507e Bump timeout calculation message to notice when timeout changes. 2010-05-10 13:01:25 -07:00
Mike Perry
eecdd94dec Add consensus parameter for max synthetic quantile.
In case we decide that the timeout rate is now too high due to our
change of the max synthetic quantile value, this consensus parameter
will allow us to restore it to the previous value.
2010-05-10 13:00:34 -07:00
Mike Perry
835ab53102 Add a TIMEOUT_RATE keyword to buildtimeout event. 2010-05-10 12:59:05 -07:00
Mike Perry
3bbc3e2137 Bug 1335: Implement filtering step to remove+prevent high timeouts.
This is for the other issue we saw in Bug 1335. A large number of high
timeouts were causing the timeout calculation to slowly drift upwards,
especially in conditions of load. This fix repeatedly regenerates all of
our synthetic timeouts whenever the timeout changes, to try to prevent
drift.

It also lowers the timeout cap to help for some cases of Bug 1245, where
some timeout values were so large that we ended up allocating a ton of
scratch memory to count the histogram bins.

The downside is that lowering this cap is affecting our timeout rate.
Unfortunately, the buildtimeout quantile is now higher than the actual
completion rate by what appears to be about 7-10%, which probably
represents the skew in the distribution due to lowering this synthetic
cap.
2010-05-10 12:58:10 -07:00
Mike Perry
cc2a48f1be Bug 1335: Alter Xm calculation to be weighted avg of top N=3 modes.
In my state files, I was seeing several peaks, probably due to different
guards having different latency. This change is meant to better capture
this behavior and generate more reasonable timeouts when it happens. It
is improving the timeout values for my collection of state files.
2010-05-10 12:46:49 -07:00
Roger Dingledine
e7bd97493c Merge branch 'maint-0.2.1' 2010-04-23 20:26:23 -04:00
Roger Dingledine
67b38d5068 close idle tls conns early 2010-04-23 20:23:00 -04:00
Roger Dingledine
b3019c6d2b Merge branch 'maint-0.2.1' 2010-04-23 19:46:29 -04:00
Roger Dingledine
b264192083 finally get rid of "clique mode" 2010-04-23 19:39:42 -04:00
Roger Dingledine
cb31978adb close idle dir-fetch circs early 2010-04-23 18:35:11 -04:00
Roger Dingledine
573e1d40b3 finally get rid of "clique mode" 2010-04-21 21:35:18 -04:00
Roger Dingledine
6952b445cc stop authority reachability check on startup 2010-04-21 04:27:56 -04:00
Roger Dingledine
4f307e0382 immediate reachability check for new relays 2010-04-21 03:12:14 -04:00
Roger Dingledine
92a6ae2b8d more logging when tracking missing descriptors 2010-04-20 18:02:23 -04:00
Roger Dingledine
eaf5487d95 fetch descriptors from the authority that told us about them 2010-04-20 03:20:31 -04:00
Roger Dingledine
2e692bd8c9 fetch unknown descriptors if we see them in a vote 2010-04-20 03:03:33 -04:00
Roger Dingledine
77babb832a minor cleanups 2010-04-20 02:48:35 -04:00
Nick Mathewson
f2c30e97cc Switch geoip_get_request_history to asprintf; fix bug 1365 2010-04-20 01:09:40 -04:00
Roger Dingledine
de4a49adc2 fix "Got a certificate for ?? that we already have"
what's happening here is that we're fetching certs for obsolete
authorities -- probably legacy signers in this case. but try to
remain general in the log message.
2010-04-19 18:35:57 -04:00
Nick Mathewson
e3cd535c7c Move the declaration of bandwidth_rate_rule_to_string
It's natural for the definition of bandwidth_rule_t to be with the functions
that actually care about its values.  Unfortunately, this means declaring
bandwidth_rate_rule_to_string() out of sequence.  Someday we'll just rename
reasons.c to strings.c, and put it at the end of or.h, and this will all be
better.
2010-04-19 16:39:29 -04:00
Roger Dingledine
c9573cf50b parameterize update_consensus_router_descriptor_downloads 2010-04-19 04:40:45 -04:00
Roger Dingledine
c29977ce00 simplify a path in networkstatus 2010-04-15 10:13:35 -04:00
Sebastian Hahn
71fb687ddd Add --enable-static-zlib option
Works like the --enable-static-openssl/libevent options. Requires
--with-zlib-dir to be set. Note that other dependencies might still
pull in a dynamicly linked zlib, if you don't link them in statically
too.
2010-04-14 19:28:21 +02:00
Nick Mathewson
fe57aab283 Merge branch 'correct_halflife' 2010-04-13 13:37:33 -04:00
Nick Mathewson
96a0edf373 Rename CircPriorityHalflifeMsec to CircuitPriorityHalflifeMsec
Everything that accepted the 'Circ' name handled it wrong, so even now
that we fixed the handling of the parameter, we wouldn't be able to
set it without making all the 0.2.2.7..0.2.2.10 relays act wonky.
This patch makes Tors accept the 'Circuit' name instead, so we can
turn on circuit priorities without confusing the versions that treated
the 'Circ' name as occasion to act weird.
2010-04-13 13:29:30 -04:00
Peter Palfrader
5e679acc72 testsuite: Prevent the main thread from starving the worker threads 2010-04-12 18:15:20 -04:00
Peter Palfrader
a02923122e testsuite: Only free the main mutex when and if all the worker threads are done 2010-04-12 18:15:17 -04:00
Nick Mathewson
311aca5a34 Log bandwidth_weight_rule_t as a string, not an integer.
I'm adding this because I can never remember what stuff like 'rule 3'
means.  That's the one where if somebody goes limp or taps out, the
fight is over, right?
2010-04-12 18:12:49 -04:00
Nick Mathewson
d888a8210f Fix a bug in reading CircPriorityHalflife from consensus
When you mean (a=b(c,d)) >= 0, you had better not say (a=b(c,d)>=0).
We did the latter, and so whenever CircPriorityHalflife was in the
consensus, it was treated as having a value of 1 msec (that is,
boolean true).
2010-04-12 15:38:54 -04:00
Roger Dingledine
8aec982f91 Merge branch 'maint-0.2.1'
Conflicts:

	ChangeLog
	configure.in
	contrib/tor-mingw.nsi.in
	src/win32/orconfig.h
2010-04-03 22:05:02 -04:00
Roger Dingledine
0324d3b0ec fetch relay descriptors from v3 authorities 2010-04-03 21:53:29 -04:00
Sebastian Hahn
80d9737e70 Fix a segfault when a client is hup'd.
We need to make sure we have an event_base in dns.c before we call
anything that wants one. Make sure we always have one in dns_reset()
when we're a client. Fixes bug 1341.
2010-04-03 12:31:59 +02:00
Nick Mathewson
927425150b Merge branch 'asprintf' 2010-04-02 12:30:46 -04:00
Sebastian Hahn
cae769d646 Segfault less during consensus generation without params
If no authority votes on any params, Tor authorities segfault when
trying to make a new consensus from the votes. Let's change that.
2010-03-29 22:25:37 +02:00
Roger Dingledine
fe3380609e In the glorious future, all relays cache dir info.
Now if you're a published relay and you set RefuseUnknownExits, even
if your dirport is off, you'll fetch dir info from the authorities,
fetch it early, and cache it.

In the future, RefuseUnknownExits (or something like it) will be on
by default.
2010-03-16 04:02:18 -04:00