Commit Graph

173 Commits

Author SHA1 Message Date
Nick Mathewson
3d60cd1d61 Delete trailing whitespace and expand tabs; remove unused aes decrypt code
svn:r1522
2004-04-07 19:57:40 +00:00
Roger Dingledine
7118c6177d clean up a few more bugs
svn:r1365
2004-03-29 19:57:50 +00:00
Roger Dingledine
0edf0ea7cc make normal exit nodes less likely to crash from the conn-munging bug
but leave dirservers just as likely to crash


svn:r1363
2004-03-29 19:51:39 +00:00
Roger Dingledine
4a5586b8e3 make dns resolves a lot faster
(but only enable this once we've found the bug)


svn:r1358
2004-03-28 21:16:52 +00:00
Roger Dingledine
f241fdfc73 there is yet another dns-pending-conn-clobbering bug
somewhere


svn:r1354
2004-03-28 04:54:36 +00:00
Roger Dingledine
66f878513f deal with hardware word alignment
this was causing the seg faults on sparc processors

i wonder if i got them all.


svn:r1314
2004-03-20 09:30:30 +00:00
Roger Dingledine
1ae45b771e don't close all the fd's when you spawn a thread, only when you fork
svn:r1267
2004-03-12 21:52:15 +00:00
Roger Dingledine
965a73dc71 bugfix: we were caching transient dns failures
svn:r1266
2004-03-12 18:45:42 +00:00
Nick Mathewson
976bacae94 Make all the other read/writes into recv/sends, except when they shouldn't be.
svn:r1260
2004-03-11 06:35:03 +00:00
Roger Dingledine
6c9d78b319 stop asserting that computers always go forward in time
it's simply not true


svn:r1236
2004-03-06 01:43:37 +00:00
Roger Dingledine
01e06148a1 make workers explain their death better when tor dies
and make them say it at log level info rather than err


svn:r1232
2004-03-04 21:26:23 +00:00
Roger Dingledine
8fe504fee6 bugfix: don't pass complex things to the connection_mark_for_close macro
svn:r1231
2004-03-04 20:49:38 +00:00
Nick Mathewson
c03e9206ae Clean up dns->connection_mark_for_close->dns_remove path
svn:r1230
2004-03-04 18:43:44 +00:00
Roger Dingledine
5701cc2359 fix the function comment
svn:r1169
2004-02-28 22:34:47 +00:00
Nick Mathewson
0a673f4491 Split dns_cancel_pending_resolve into dns_cancel_pending_resolve (kill a
resolve in response to a DNS worker dying) and connection_dns_remove (remove
a pending connection from the resolve structure.)


svn:r1168
2004-02-28 22:23:44 +00:00
Roger Dingledine
9a55700747 add a log_warn to notify us of yet another potential dns.c bug
svn:r1167
2004-02-28 22:13:58 +00:00
Nick Mathewson
833d14246d Make dns_cancel_pending_resolve less agressive.
svn:r1166
2004-02-28 22:06:59 +00:00
Nick Mathewson
55174d1cb0 Fix bug on dns_found_answer from mark_to_close stuff.
svn:r1165
2004-02-28 21:52:58 +00:00
Roger Dingledine
fadfd26188 remove assert from dns.c that's no longer true:
typically the resolve will be pending, but it could be failed if it
just failed and we're working through the 'pending' list, or it could
be valid if some other dnsworker raced us to fill in the entry.


svn:r1164
2004-02-28 21:49:10 +00:00
Nick Mathewson
4e89c6661a Push responsibility for connection marking down as far as possible; have only a close path; add some missing end cells; change return conventions a little.
svn:r1149
2004-02-28 04:11:53 +00:00
Nick Mathewson
c5bbb571d2 Refactor mark_for_close, connection_edge_end and friends. Now, everybody
who wants to shut down a connection calls connection_mark_for_close instead
of setting marked_for_close to 1.  This automatically removes the connection
from the DNS cache if needed, sends a RELAY END cell if appropriate, and can
be changed to do whatever else is needed.

Still to do:
  - The same for circuits, maybe.
  - Add some kind of hold_connection_open_until_flushed flag, maybe.
  - Change stuff that closes connections with return -1 to use mark_for_close,
    maybe.


svn:r1145
2004-02-27 22:00:26 +00:00
Nick Mathewson
496e414e52 Basic RAM poisoning and magic-checking to notice connection and circuit
corruption faster; also, check for corruption in dns.c so we can fail fast
for the bug that's nailing Lucky and moria3.


svn:r1123
2004-02-25 07:31:46 +00:00
Roger Dingledine
8da2e00a83 remove dead code
svn:r1121
2004-02-25 06:56:11 +00:00
Roger Dingledine
7985f525ec fix some bugs in assert_connection_ok
svn:r1118
2004-02-24 22:33:30 +00:00
Roger Dingledine
598f8b5661 start hunting the lucky-bug
svn:r1116
2004-02-22 20:50:20 +00:00
Roger Dingledine
5086300815 split the token bucket into 'rate' and 'burst' params
we're not entirely migrated to burst yet, for backward compatibility

note some win32 probable-bugs

clean up routerlist.c


svn:r982
2004-01-10 23:40:38 +00:00
Roger Dingledine
c485725c5a Fix the dns bug: children weren't dying
We were telling a child to die by closing the parent's file descriptor
to him. But newer children were inheriting the open file descriptor from
the parent, and since they weren't closing them, the socket never closed,
so the child never read eof, so he never knew to exit.

As a side effect to this bug, we were probably failing to properly close
connections to remote hosts, ORs, and OPs, after a dns child was born.

I'm surprised Tor worked at all.


svn:r974
2004-01-06 07:53:40 +00:00
Roger Dingledine
4a1e05de51 betcha didn't know strncpy could leave an unterminated string
svn:r949
2003-12-17 09:20:29 +00:00
Nick Mathewson
4885e90490 Make compile warning-free on cygwin
svn:r936
2003-12-15 21:35:52 +00:00
Roger Dingledine
08534a6271 start tracking the 'It appears I've already sent the end' warning
svn:r932
2003-12-14 08:32:14 +00:00
Roger Dingledine
7d58bfbd50 change dns notation from question/answer to address/addr
svn:r929
2003-12-14 07:40:47 +00:00
Roger Dingledine
05c05d6444 more friendly warning when there are too many dns workers
svn:r919
2003-12-14 04:19:12 +00:00
Roger Dingledine
29adf04683 more general cleanup
svn:r915
2003-12-14 00:12:02 +00:00
Roger Dingledine
ac56486bf6 use the tor_malloc_zero wrapper
svn:r837
2003-11-18 08:20:19 +00:00
Roger Dingledine
56cd147eb9 let getconfig survive repeated calls. now we call it again when we hup.
change RecommendedVersions into a config option, so dirservers can hup
  for a new one


svn:r809
2003-11-13 06:49:25 +00:00
Roger Dingledine
aac29076da warn on startup that we don't provide anonymity
make exit dns cache entries last 15 minutes


svn:r807
2003-11-13 04:51:34 +00:00
Nick Mathewson
3dddcf4306 Add lots of logging to dns.c; change behavior of often-failing assertion
svn:r778
2003-11-08 04:02:05 +00:00
Roger Dingledine
c6b442a346 make end relay cells have payloads
move default exit policy into config files


svn:r653
2003-10-22 07:55:44 +00:00
Roger Dingledine
4a66865d0b send the end cell when we realize we're going to end,
not when we're closing the stream.

this lets us put a payload in the end cell if we want to,
to describe why we're closing the stream.

there are still some places where we don't send the end cell
immediately. i need to track them down. but it's a low priority,
since i've made it send the end cell when we close the stream if
we haven't already sent it.


svn:r640
2003-10-21 08:37:07 +00:00
Roger Dingledine
9d3f2b232b another minor memory leak
make dnsconn->address reflect what it's currently resolving


svn:r624
2003-10-18 07:09:09 +00:00
Nick Mathewson
959b5585a5 Stop using stdout for non-debugging cases
svn:r592
2003-10-15 18:28:32 +00:00
Roger Dingledine
b9628f266f change WARNING to WARN
and fix a few typos


svn:r571
2003-10-10 01:48:32 +00:00
Roger Dingledine
be874358a4 wrap strdup; prefer time() to gettimeofday()
svn:r538
2003-10-04 03:29:09 +00:00
Roger Dingledine
f563bbd2f9 refactor so connection_write_to_buf() never fails
svn:r537
2003-10-04 02:38:18 +00:00
Roger Dingledine
cb8212bfcb clean up receiver buckets; prepare for payloads in relay_end; note a few bugs
svn:r502
2003-09-27 21:09:56 +00:00
Roger Dingledine
deac704399 connection_new() can't ever fail
svn:r497
2003-09-27 07:28:44 +00:00
Roger Dingledine
9e5cafc395 first pass: obey log convention
ERR is if something fatal just happened

WARNING is something bad happened, but we're still running. The bad thing
is either a bug in the code, an attack or buggy protocol/implementation
of the remote peer, etc. The operator should examine the bad thing and
try to correct it.
(No error or warning messages should be expected. I expect most people
to run on -l warning eventually.)

NOTICE is never ever used.

INFO means something happened (maybe bad, maybe ok), but there's nothing
you need to (or can) do about it.

DEBUG is for everything louder than INFO.


svn:r486
2003-09-26 10:03:50 +00:00
Nick Mathewson
3d4ccb781a Refactor buffers; implement descriptors.
'buf_t' is now an opaque type defined in buffers.c .

Router descriptors now include all keys; routers generate keys as
needed on startup (in a newly defined "data directory"), and generate
their own descriptors.  Descriptors are now self-signed.

Implementation is not complete: descriptors are never published; and
upon receiving a descriptor, the directory doesn't do anything with
it.

At least "routers.or" and orkeygen are now obsolete, BTW.


svn:r483
2003-09-25 05:17:11 +00:00
Roger Dingledine
9c6343fdf8 refactor connects into connection_connect()
svn:r460
2003-09-16 01:58:46 +00:00
Roger Dingledine
e585dad887 fix the cpuworker circ-had-vanished bug (maybe)
still several (many) tls-related bugs outstanding.


svn:r454
2003-09-14 02:58:50 +00:00
Roger Dingledine
4c7e936a3a note an assert bug that's still around
svn:r417
2003-08-25 22:02:42 +00:00
Roger Dingledine
2dda97e8fd implemented cpuworkers
please poke at it and report bugs

still needs polishing, and only handles onions now (should handle
OR handshakes too)


svn:r402
2003-08-20 23:05:22 +00:00
Roger Dingledine
88edae9407 start refactoring dnsworker so testing won't be so darn hard
add NumCpus config variable in preparation for cpuworkers
hardcode /etc/torrc path for config (simplifies win32 port)
improve exit policy debugging during router entry parsing


svn:r397
2003-08-14 03:52:51 +00:00
Roger Dingledine
e1f2693d05 bugfix: if a dnsworker dies, remember that.
svn:r396
2003-08-13 22:38:46 +00:00
Nick Mathewson
2cb4f7a473 Adopt socketpair implementation from perl. For now, always use it.
svn:r389
2003-08-12 07:43:15 +00:00
Roger Dingledine
5d9cfb7164 use the spawn_func / spawn_exit abstraction for dnsworkers
svn:r388
2003-08-12 07:35:17 +00:00
Nick Mathewson
c336c99e60 Start of port to win32. Missing are:
- signal support
  - forking for DNS farm
  - changes for async IO
  - daemonizing

In other words, some files still don't build, and the ones that do build,
do nonblocking IO incorrectly.

I'm also not checking in the project files till I have a good place
for them.


svn:r380
2003-08-12 03:08:41 +00:00
Roger Dingledine
f8203505e1 if stream ends before resolve finishes, inform resolver
svn:r359
2003-06-27 00:57:04 +00:00
Roger Dingledine
5d13db862e entries in the dns cache now expire
(expiry time set to 100 seconds so we can play with it)
exit connections are now informed when pending resolves fail
we kill off the oldest busy worker when we're under attack and need to
  resolve something new


svn:r356
2003-06-25 07:19:30 +00:00
Roger Dingledine
dbf3435cde simplify fetch_from_buf; cull idle dnsworkers.
svn:r354
2003-06-25 00:31:41 +00:00
Roger Dingledine
e061b70dbf a pointer to async-dns alternatives.
apparently glibc 2.2.4 and windows both have async gethostbynames now.
we'll want to make use of them if they're available (via autoconf).


svn:r347
2003-06-24 05:17:09 +00:00
Roger Dingledine
05a8c264ff overhaul the dns farm: cut its size in half
i've eliminated the master dns process, so now the workers just
act like regular connections and are handled by the normal pollarray.

everything seems to still work. ;)


