Commit Graph

306 Commits

Author SHA1 Message Date
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
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
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
ff4030f621 Create geoip.h 2010-07-27 07:56:25 +02: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
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
Nick Mathewson
b006e3279f Merge remote branch 'origin/maint-0.2.1'
Conflicts:
	src/common/test.h
	src/or/test.c
2010-02-27 17:16:31 -05:00
Nick Mathewson
c3e63483b2 Update Tor Project copyright years 2010-02-27 17:14:21 -05:00
Nick Mathewson
60b01c6d5e Change interface for configuring cell ewma algorithm.
The rule is now: take the value from the CircuitPriorityHalflife
config option if it is set.  If it zero, disable the cell_ewma
algorithm.  If it is set, use it to calculate the scaling factor.
If it is not set, look for a CircPriorityHalflifeMsec parameter in the
consensus networkstatus.  If *that* is zero, then disable the cell_ewma
algorithm; if it is set, use it to calculate the scaling factor.
If it is not set at all, disable the algorithm.
2009-12-15 13:58:24 -05:00
Nick Mathewson
296381eda0 Merge commit 'sebastian/ewma2' into ewma
Conflicts:
	src/or/relay.c
2009-12-15 13:23:27 -05:00
Nick Mathewson
1292a9ddfe Fix various comment typos in ewma patch; found by arma. 2009-12-15 13:20:22 -05:00
Sebastian Hahn
27b7746c51 Fix Snow Leopard compile and a codestyle violation
When calculating the current tick, cap (tv_sec / EWMA_TICK_LEN) to an unsigned int.
2009-12-14 05:17:45 +01:00
Nick Mathewson
06e8370c33 Optimize cell-ewma circuit priority algorithm.
There are two big changes here:
  - We store active circuits in a priority queue for each or_conn,
    rather than doing a linear search over all the active circuits
    before we send each cell.
  - Rather than multiplying every circuit's cell-ewma by a decay
    factor every time we send a cell (thus normalizing the value of a
    current cell to 1.0 and a past cell to alpha^t), we instead
    only scale down the cell-ewma every tick (ten seconds atm),
    normalizing so that a cell sent at the start of the tick has
    value 1.0).
2009-12-13 21:05:53 -05:00
Nick Mathewson
c43fee131d Adjust EWMA patch to conform to whitespace style. 2009-12-12 19:06:38 -05:00
Can Tang
d3be00e0f4 Favor quiet circuits when choosing which order to relay cells in.
Each circuit is ranked in terms of how many cells from it have been
relayed recently, using a time-weighted average.

This patch has been tested this on a private Tor network on PlanetLab,
and gotten improvements of 12-35% in time it takes to fetch a small
web page while there's a simultaneous large data transfer going on
simultaneously.

[Commit msg by nickm based on mail from Ian Goldberg.]
2009-12-12 19:06:38 -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
Roger Dingledine
403f99eaa4 add a minimum for CircuitStreamTimeout, plus a man page
plus some other unrelated touchups that have been sitting in my
sandbox
2009-11-22 07:15:30 -05:00
Roger Dingledine
fa23430496 clean up the XXX comments around bug 1038 2009-10-26 01:32:27 -04:00
Sebastian Hahn
0a71d1c6a7 Fix compile warnings on Snow Leopard
Big thanks to nickm and arma for helping me with this!
2009-09-01 22:16:46 +02:00
Karsten Loesing
8c29b7920a Add some fixes after discussion with Nick.
- Refactor geoip.c by moving duplicate code into rotate_request_period().
- Don't leak memory when cleaning up cell queues.
- Make sure that exit_(streams|bytes_(read|written)) are initialized in all
  places accessing these arrays.
- Read only the last block from *stats files and ensure that its timestamp
  is not more than 25 hours in the past and not more than 1 hour in the
  future.
- Stop truncating the last character when reading *stats files.

