Commit Graph

721 Commits

Author SHA1 Message Date
Nick Mathewson aba7bb705a Set SO_REUSEADDR on all sockets, not just listeners
See bug 2850 for rationale: it appears that on some busy exits, the OS
decides that every single port is now unusable because they have been
all used too recently.
2011-05-03 22:22:20 -04:00
Sebastian Hahn 8d81831d71 Add a missing cast to silence the compiler 2011-03-28 19:25:38 +02:00
Nick Mathewson dddd333a80 Fix some 'impossible' overflow bugs in byte counting
The first was genuinely impossible, I think: it could only happen
when the amount we read differed from the amount we wanted to read
by more than INT_MAX.

The second is just very unlikely: it would give incorrect results to
the controller if you somehow wrote or read more than 4GB on one
edge conn in one second.  That one is a bugfix on 0.1.2.8-beta.
2011-03-25 18:32:28 -04:00
Nick Mathewson 05887f10ff Triage the XXX022 and XXX021 comments remaining in the code
Remove some, postpone others, leave some alone.  Now the only
remaining XXX022s are ones that seem important to fix or investigate.
2011-03-25 18:32:27 -04:00
Nick Mathewson c5ffd44ccd Merge branch 'bug2756_relay' into maint-0.2.2 2011-03-15 17:13:07 -04:00
Nick Mathewson 06f026de66 Check newconn, not conn, before marking newconn for close
This fixes bug 2757.  It's a bugfix on 85da676108.
2011-03-14 18:52:15 -04:00
Nick Mathewson 1d36a8e9ae Consider sending stream-level SENDME cells on partial flushes.
Right now, we only consider sending stream-level SENDME cells when we
have completely flushed a connection_edge's outbuf, or when it sends
us a DATA cell.  Neither of these is ideal for throughput.

This patch changes the behavior so we now call
connection_edge_consider_sending_sendme when we flush _some_ data from
an edge outbuf.

Fix for bug 2756; bugfix on svn r152.
2011-03-14 17:48:45 -04:00
Nick Mathewson 411ec3c0f8 Add client code to detect attempts to connect to 127.0.0.1 etc
We detect and reject said attempts if there is no chosen exit node or
circuit: connecting to a private addr via a randomly chosen exit node
will usually fail (if all exits reject private addresses), is always
ill-defined (you're not asking for any particular host or service),
and usually an error (you've configured all requests to go over Tor
when you really wanted to configure all _remote_ requests to go over
Tor).

This can also help detect forwarding loop requests.

Found as part of bug2279.
2011-01-25 20:39:44 -05:00
Nick Mathewson 85da676108 Fix double-mark bug when failing to init transparent connection
Fixes part of bug 2279.  Bugfix on 0.1.2.1-alpha.
2011-01-25 19:07:03 -05:00
Nick Mathewson f1de329e78 Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
Conflicts:
	src/common/test.h
	src/or/test.c
2011-01-03 11:51:17 -05:00
Nick Mathewson 1a07348a50 Bump copyright statements to 2011 2011-01-03 11:50:39 -05:00
Sebastian Hahn 556a1b9e45 Change Natd into NATD in our options.
Breaking this out of the last commit because this might be more
controversial.
2010-11-10 15:48:26 +01:00
Sebastian Hahn b9cac605ab Synx manpage and source wrt option capitalization
We had a spelling discrepancy between the manpage and the source code
for some option. Resolve these in favor of the manpage, because it
makes more sense (for example, HTTP should be capitalized).
2010-11-10 15:48:26 +01: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 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
Nick Mathewson a856f446c7 Merge commit 'sebastian/bug1831' 2010-08-15 23:43:36 -04:00
Sebastian Hahn 561ca9b987 Fix misplaced labels 2010-08-16 00:46:44 +02:00
Karsten Loesing acd25558b8 Refactor exit port statistics code and add unit tests. 2010-08-11 16:19:54 +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 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 0f1548ab18 Create main.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 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 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 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 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 625963d92a commit my annotations while i was hunting down the host order bug 2010-03-05 16:04:01 -05: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
Sebastian Hahn b2b99a70c0 Don't spam controllers with TOO_MANY_CONNECTIONS events
We implemented ratelimiting for warnings going into the logfile, but didn't
rate-limit controller events. Now both log warnings and controller events
are rate-limited.
2010-02-08 16:45:36 +01:00
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