Commit Graph

561 Commits

Author SHA1 Message Date
Roger Dingledine
cc73bc3853 Use nodes in EntryNodes even if they're not fast/stable 2009-12-21 03:52:33 -05:00
Roger Dingledine
7346804ec6 instrument entry_is_live to tell why our guard isn't live 2009-12-21 03:52:33 -05:00
Roger Dingledine
ef81649d2f Be more willing to use an unsuitable circuit for exit.
Specifically, there are two cases: a) are we willing to start a new
circuit at a node not in your ExitNodes config option, and b) are we
willing to make use of a circuit that's already established but has an
unsuitable exit.

Now we discard all your circuits when you set ExitNodes, so the only
way you could end up with an exit circuit that ends at an unsuitable
place is if we explicitly ran out of exit nodes, StrictNodes was 0,
and we built this circuit to solve a stream that needs solving.

Fixes bug in dc322931, which would ignore the just-built circuit because
it has an unsuitable exit.
2009-12-21 03:52:32 -05:00
Roger Dingledine
1a65bdd232 Make EntryNodes config option much more aggressive.
Before it would prepend your requested entrynodes to your list of guard
nodes, but feel free to use others after that. Now it chooses only
from your EntryNodes if any of those are available, and only falls back
to others if a) they're all down and b) StrictNodes is not set.

Also, now we refresh your entry guards from EntryNode at each consensus
fetch (rather than just at startup and then they slowly rot as the
network changes).

The goal here is to make users less likely to set StrictNodes, since
it's doing closer to what they expect it should be doing.
2009-12-21 03:52:31 -05:00
Roger Dingledine
580066f2f6 Switch to a StrictNodes config option.
This is step one of handling ExcludedNodes better. This first
step is just to make EntryNodes and ExitNodes do what they did
before.
2009-12-21 03:52:31 -05:00
Nick Mathewson
350181529e Merge branch 'safelogging2'
Conflicts:
	ChangeLog
2009-12-15 17:26:09 -05:00
Nick Mathewson
fcbd65b45c Refactor the safe_str_*() API to make more sense.
The new rule is: safe_str_X() means "this string is a piece of X
information; make it safe to log."  safe_str() on its own means
"this string is a piece of who-knows-what; make it safe to log".
2009-12-15 17:25:34 -05:00
Nick Mathewson
e56747f9cf Refactor a bit so that it is safe to include math.h, and mostly not needed. 2009-12-15 14:40:49 -05:00
Nick Mathewson
0c1b3070cf Now that FOO_free(NULL) always works, remove checks before calling it. 2009-12-12 02:07:59 -05:00
Sebastian Hahn
3807db001d *_free functions now accept NULL
Some *_free functions threw asserts when passed NULL. Now all of them
accept NULL as input and perform no action when called that way.

This gains us consistence for our free functions, and allows some
code simplifications where an explicit null check is no longer necessary.
2009-12-12 03:29:44 +01:00
Sebastian Hahn
f258647433 Allow SafeLogging to exclude client related information 2009-12-12 02:26:11 +01:00
Nick Mathewson
5e4d53d535 Remove checks for array existence. (CID 410..415)
In C, the code "char x[10]; if (x) {...}" always takes the true branch of
the if statement.  Coverity notices this now.

In some cases, we were testing arrays to make sure that an operation
we wanted to do would suceed.  Those cases are now always-true.