svn:r327
2003-06-17 14:31:05 +00:00
Roger Dingledine
d3292e484a implement truncate and truncated (untested)
clean up circuit_deliver_relay_cell convention


svn:r312
2003-06-12 10:16:33 +00:00
Roger Dingledine
39e9d79038 add circuit-level sendme relay cells
remove sendme cells
replace malloc with tor_malloc
patch (but not track down) bug in onion pending list
streamline connection_ap handshake


svn:r293
2003-05-20 06:41:23 +00:00
Nick Mathewson
c217b1ca71 Add magic to end of C files to make emacs happy; split test invocation into separate file.
svn:r224
2003-04-07 02:12:02 +00:00
Roger Dingledine
afa95ca47c make servers tolerate the dns bug.
svn:r223
2003-04-05 19:53:45 +00:00
Roger Dingledine
1768f29d7e better comments and a few patches
svn:r164
2003-03-04 04:36:37 +00:00
Roger Dingledine
1714ea2ab8 Bugfixes and enhancements in sendmes and dns farm
svn:r161
2003-02-18 01:35:55 +00:00
Roger Dingledine
8c136b3a06 bugfix: actually remember the answer in the cache :)
svn:r159
2003-02-16 02:05:24 +00:00
Roger Dingledine
3cf02a88f4 rudimentary dns caching (of both resolves and resolve failures)
serious performance increase over non-caching