The only thing that's left now is to avoid reading whole *stats files into
memory.
2009-08-21 23:02:36 +02:00
Karsten Loesing
dccadb30cd Clean up proposal 166 and its implementation. 2009-08-18 15:53:08 +02:00
Karsten Loesing
799af41157 Use memory pool for insertion times. 2009-08-17 13:30:11 +02:00
Karsten Loesing
f37af0180d Implement queue with O(1) operations, and correct some math. 2009-08-17 13:30:11 +02:00
Karsten Loesing
858a8f809d Reduce cell statistics accuracy from 1 ms to 10 ms. 2009-08-17 13:30:11 +02:00
Karsten Loesing
d97e95cb62 Remove ./configure option for cell statistics. 2009-08-17 13:30:09 +02:00
Karsten Loesing
ab7729f472 Remove ./configure option for entry and dir request statistics. 2009-08-17 13:29:50 +02:00
Roger Dingledine
afc9da7287 Merge branch 'maint-0.2.1' 2009-08-10 04:17:32 -04:00
Roger Dingledine
e50b7768b9 Send sendmes when we're down 100 cells, not 101.
Send circuit or stream sendme cells when our window has decreased
by 100 cells, not when it has decreased by 101 cells. Bug uncovered
by Karsten when testing the "reduce circuit window" performance
patch. Bugfix on the 54th commit on Tor -- from July 2002,
before the release of Tor 0.0.0. This is the new winner of the
oldest-bug prize.
2009-08-10 04:13:18 -04:00
Roger Dingledine
e8e88922a7 Merge branch 'maint-0.2.1' into master 2009-07-28 18:19:57 -04:00
Roger Dingledine
2b63fa40e8 three hacks to workaround bug 1038
The problem is that clients and hidden services are receiving
relay_early cells, and they tear down the circuit.

Hack #1 is for rendezvous points to rewrite relay_early cells to
relay cells. That way there are never any incoming relay_early cells.

Hack #2 is for clients and hidden services to never send a relay_early
cell on an established rendezvous circuit. That works around rendezvous
points that haven't upgraded yet.

Hack #3 is for clients and hidden services to not tear down the circuit
when they receive an inbound relay_early cell. We already refuse extend
cells at clients.
2009-07-27 21:58:32 -04:00
Karsten Loesing
7b716878cb Fix dirreq and cell stats on 32-bit architectures.
When determining how long directory requests take or how long cells spend
in queues, we were comparing timestamps on microsecond detail only to
convert results to second or millisecond detail later on. But on 32-bit
architectures this means that 2^31 microseconds only cover time
differences of up to 36 minutes. Instead, compare timestamps on
millisecond detail.
2009-07-27 16:23:53 +02:00
Karsten Loesing
8c496d1660 Some tweaks to statistics.
Changes to directory request statistics:

- Rename GEOIP statistics to DIRREQ statistics, because they now include
  more than only GeoIP-based statistics, whereas other statistics are
  GeoIP-dependent, too.
- Rename output file from geoip-stats to dirreq-stats.
- Add new config option DirReqStatistics that is required to measure
  directory request statistics.
- Clean up ChangeLog.

Also ensure that entry guards statistics have access to a local GeoIP
database.
2009-07-15 16:32:40 +02:00
Karsten Loesing
416940d93b Some tweaks to directory request download times.
- Use common prefixes DIRREQ_* and dirreq_*.
- Replace enums in structs with bitfields.
2009-07-15 16:14:14 +02:00
Karsten Loesing
3c05132575 Directories now also measure download times of network statuses. 2009-07-15 16:12:45 +02:00
Roger Dingledine
9ece0955f7 fix comments and other typos 2009-07-13 17:34:46 -04:00
Karsten Loesing
b493a2ccb9 If configured, write cell statistics to disk periodically. 2009-07-05 19:53:25 +02:00
Nick Mathewson
0d2976d64b Merge commit 'origin/maint-0.2.1' 2009-06-16 16:18:16 -04:00
Nick Mathewson
7f8a6c5e92 Revise earlier check for correct IPv4 addr length to check for ==4.
We need this to match the check in connection_ap_handshake_socks_resolved().

