Commit Graph

723 Commits

Author SHA1 Message Date
Nick Mathewson
d4354b506b Don't use OutboundBindAddress to connect to localhost
The OutboundBindAddress option is useful for making sure that all of
your outbond connections use a given interface.  But when connecting
to 127.0.0.1 (or ::1 even) it's important to actually have the
connection come _from_ localhost, since lots of programs running on
localhost use the source address to authenticate that the connection
is really coming from the same host.

Our old code always bound to OutboundBindAddress, whether connecting
to localhost or not.  This would potentially break DNS servers on
localhost, and socks proxies on localhost.  This patch changes the
behavior so that we only look at OutboundBindAddress when connecting
to a non-loopback address.
2010-01-20 13:09:10 -05:00
Sebastian Hahn
c32e8c292e Log a notice when we get a new control connection 2010-01-18 19:14:36 -05:00
Roger Dingledine
b9f1bd3c4e whitespace fixes 2010-01-15 15:58:35 -05:00
Roger Dingledine
f255272f45 add separate per-conn write limiting 2009-12-29 22:25:02 -05:00
Nick Mathewson
05a2473b7f Merge branch 'ewma' 2009-12-18 22:33:02 -05:00
Karsten Loesing
f80672d747 Remove duplicate words and a duplicate newline. 2009-12-18 12:55:05 +01: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
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
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
Roger Dingledine
4f8b36a1e2 clobber connections with different number than we clobber circuits 2009-11-21 23:02:10 -05:00
Roger Dingledine
7b6b931ccc stop assuming that our downcasts have a struct offset of 0
shouldn't actually change anything, but who knows.
2009-11-21 22:59:18 -05: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
1c62b9d5fa fix a bug where we were decrementing the wrong bucket
i think this doesn't actually affect anything, since linked
conns usually don't impact buckets
2009-10-10 14:52:41 -04:00
Roger Dingledine
86af2ecbda minor fixes in some comments 2009-09-06 20:09:08 -04:00
Nick Mathewson
1d9b8a1e16 Merge commit 'karsten/proposal-166-impl-master' 2009-08-26 11:36:40 -04:00
Nick Mathewson
707a6bd659 Merge commit 'public/socks-client'
Resolved conflict in:
	src/or/or.h