In some cases, we were testing arrays to see if something was _set_.
Those caes are now tests for strlen(s), or tests for
!tor_mem_is_zero(d,len).
2009-10-26 22:40:41 -04:00
Roger Dingledine
2394336426 read the "circwindow" parameter from the consensus
backport of c43859c5c1
backport of 0d13e0ed14
2009-10-14 17:07:32 -04:00
Roger Dingledine
9d6c79cbbb fix compile on windows 2009-10-11 17:23:47 -04:00
Sebastian Hahn
e35f9414d6 Fix a memleak when throwing away some build times
This was introduced in f7e6e852e8.
Found by Coverity
2009-10-10 13:41:44 +02:00
Mike Perry
18689317e4 Tweak an assert that shouldn't fire either way.
There were however other places where we used to call this
function that might have caused this to fire. Better
safe than sorry now.
2009-10-07 13:05:28 -07:00
Mike Perry
ec05e64a68 Tweak values for when to discard all of our history.
This seems to be happening to me a lot on a garbage DSL line.
We may need to come up with 2 threshholds: a high short onehop
count and a lower longer count.
2009-10-07 12:49:13 -07:00
Mike Perry
b918cd8f04 Remove another overzealous assert.
Pretimeouts may have build time data, just no timeout data.
2009-10-07 12:24:40 -07:00
Roger Dingledine
b4e0d09202 try to stem the 'sea of fail' 2009-10-01 05:35:24 -04:00
Roger Dingledine
9325b9269c Ignore one-hop circuits for circuit timeout calc
Don't count one-hop circuits when we're estimating how long it
takes circuits to build on average. Otherwise we'll set our circuit
build timeout lower than we should. Bugfix on 0.2.2.2-alpha.
2009-10-01 04:15:45 -04:00
Mike Perry
f7e6e852e8 Fix 1108: Handle corrupt or large build times state.
1108 was actually just a fencepost error in an assert,
but making the state file handling code resilient is a
good idea.
2009-09-29 14:07:04 -04:00
Sebastian Hahn
7f1f6984da Fix memory leak
Some memory could be lost in the error case of
circuit_build_times_parse_state.

Found by Coverity
2009-09-27 12:00:02 -04:00
Mike Perry
fd7454f9e3 Fix Bug 1103.
Don't pass in a quantile that is too high during pretimeout
calcualtion.
2009-09-21 20:01:20 -07:00
Mike Perry
134266b984 Change the condition on the nonlive timeout counting.
Try to clarify things in the comment too.
2009-09-20 18:20:10 -07:00
Roger Dingledine
cf2afcd707 Fix typos and comments, plus two bugs
A) We were considering a circuit had timed out in the special cases
where we close rendezvous circuits because the final rendezvous
circuit couldn't be built in time.
B) We were looking at the wrong timestamp_created when considering
a timeout.
2009-09-20 19:50:44 -04:00
Mike Perry
f39bedf250 Implement and document new network liveness algorithm.
Based on irc discussion with arma.
2009-09-20 14:51:30 -07:00
Mike Perry
6700e528be Fix some precision-related asserts in unit tests.
Mostly by storing the timeout as milliseconds and not seconds
internally.
2009-09-20 14:43:45 -07:00
Sebastian Hahn
335b67a354 Fix compile on freebsd 2009-09-18 02:43:45 +02:00
Roger Dingledine
ee89061ef2 give proposal 151 a changelog and other touchups 2009-09-17 01:42:33 -04:00
Mike Perry
43c18746bd Clarify use of magic number 0.98 with #define. 2009-09-16 18:41:22 -07:00
Sebastian Hahn
1aac7de1ea Fix unit tests and compile issues on Snow Leopard 2009-09-16 17:22:21 -07:00
Mike Perry
e2c2fa7a1f Change liveness value to be a function of the timeout.
And also the number of recent circuits used to decide
when the network changes.
2009-09-16 17:20:34 -07:00
Mike Perry
e4e0ce94f0 Add log message so we have accurate build time values. 2009-09-16 17:20:34 -07:00
Mike Perry
5bd60d8a41 Address nickm's issues from his review #1. 2009-09-16 17:20:29 -07:00
Mike Perry
0352d43917 Move circuitbuildtimeout config check.
We want it to be under our control so it doesn't mess
up initialization. This is likely the cause for
the bug the previous assert-adding commit (09a75ad) was
trying to address.
2009-09-16 15:58:42 -07:00
Mike Perry
09a75ad316 Time for some debugging by asserts.
Got a negative timeout value on startup. Need to narrow it down.
2009-09-16 15:55:51 -07:00
Mike Perry
742e08046f Fix bugs relating to not counting timeouts as circuit builds.
Also use bin midpoints for time values.
2009-09-16 15:55:51 -07:00
Mike Perry
67cee75ca2 Document functions and constants. 2009-09-16 15:55:50 -07:00
Mike Perry
c9363df09f Remove an assert.
It seems to fire because of precision issues. Added
more debug info to the warn to try to figure out for sure.
2009-09-16 15:55:50 -07:00
Mike Perry
63be2df84f Fix issues found by arma in review. 2009-09-16 15:55:36 -07:00
Roger Dingledine
672e2f6908 space/indent cleanups, plus point out three bugs 2009-09-16 15:55:32 -07:00
Mike Perry
4b3bc714a3 Woops. Fix a couple memory leaks.
Also change the max timeout quantile to 0.98, so we can
avoid huge synthetic timeout values.
2009-09-16 15:54:37 -07:00
Karsten Loesing
b508e4748f Remove trailing spaces. As if bytes were free...
Also correct some typos.
2009-09-16 15:52:05 -07:00
Mike Perry
535423a3bb Resolve mode ties in favor of the higher (slower) mode. 2009-09-16 15:52:04 -07:00
Mike Perry
8210336182 More detail for some log msgs. 2009-09-16 15:52:04 -07:00
Mike Perry
6eba08e22f Use our variable directly for timeout.
Using CircuitBuildTimeout is prone to issues with SIGHUP, etc.
Also, shuffle the circuit build times array after loading it
in so that newer measurements don't replace chunks of
similarly timed measurements.
2009-09-16 15:52:04 -07:00
Mike Perry
fca8446949 Fix a couple of assert bugs. 2009-09-16 15:52:03 -07:00
Mike Perry
c4e6b3eadb Fix timeout edge case when we get enough samples.
Also switch Xm calculation to mode, not min.
2009-09-16 15:52:03 -07:00
Mike Perry
95735e5478 Fix the math.h log() conflict.
It was compiling, but causing segfaults.