Found by optimist.
2009-06-16 16:12:06 -04:00
Roger Dingledine
845326317d Check answer_len in the remap_addr case of process_relay_cell_not_open.
Fix an edge case where a malicious exit relay could convince a
controller that the client's DNS question resolves to an internal IP
address. Bug found and fixed by "optimist"; bugfix on 0.1.2.8-beta.
2009-06-12 11:22:54 -04:00
Roger Dingledine
cb1617f18e Check answer_len in the remap_addr case of process_relay_cell_not_open.
Fix an edge case where a malicious exit relay could convince a
controller that the client's DNS question resolves to an internal IP
address. Bug found and fixed by "optimist"; bugfix on 0.1.2.8-beta.
2009-06-12 11:18:02 -04:00
Nick Mathewson
4913a8c4ba Merge commit 'origin/maint-0.2.1' 2009-05-28 16:07:49 -04:00
Nick Mathewson
873faffb5a Two more spelling fix fixes. 2009-05-28 12:26:17 -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
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
Karsten Loesing
e25fdce900 Documentation fix. 2009-05-02 21:47:03 +02:00
Roger Dingledine
4e094ddc4d when we get an unrecognized relay streamid, log it
svn:r18919
2009-03-11 20:51:47 +00:00
Nick Mathewson
192b701fac Patch from lark: drop BEGIN cells from a rendevous circuit if they do not originate from the end of the circuit.
svn:r18667
2009-02-21 19:07:01 +00:00
Nick Mathewson
f772fc0c36 apply a variant of rovv's bug 872 patch, and document that we want a better solution for 0.2.2.x.
svn:r17924
2009-01-05 20:52:14 +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
Karsten Loesing
9a04358d87 Debug code for task 878.
svn:r17828
2008-12-30 11:43:50 +00:00
Nick Mathewson
c1c7f982d9 Do not not cannibalize a circuit that has run out of RELAY_EARLY cells. Partial bug 878 fix.
svn:r17815
2008-12-29 19:55:17 +00:00
Nick Mathewson
558e9899e4 Document most undocumented variables.
svn:r17754
2008-12-23 17:56:31 +00:00
Nick Mathewson
b68379b13b Add DOCDOC entries for undocumented static and global variables.
svn:r17739
2008-12-22 19:00:05 +00:00
Nick Mathewson
1e5f457461 Fix most DOCDOCs remaining and/or added by redox.
svn:r17734
2008-12-22 17:53:04 +00:00
Nick Mathewson
1725c0c8a5 Add DOCDOC comments for all undocumented functions. Add missing *s to other comments so that they will get recognized as doxygen.
svn:r17729
2008-12-22 14:56:28 +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
c67bd80487 Make cell pools always-on.
svn:r17692
2008-12-18 17:28:50 +00:00
Nick Mathewson
bf80e2df3f Replace calls to time(NULL) that occur on the order of once per read, one per write, or once per cell with calls to a function that looks at a cached value of time. This is tricksy to benchmark, since it will only help on systems where time() is a syscall and syscalls are relatively slow.
svn:r17690
2008-12-18 17:19:04 +00:00
Nick Mathewson
6693f32530 Resolve many DOCDOCs.
svn:r17662
2008-12-17 22:58:20 +00:00
Nick Mathewson
fc5e686b19 Whitespace fix.
svn:r17650
2008-12-17 17:20:36 +00:00
Nick Mathewson
68a6935afb Change CELL_DIRECTION_* to an enum.
svn:r17646
2008-12-17 17:20:19 +00:00
Nick Mathewson
7678ac5193 Move edge-only flags from connection_t to edge_connection_t.
svn:r17643
2008-12-17 14:59:28 +00:00
Roger Dingledine
5822e14dc9 When a stream at an exit relay is in state "resolving" or
"connecting" and it receives an "end" relay cell, the exit relay
would silently ignore the end cell and not close the stream. If
the client never closes the circuit, then the exit relay never
closes the TCP connection. Bug introduced in Tor 0.1.2.1-alpha;
reported by "wood".