svn:r158
2003-02-14 07:53:55 +00:00
Roger Dingledine
0bc8dc1314 fix endian issues for topics -- they might work on bsd now
(they wouldn't have before)

alternate code which bypasses the dns farm, so we can compare speed


svn:r154
2003-02-06 23:48:35 +00:00
Roger Dingledine
ceafe12ed6 make reusing circuits work (and be the default)
performance is better, but not by much. not sure why yet.


svn:r153
2003-02-06 08:00:49 +00:00
Roger Dingledine
c35373a2cf major overhaul: dns slave subsystem, topics
on startup, it forks off a master dns handler, which forks off dns
slaves (like the apache model). slaves as spawned as load increases,
and then reused. excess slaves are not ever killed, currently.

implemented topics. each topic has a receive window in each direction
at each edge of the circuit, and sends sendme's at the data level, as
per before. each circuit also has receive windows in each direction at
each hop; an edge sends a circuit-level sendme as soon as enough data
cells have arrived (regardless of whether the data cells were flushed
to the exit conns). removed the 'connected' cell type, since it's now
a topic command within data cells.

at the edge of the circuit, there can be multiple connections associated
with a single circuit. you find them via the linked list conn->next_topic.

currently each new ap connection starts its own circuit, so we ought
to see comparable performance to what we had before. but that's only
because i haven't written the code to reattach to old circuits. please
try to break it as-is, and then i'll make it reuse the same circuit and
we'll try to break that.


svn:r152
2003-01-26 09:02:24 +00:00