Also, adjust when the timer starts for new test circs
and save state every 25 circuits.
2009-09-16 15:51:17 -07:00
Mike Perry
7ac9a66c8f Recover from changing network connections.
Also add code to keep creating circuits every minute until we
hit our minimum threshhold.
2009-09-16 15:51:16 -07:00
Mike Perry
411b60325b Factor out the pretimeout handling code.
We need to also call it if we're going to calculate alpha
after a normal circuit build.
2009-09-16 15:51:15 -07:00
Mike Perry
b52bce91fc Write unit tests and fix issues they uncovered. 2009-09-16 15:51:10 -07:00
Mike Perry
04414830fe Implement the pareto fitting and timeout calculating bits. 2009-09-16 15:48:52 -07:00
Mike Perry
7750bee21d Clean up Fallon's partially complete GSoC project.
The code actually isn't that bad. It's a shame she didn't finish.
Using it as the base for this feature.
2009-09-16 15:48:51 -07:00
Nick Mathewson
ed7283d283 Merge commit 'origin/maint-0.2.1'
Resolved conflicts in:
	src/or/circuitbuild.c
2009-09-15 19:37:26 -04:00
Sebastian Hahn
113ba0e727 make some bug 1090 warnings go away
When we excluded some Exits, we were sometimes warning the user that we
were going to use the node regardless. Many of those warnings were in
fact bogus, because the relay in question was not used to connect to
the outside world.

Based on patch by Rotor, thanks!
2009-09-16 01:17:51 +02:00
Sebastian Hahn
5e01a86b42 some cleanups:
documentation fix for get_uint64
remove extra "." from a log line
fix a long line
2009-09-15 07:12:12 -04:00
Roger Dingledine
c43859c5c1 Read "circwindow=x" from the consensus and use it
Tor now reads the "circwindow" parameter out of the consensus,
and uses that value for its circuit package window rather than the
default of 1000 cells. Begins the implementation of proposal 168.
2009-09-15 06:33:33 -04:00
Roger Dingledine
a225469ded Merge branch 'maint-0.2.1' 2009-08-31 16:26:01 -04:00
Roger Dingledine
4c297f74f7 Only send reachability status events on overall success/failure
We were telling the controller about CHECKING_REACHABILITY and
REACHABILITY_FAILED status events whenever we launch a testing
circuit or notice that one has failed. Instead, only tell the
controller when we want to inform the user of overall success or
overall failure. Bugfix on 0.1.2.6-alpha. Fixes bug 1075. Reported
by SwissTorExit.
2009-08-31 16:14:41 -04:00
Nick Mathewson
77ffd6b2a7 Merge commit 'origin/maint-0.2.1' 2009-05-31 19:17:22 -04:00
Nick Mathewson
c4c7dcd453 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.
2009-05-31 19:15:36 -04:00
Nick Mathewson
cb18fc2190 Merge commit 'origin/maint-0.2.1' 2009-05-27 18:12:18 -04:00
Nick Mathewson
ec7e054668 Spell-check Tor. 2009-05-27 17:55:51 -04:00
Nick Mathewson
b998fed9b9 Remove support for events without the extended format or long names.
Supporting the old formats made our code complex; running without them
has been discouraged since 0.2.1.x.
2009-05-25 12:52:25 -04:00
Karsten Loesing
9b32e8c141 Update copyright to 2009. 2009-05-04 11:28:27 -04:00
Karsten Loesing
4ebcc4da34 Update copyright to 2009. 2009-05-02 22:00:54 +02:00
Roger Dingledine
235a1196b3 only log that at loglevel notice if there's a problem with the
version. otherwise there's no reason to tell the user we're
doing behind-the-scenes cleaning.