svn:r17625
2008-12-14 19:40:56 +00:00
Nick Mathewson
ee31e0829e Verify cpath_layer match on rendezvous cells too. Fixes another case of bug 446. Based on patch from rovv.
svn:r17162
2008-10-27 16:46:45 +00:00
Roger Dingledine
bca46cc628 backport candidate:
The "ClientDNSRejectInternalAddresses" config option wasn't being
consistently obeyed: if an exit relay refuses a stream because its
exit policy doesn't allow it, we would remember what IP address
the relay said the destination address resolves to, even if it's
an internal IP address. Bugfix on 0.2.0.7-alpha; patch by rovv.


svn:r17135
2008-10-17 22:08:49 +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
Nick Mathewson
ea95ce25b6 r17323@aud-055: nickm | 2008-07-23 17:58:25 +0200
Implement most of proposal 110.


svn:r16156
2008-07-23 15:58:38 +00:00
Roger Dingledine
42f21007a3 consolidate all our edge/circ/orconn reason-to-foo-or-back functions
svn:r15115
2008-06-11 00:17:02 +00:00
Roger Dingledine
15680ce8d2 some cleanups in preparation for moving stuff around
svn:r15112
2008-06-10 23:13:14 +00:00
Roger Dingledine
45cc25c019 minor fixes and notes
svn:r15111
2008-06-10 23:00:11 +00:00
Roger Dingledine
6aeb79af06 report partial bootstrapping progress as we fetch descriptors
svn:r15083
2008-06-09 06:33:29 +00:00
Roger Dingledine
5aeb89447e infrastructure for the 'bootstrap status event' feature, so we can
tell the controller how we're doing at bootstrapping, and it can
tell the user.


svn:r15008
2008-06-07 05:27:34 +00:00
Nick Mathewson
4901ee0a8c r19273@catbus: nickm | 2008-04-09 14:44:23 -0400
Do a slightly better fix for r14329: don't call time() quite so much.  Also note the time(NULL) hack we wanted to do in the TODO.


svn:r14334
2008-04-09 18:44:50 +00:00
Nick Mathewson
186df044cd r19262@catbus: nickm | 2008-04-09 14:05:20 -0400
When writing relay cells to a buffer, update timestamp_last_added_nonpadding.  Bugfix on 0.2.0.1-alpha. Backport candidate.


svn:r14329
2008-04-09 18:05:47 +00:00
Nick Mathewson
e96d22e914 r18941@catbus: nickm | 2008-03-18 14:59:43 -0400
Likely fix for bug 632: do not call start_reading on a placeholder connection.


svn:r14109
2008-03-18 19:00:12 +00:00
Nick Mathewson
c59f66709d r18862@catbus: nickm | 2008-03-16 23:33:11 -0400
Part of fix for bug 617: allow connection_ap_handshake_attach_circuit() to mark connections, to avoid double-mark warnings.  Note that this is an incomplete refactoring.


svn:r14066
2008-03-17 03:37:54 +00:00
Roger Dingledine
5ec5a747d7 Quiet the "Exitrouter '%s' seems to be more restrictive than its exit
policy. Not using this router as exit for now." message, since it
legitimately appears every so often and there's no need to alarm users.


svn:r13677
2008-02-22 14:31:40 +00:00
Roger Dingledine
a60f7caa54 start allowing clients to give up on trackhostexits targets if
five circuit attempts fail for a given stream. part of the fix
for bug 437. still an XXX020rc remaining.


svn:r13648
2008-02-21 09:00:54 +00:00
Roger Dingledine
7427cf5d56 don't throw around an int for relay_command if we're going to
squeeze it into a uint8_t later. also reported by veracode.


svn:r13607
2008-02-20 00:57:37 +00:00
Roger Dingledine
913f66278c rearrange our assert so we don't possibly overflow rh.length before
triggering the assert. reported by veracode.