2009-08-26 11:27:19 -04:00
Nick Mathewson
903f9ef50e Clean up a couple of style issues in the socks-client branch. 2009-08-25 10:30:54 -04:00
Karsten Loesing
4e29f33427 Write all statistics to disk exactly every 24 hours. 2009-08-19 15:41:12 +02:00
Karsten Loesing
dccadb30cd Clean up proposal 166 and its implementation. 2009-08-18 15:53:08 +02:00
Karsten Loesing
ab7729f472 Remove ./configure option for entry and dir request statistics. 2009-08-17 13:29:50 +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
Karsten Loesing
4d6af73db8 If configured, write per-port exit statistics to disk periodically.
[Original patch series from Karsten, revised and squashed by Nick]
2009-07-02 12:37:05 -04:00
Christopher Davis
75472c19c3 Enable Tor to connect through SOCKS 4/5 proxies
Added a sanity check in config.c and a check in directory.c
directory_initiate_command_rend() to catch any direct connection attempts
when a socks proxy is configured.
2009-06-19 12:16:15 -04:00
Nick Mathewson
1e709c79d1 Isolate Libevent API dependency to just main.c and dns.c in src/or.
The rest of the code was only including event.h so that it could see
EV_READ and EV_WRITE, which we were using as part of the
connection_watch_events interface for no very good reason.
2009-06-12 14:27:53 -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
Mike Perry
29bf271ba2 Fix misreporting of stream bandwidths. 2009-05-14 17:52:26 -04:00
potentiate
1b61c8bf37 Fix misreporting of stream bandwidths. 2009-05-14 17:50:06 -04:00
Karsten Loesing
948835c680 Remove unused rendversion parameters. YAGNI. 2009-05-04 13:46:30 -04:00
Karsten Loesing
f79688ddef Clients do not request version 0 hidserv descs anymore. 2009-05-04 13:46:30 -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
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
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
Nick Mathewson
3a8a2cb2de Downgrade some xxx021s, comment more on others, etc
svn:r17823
2008-12-29 20:17:24 +00:00
Nick Mathewson
f7fb1bf931 Refactor sockaddr family match check into a new function
svn:r17820
2008-12-29 19:57:17 +00:00
Nick Mathewson
ae71b52945 remove the responsibility for setting listensocklen to the function that made the sockaddr
svn:r17799
2008-12-27 15:46:13 +00:00
Nick Mathewson
a87335472c Make connection_create_listener take a sockaddr_len, not just a sockaddr whose length we try to divine.
svn:r17792
2008-12-27 00:20:06 +00:00
Nick Mathewson
df5e8f65bc Add more missing documentation, and correct an error in container.c documentation: Don't introduce two parameters called n when you're calling an algorithm O(n).
svn:r17783
2008-12-26 17:35:08 +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
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
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
ecaee1d927 Remove fixed xxx020s; downgrade unfixed ones.
(The unfixed ones are being downgraded to regular XXXs mainly on the rationale that they don't seem to be exploding Tor, and they were apparently not showstoppers for 0.2.0.x-final.)

svn:r17682
2008-12-18 16:11:03 +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
Nick Mathewson
04ec7d1f98 Now that tor_assert is no longer using a broken force-to-boolean formulation, we can tor_assert a bitfield without a gcc compile error.
svn:r17598
2008-12-11 20:28:50 +00:00
Nick Mathewson
ae33d3ead7 Apply rovv's fix for bug 824.
svn:r16975
2008-09-26 15:30:26 +00:00
Nick Mathewson
8bc1536a9e Add patch 4 from Karsten for proposal 121, slightly modified. Karsten should definitely re-review the bits I changed.
svn:r16955
2008-09-24 14:44:29 +00:00
Roger Dingledine
4fd9880540 give rend_client_desc_here a slightly more accurate name
svn:r16916
2008-09-16 10:26:15 +00:00
Roger Dingledine
38f2272d5d patch from karsten for bug 814. whew.
svn:r16915
2008-09-16 10:17:04 +00:00
Roger Dingledine
2bde30efa6 read_to_buf should take an int *error_socket and return it.
svn:r16909
2008-09-14 08:35:41 +00:00
Karsten Loesing
52fbfc5d45 Correct indentation.
svn:r16819
2008-09-09 22:19:41 +00:00
Roger Dingledine
d37fae2f4e Catch and report a few more bootstrapping failure cases when Tor
fails to establish a TCP connection. Cleanup on 0.2.1.x.


svn:r16803
2008-09-09 06:25:39 +00:00
Nick Mathewson
baeb260ad1 Refactor use of connection_new so that we get more verifiable typesafety.
svn:r16785
2008-09-05 22:09:44 +00:00
Nick Mathewson
3f2b7078d2 Use warn_too_many_conns() when accept() fails with a resource limit.
svn:r16751
2008-09-04 15:22:55 +00:00
Nick Mathewson
730f1b6d3f Oops. Make warn_too_many_conns() actually work.
svn:r16686
2008-08-29 17:01:15 +00:00
Nick Mathewson
fcf817f897 Switch global_identifier on connections to a 64-bit field and move it to connection_t. When procession onionskins, look up the connection by this field rather than by addr:port. This will keep us from dropping onionskins. How many dropped circuits are dropped because of this bug?
svn:r16558
2008-08-15 13:55:01 +00:00
Nick Mathewson
30422b5df1 Rate-limit "too-many-sockets" messages; they can get needlessly verbose.
svn:r16480
2008-08-09 15:35:37 +00:00
Nick Mathewson
60a0ae198d Patch cleanups from karsten
svn:r16479
2008-08-09 15:13:28 +00:00
Nick Mathewson
d9601c65e0 r17666@tombo: nickm | 2008-08-07 15:12:30 -0400
Make tor_addr_from_sockaddr also give away the port in a useful format


svn:r16458
2008-08-07 19:13:35 +00:00
Nick Mathewson
9855c1d06f r17645@31-33-44: nickm | 2008-08-05 16:28:01 -0400
Make unspecified addresses also cause connection_is_rate_limited to say 0.


svn:r16437
2008-08-05 20:28:03 +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
3ce6e2fba2 r17346@aud-055: nickm | 2008-07-24 15:37:19 +0200
Make generic address manipulation functions work better.  Switch address policy code to use tor_addr_t, so it can handle IPv6.  That is a good place to start.


svn:r16178
2008-07-24 13:44:04 +00:00
Roger Dingledine
8fa912a8c5 If we close our OR connection because there's been a circuit
pending on it for too long, we were telling our bootstrap status
events "REASON=NONE". Now tell them "REASON=TIMEOUT".


svn:r15369
2008-06-20 04:42:17 +00:00
Roger Dingledine
94dabd2c23 If you're using bridges, generate "bootstrap problem" warnings
as soon as you run out of working bridges, rather than waiting
for ten failures -- which will never happen if you have less than
ten bridges.


svn:r15368
2008-06-20 04:34:39 +00:00
Roger Dingledine
c6a94718cd Directory authorities shouldn't complain about bootstrapping
problems just because they do a lot of reachability testing and
some of the connection attempts fail. 


svn:r15348
2008-06-18 07:34:04 +00:00
Roger Dingledine
8c85eef9b0 start sending "bootstrap problem" status events when we're having troubles
reaching relays.


svn:r15116
2008-06-11 01:14:23 +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
baa3cea213 Start noticing and reporting bootstrapping failures too. It looks like
we never bothered learning why OR conns fail, so next step is to add some
infrastructure for that.


svn:r15091
2008-06-09 18:32:43 +00:00
Roger Dingledine
5dc8062afa what, we went from v4 to v6?
svn:r14428
2008-04-23 18:37:24 +00:00
Roger Dingledine
5e299b5e01 minor fixes that have been accumulating
svn:r14378
2008-04-16 00:12:44 +00:00
Roger Dingledine
20f927c2dd forward-port r14373
svn:r14374
2008-04-15 23:06:31 +00:00
Nick Mathewson
e6b617bf05 r18872@catbus: nickm | 2008-03-16 23:56:48 -0400
Only dump all guard node status to the log when the guard node status actually changes.  Downgrade the 4 most common remaining INFO log messages to DEBUG.


svn:r14069
2008-03-17 04:07:51 +00:00
Nick Mathewson
11e464c331 r18753@catbus: nickm | 2008-03-11 14:56:39 -0400
Make some assert()s into tor_assert()s.  Make some tor_assert()s called from logging into assert()s, and document why.


svn:r13977
2008-03-11 18:56:41 +00:00
Nick Mathewson
eefe2a3562 r18462@catbus: nickm | 2008-02-27 14:15:57 -0500
Add better warnings for the error that produced bug 614, and downgrade from a tor_assert() to a tor_fragile_assert().


svn:r13752
2008-02-27 19:19:34 +00:00
Nick Mathewson
3452486ac6 r14422@tombo: nickm | 2008-02-24 17:09:56 -0500
Whitespace fixes


svn:r13700
2008-02-24 22:11:18 +00:00
Nick Mathewson
dde81de3dd r14419@tombo: nickm | 2008-02-24 16:55:11 -0500
Patch from tup: use sizeof sockaddr_un as the size of a unix sockaddr.  Fixes unix controlsocket binding on openbsd.


svn:r13697
2008-02-24 22:11:00 +00:00
Nick Mathewson
e0de72dd87 r14410@tombo: nickm | 2008-02-23 16:51:46 -0500
Fix the last of the -Wshorten-64-to-32 warnings.


svn:r13696
2008-02-24 22:10:08 +00:00
Nick Mathewson
e7db789e82 r14399@tombo: nickm | 2008-02-22 14:09:38 -0500
More 64-to-32 fixes. Partial backport candidate. still not done.


svn:r13680
2008-02-22 19:09:45 +00:00
Nick Mathewson
e68760ac0f r14388@tombo: nickm | 2008-02-21 22:44:28 -0500
More 64-to-32 fixes.


svn:r13672
2008-02-22 03:44:36 +00:00
Nick Mathewson
0ba2bfeef6 r14363@31-33-219: nickm | 2008-02-21 11:11:33 -0500
Answer the next-to-last XXX020rc item.


svn:r13658
2008-02-21 16:12:01 +00:00
Nick Mathewson
e2f25558b9 r14362@31-33-219: nickm | 2008-02-21 11:01:10 -0500
Change some of our log messages related to closed TLS connections in order to better reflect reality.


svn:r13657
2008-02-21 16:11:58 +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
b28a342e35 resolve one more, and leave two for nick.
svn:r13644
2008-02-21 05:53:50 +00:00
Nick Mathewson
063ced8903 r18296@catbus: nickm | 2008-02-20 23:30:11 -0500
Answer one xxx020 item; move 7 other ones to a new "XXX020rc" category: they should get fixed before we cut a release candidate. arma: please review these to see whether you have fixes/answers for any. Please check out the other 14 XXX020s to see if any look critical for the release candidate.


svn:r13640
2008-02-21 04:30:14 +00:00
Roger Dingledine
1c8bd320be pass bucket sizes num_read and num_written around as size_ts
rather than ints


svn:r13610
2008-02-20 02:17:41 +00:00
Roger Dingledine
0977c29196 notice an integer overflow if we ever get source files with more
than 65k lines in them. also pointed out by veracode.


svn:r13606
2008-02-20 00:46:09 +00:00
Nick Mathewson
0399538b90 r18233@catbus: nickm | 2008-02-19 18:46:07 -0500
Count sockets returned from socketpair() too.  This is probably not the socket counting bug.


svn:r13600
2008-02-19 23:46:08 +00:00
Nick Mathewson
9479dd3768 r18226@catbus: nickm | 2008-02-19 18:01:01 -0500
Brown-paper-bag time.  We were failing to count all the sockets from accept().


svn:r13595
2008-02-19 23:01:07 +00:00
Roger Dingledine
4c1e516a09 cleanups and changelog entry for r13540
svn:r13542
2008-02-17 16:52:24 +00:00
Roger Dingledine
bd959adcb7 patch from karsten:
Resolved problems with (re-)fetching hidden service descriptors.
Before, v0 descriptors were not fetched at all (fix on 0.2.0.18-alpha),
re-fetching of v2 descriptors did not stop when a v0 descriptor was
received (fix on 0.2.0.18-alpha), and re-fetching of v2 descriptors did
not work in all cases (fix on 0.2.0.19-alpha).


svn:r13540
2008-02-17 16:47:47 +00:00
Nick Mathewson
ca4eb987c8 r14182@tombo: nickm | 2008-02-15 17:20:51 -0500
Defer, downgrade, or address more XXX020s.  The remaining ones are all ones we should deal with before release.


svn:r13530
2008-02-15 23:39:08 +00:00