svn:r19288
2009-04-11 12:06:27 +00:00
Roger Dingledine
48118b228e Clients replace entry guards that were chosen more than a few months
ago. This change should significantly improve client performance,
especially once more people upgrade, since relays that have been
a guard for a long time are currently overloaded.


svn:r19287
2009-04-11 12:00:18 +00:00
Nick Mathewson
a335b43a67 If we have a routerstatus but no routerinfo to name a router, use the routerstatus instead when generating circuit events. Also refactor a little.
svn:r19078
2009-03-18 19:30:30 +00:00
Roger Dingledine
5d50bc3e1d We were already rejecting relay begin cells with destination port
of 0. Now also reject extend cells with destination port or address
of 0. Suggested by lark.


svn:r18812
2009-03-09 00:53:42 +00:00
Nick Mathewson
261670b57e Patch from lark: if we get two extend cells for the same circuit id, drop the second. Previously, we had leaked an extend_info if the target connection was not open when the second arrived.
svn:r18668
2009-02-21 19:07:05 +00:00
Roger Dingledine
decdf4537a If we're using bridges and our network goes away, be more willing
to forgive our bridges and try again when we get an application
request. Bugfix on 0.2.0.x.


svn:r18396
2009-02-04 23:27:35 +00:00
Nick Mathewson
0d5f4d4e73 Remove some dead code.
svn:r18301
2009-01-28 17:36:34 +00:00
Nick Mathewson
c4b8fef362 Remove svn $Id$s from our source, and remove tor --version --version.
The subversion $Id$ fields made every commit force a rebuild of
whatever file got committed.  They were not actually useful for
telling the version of Tor files in the wild.

svn:r17867
2009-01-04 00:35:51 +00:00
Roger Dingledine
89d268848f take out my IMPOSSIBLE_TO_DOWNLOAD+1 hack
svn:r17850
2009-01-02 20:46:32 +00:00
Roger Dingledine
dfc6555ddd switch over the bridge descriptor download mechanism to
use the same download mechanism as other places.

i had to make an ugly hack around "IMPOSSIBLE_TO_DOWNLOAD+1".
we should unhack that sometime.


svn:r17834
2008-12-31 14:19:57 +00:00
Nick Mathewson
8625297cee Actually log reasons on unusable guards again.
svn:r17822
2008-12-29 20:17:20 +00:00
Nick Mathewson
df608fef45 Checkpoint my big bug-891 patch.
svn:r17757
2008-12-24 02:38:04 +00:00
Nick Mathewson
1e666bfcc1 Partially apply bug 891 parch from forest: check EXTEND cell address against real_addr, not addr. I have questions about the rest of the patch: see the flyspray entry.
svn:r17730
2008-12-22 16:22:04 +00:00
Nick Mathewson
55348884b5 Fix all of the doxygen warnings not pertaining to missing documentation.
svn:r17727
2008-12-22 14:56:16 +00:00
Nick Mathewson
a259af179b When we need to open a new origin circuit, log why.
svn:r17705
2008-12-19 18:51:49 +00:00
Nick Mathewson
122170c1d3 Downlgrade tweak, and answer lots of XXX021s. No actual code fixes in this patch.
svn:r17686
2008-12-18 16:11:24 +00:00
Nick Mathewson
26632d59dd Rename or_is_obsolete and move it to or_connection_t where it belongs.
svn:r17642
2008-12-17 14:59:19 +00:00
Nick Mathewson
e53ffaa4e4 Don't extend circuits over noncanonical connections with mismatched addresses.
Also, refactor the logic to check whether we will use a connection or
launch a new one into a new function.