svn:r13601
2008-02-19 23:54:17 +00:00
Nick Mathewson
ff64e78b20 r14170@tombo: nickm | 2008-02-15 11:50:38 -0500
Fix or downgrade a bunch of xxx020 items.


svn:r13527
2008-02-15 19:20:53 +00:00
Nick Mathewson
f3eaeb99a3 r18051@catbus: nickm | 2008-02-12 15:20:43 -0500
Re-tune mempool parametes based on testing on peacetime: use smaller chuncks, free them a little more aggressively, and try very hard to concentrate allocations on fuller chunks.  Also, lots of new documentation.


svn:r13484
2008-02-12 20:20:52 +00:00
Nick Mathewson
809227a121 r14061@tombo: nickm | 2008-02-08 14:30:42 -0500
Add a couple of (currently disabled) strategies for trying to avoid using too much ram in memory pools: prefer putting new cells in almost-full chunks, and be willing to free the last empty chunk if we have not needed it for a while.  Also add better output to mp_pool_log_status to track how many mallocs a given memory pool strategy is saving us, so we can tune the mempool parameters.


svn:r13428
2008-02-08 21:13:08 +00:00
Nick Mathewson
eecc44dab8 r17963@catbus: nickm | 2008-02-07 10:14:25 -0500
Be more thorough about memory poisoning and clearing.  Add an in-place version of aes_crypt in order to remove a memcpy from relay_crypt_one_payload.


svn:r13414
2008-02-07 16:10:33 +00:00
Nick Mathewson
842a33ff20 Update some copyright notices: it is now 2008.
svn:r13412
2008-02-07 05:31:47 +00:00
Roger Dingledine
f76cdc1a61 misc small fixes
svn:r13403
2008-02-06 12:46:46 +00:00
Nick Mathewson
cf6fe27616 r17915@catbus: nickm | 2008-02-05 16:28:57 -0500
Remove a dead function.


svn:r13389
2008-02-05 21:39:46 +00:00
Roger Dingledine
ff62154ba3 New config options WarnPlaintextPorts and RejectPlaintextPorts so
Tor can warn and/or refuse connections to ports commonly used with
vulnerable-plaintext protocols.

We still need to figure out some good defaults for them.


svn:r13198
2008-01-20 05:54:15 +00:00
Nick Mathewson
11fff225fa r15779@tombo: nickm | 2008-01-01 23:43:24 -0500
Use reference-counting to avoid allocating a zillion little addr_policy_t objects. (This is an old patch that had been sitting on my hard drive for a while.)


svn:r13017
2008-01-02 04:43:44 +00:00
Roger Dingledine
1d8a8063b9 clean up copyrights, and assign 2007 copyrights to The Tor Project, Inc
svn:r12786
2007-12-12 21:09:01 +00:00
Nick Mathewson
e843e05563 r16670@catbus: nickm | 2007-11-14 14:56:30 -0500
Initial phase of proposal 110: accept RELAY_EARLY cells, and turn them into RELAY cells when sending them on over a v1 OR connection.


svn:r12496
2007-11-14 20:01:15 +00:00
Nick Mathewson
d3224bad42 r14227@Kushana: nickm | 2007-08-27 11:33:28 -0400
Add a new ClientDNSRejectInternalAddresses option (default: on) to refuse to believe that any address can map to or from an internal address.  This blocks some kinds of potential browser-based attacks, especially on hosts using DNSPort.  Also clarify behavior in some comments.  Backport candiate?


svn:r11287
2007-08-27 15:33:58 +00:00
Nick Mathewson
3fc04529d4 r14093@catbus: nickm | 2007-08-08 01:49:54 -0400
Include fewer redundant headers; use the compiler search paths better.


svn:r11060
2007-08-08 05:50:31 +00:00
Nick Mathewson
915c4c3ab8 r14001@catbus: nickm | 2007-07-29 21:31:53 -0400
Try to call time(NULL) a little less.


svn:r10980
2007-07-30 01:32:12 +00:00