svn:r17628
2008-12-15 21:17:53 +00:00
Roger Dingledine
e5be0504ab When the client is choosing entry guards, now it selects at most
one guard from a given relay family. Otherwise we could end up with
all of our entry points into the network run by the same operator. 
Suggested by Camilo Viecco. Fix on 0.1.1.11-alpha.

Not a backport candidate, since I think this might break for users
who only have a given /16 in their reachableaddresses, or something
like that.


svn:r17514
2008-12-08 00:04:29 +00:00
Roger Dingledine
ebe4ef12b9 when building preemptive circuits, ignore streams that have a
chosen exit node in mind already. otherwise we get tricked into
trying to build a new circuit that will handle them.


svn:r17184
2008-11-03 07:00:56 +00:00
Roger Dingledine
3e5a584d37 fix the other half of r17091. now that best_support can be -1,
we were complaining about no support for our one-hop streams,
when in fact choose_good_exit_server_general() has no business
caring about one-hop streams. patch from miner.


svn:r17181
2008-11-01 23:49:14 +00:00
Nick Mathewson
846e40d193 Patch from rovv: when we have no pending streams, choose exits with choose_good_exit_server_general() rather than with circuit_get_unhandled_ports() and friends. Bugfix on 0.1.1.x, at least.
svn:r17091
2008-10-14 17:05:52 +00:00
Roger Dingledine
c9bddb24b2 another coverity-found memory leak
svn:r17062
2008-10-12 03:21:05 +00:00
Roger Dingledine
95aace5aae minor memory leak found by coverity
svn:r17061
2008-10-12 03:19:17 +00:00
Nick Mathewson
745e5b0e22 Make sure ExcludeSingleHopRelays works for an exit.
svn:r16984
2008-09-26 19:09:12 +00:00
Nick Mathewson
e147e867be Proposal 152 implementation from Josh Albrecht, with tweaks.
svn:r16983
2008-09-26 18:58:45 +00:00
Nick Mathewson
8bbbbaf87b Add country-code support to configured node lists to implement the ever-popular "no exits in Monaco" feature (ExcludeExitNodes {MC}). Also allow country codes and IP ranges in ExitNodes. (EntryNodes needs more work.) Based on code by Robert Hogan. Needs more testing.
svn:r16966
2008-09-25 20:21:35 +00:00
Nick Mathewson
545b317e1f Fix for bug 797 (by arma, with tweaks): always use create_fast for circuits where we do not know an onion key.
svn:r16942
2008-09-23 20:13:23 +00:00
Roger Dingledine
cfff21e78a backport candidate:
If not enough of our entry guards are available so we add a new
one, we might use the new one even if it overlapped with the
current circuit's exit relay (or its family). Anonymity bugfix
pointed out by rovv.


svn:r16698
2008-08-31 06:33:39 +00:00
Roger Dingledine
8f5642edbc Relays now reject risky extend cells: if the extend cell includes
a digest of all zeroes, or asks to extend back to the relay that
sent the extend cell, tear down the circuit. Ideas suggested
by rovv.


svn:r16605
2008-08-20 05:21:43 +00:00
Nick Mathewson
960a0f0a99 r17641@31-33-44: nickm | 2008-08-05 16:07:53 -0400
Initial conversion of uint32_t addr to tor_addr_t addr in connection_t and related types.  Most of the Tor wire formats using these new types are in, but the code to generate and use it is not.  This is a big patch.  Let me know what it breaks for you.


svn:r16435
2008-08-05 20:08:19 +00:00
Roger Dingledine
d01813a8dd Take out the TestVia config option, since it was a workaround for
a bug that was fixed in Tor 0.1.1.21.


svn:r16409
2008-08-05 00:12:05 +00:00
Karsten Loesing
d166b9dc45 Make check-spaces happy.
svn:r16406
2008-08-04 23:39:07 +00:00