Commit Graph

678 Commits

Author SHA1 Message Date
Nick Mathewson
d4972bd2e1 Remove code that has been #if-0ed for a long time.
svn:r4435
2005-06-15 18:34:46 +00:00
Nick Mathewson
232861ba42 Docment or add DOCDOC comments to undocumented functions in src/or. Make function definition format uniform.
svn:r4411
2005-06-11 18:52:12 +00:00
Roger Dingledine
2587fa09f9 move more docs into our code
svn:r4406
2005-06-11 06:07:22 +00:00
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00
Roger Dingledine
cfc89f8753 pay more attention to the ClientOnly config option
svn:r4367
2005-06-09 08:54:42 +00:00
Roger Dingledine
aff308e6d9 reenable the part of the code that tries to flush as soon as an OR outbuf
has a full tls record available. perhaps this will make OR outbufs not grow
as huge except in rare cases, thus saving lots of cpu time plus memory.


svn:r4343
2005-06-08 04:55:06 +00:00
Roger Dingledine
040a748d87 i screwed up the dirport reachability testing when we don't yet
have a cached version of the directory. hopefully now fixed.


svn:r4284
2005-05-23 05:20:52 +00:00
Roger Dingledine
b86716b839 If a socks connection ends because read fails, don't warn that you're
not sending a socks reply back. (bug reported by Warren Barrow)


svn:r4277
2005-05-21 00:15:23 +00:00
Roger Dingledine
f0e309e5bd add HttpProxyAuthenticator config option too
svn:r4272
2005-05-20 08:51:45 +00:00
Roger Dingledine
b7d6b8a397 doxygeny goodness from tyranix
svn:r4262
2005-05-17 17:01:36 +00:00
Nick Mathewson
10b2208d93 Make Tor compile with no warnings with gcc4.0 on OSX
svn:r4184
2005-05-07 05:55:06 +00:00
Roger Dingledine
5265bbd2b8 first iteration of scrubbing sensitive strings from logs.
also generally clean up log messages.


svn:r4174
2005-05-03 10:04:08 +00:00
Nick Mathewson
a312ce1d3b Change buffer shrinking strategy: only try to shrink once every 3 minutes. Do not try to read over buffer size unless buffer is nearly empty.
svn:r4165
2005-05-02 23:17:08 +00:00
Nick Mathewson
fe65e57ca1 Re-do fragmented control message handling to work with new buf_t system.
svn:r4144
2005-04-27 22:01:34 +00:00
Nick Mathewson
9ba2dd7ea1 Clean/renormalize whitespace
svn:r4122
2005-04-26 20:55:32 +00:00
Roger Dingledine
509405a5f7 clean up this TOR_FRAGILE business
svn:r4116
2005-04-26 18:52:16 +00:00
Nick Mathewson
74dc7eedc5 Add kludgy function to force controllers to flush EVENT_ERR_MSG events.
svn:r4057
2005-04-08 03:36:39 +00:00
Nick Mathewson
31c12e265f Move a quote, fix a log.
svn:r4056
2005-04-08 03:26:44 +00:00
Roger Dingledine
dabafddb82 fix format bug
svn:r4051
2005-04-07 22:03:56 +00:00
Nick Mathewson
8cc3307e0d Improve conn_*_to_string; add circuit_state_to_string; make skewed-descriptor messages better.
svn:r4047
2005-04-07 21:07:19 +00:00
Nick Mathewson
b897cb1ec3 Change conn_(type|state)_to_string from const arrays to switch functions so we (I) will not make Tor crash the next time we (I) add a new state.
svn:r4045
2005-04-07 20:25:22 +00:00
Roger Dingledine
620419b421 oh, and accept() into the right place, too.
svn:r4029
2005-04-06 16:16:31 +00:00
Roger Dingledine
70f3b3ef86 Forward-port the checking of
sin_addr.s_addr == 0 || sin->sin_port == 0.
This just happened on moria2, so I guess it happens rarely
on Linux as well as OS X.
We can't afford to accept OR conns from 0.0.0.0:0, since we
send created cells back to the first addr:port that matches,
and we'd better not send them to the wrong place.
So, let's drop them all for now, and see if we can find a pattern
later.


svn:r4028
2005-04-06 15:42:35 +00:00
Roger Dingledine
9cbaf4603d fix an assert trigger: when we have the rare case of accepting
a conn on 0.0.0.0:0, then when we look through the connection array,
we'll find any of the workers. this is no good.


svn:r4027
2005-04-06 15:19:32 +00:00
Nick Mathewson
88dc243bb5 Rename circuit_get_by_stream to circuit_get_by_edge_conn, and actually start using it. Watch out, kids!
svn:r4026
2005-04-06 06:43:21 +00:00
Roger Dingledine
5f0a84cbe2 update conn-type-state-strings to handle https states for ORs
svn:r4018
2005-04-06 04:55:17 +00:00
Nick Mathewson
ac268a8340 Fix Tor for no-threading compilation: move connection_unregister from _connection_free to connection_free.
svn:r4013
2005-04-06 00:46:57 +00:00
Nick Mathewson
0dc02328af Move most of *_mark_for_close out of macros.
svn:r3992
2005-04-03 05:22:33 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Roger Dingledine
c2a05e1ca9 redo the state descriptors now that we have a controller-wait state
svn:r3934
2005-03-31 17:36:24 +00:00
Roger Dingledine
36baf7219d stop most cases of hanging up on a socks connection without sending
the socks reject. audit for remaining ones. also make things more
uniform so we always remember to hold-open-until-flushed, etc.


svn:r3891
2005-03-27 04:55:13 +00:00
Roger Dingledine
1328383482 make it clearer to the human that his server is testing
its reachability. tell him when it succeeds, or when 20
minutes pass and it hasn't succeeded yet.


svn:r3882
2005-03-26 01:43:39 +00:00
Roger Dingledine
9b9dbad0b7 fix another case where we need to send a socks reply (reject)
back before we close the conn.


svn:r3876
2005-03-25 11:12:14 +00:00
Roger Dingledine
9685164fe5 don't mark a router down just because your httpsproxy is unreachable
svn:r3874
2005-03-25 10:55:06 +00:00
Nick Mathewson
d26bcfab92 Note where connection that hasnt sent end was marked.
svn:r3872
2005-03-25 05:54:50 +00:00
Roger Dingledine
bd37c9a3bd REUSEADDR on normal places means you can rebind to the port
right after somebody else has let it go. But REUSEADDR on win32
means to let you bind to the port _even when somebody else
already has it bound_. So, don't do that on Win32.


svn:r3867
2005-03-24 23:20:06 +00:00
Roger Dingledine
0dc91fd9c0 fix an assert -- we're not allowed to write onto a conn after we've
connection_unregistered it. there's still more work to be done here,
since we need to make sure to send back the socks-reply as soon as we
know what it will be -- we can't just wait until connection-about-to-close
to deal with it.


svn:r3847
2005-03-23 23:19:18 +00:00
Roger Dingledine
fb8a319ffe fix an over-eager assert, to make httpsproxy get a little farther
svn:r3846
2005-03-23 22:11:59 +00:00
Roger Dingledine
a799dad937 forward-port the commenting out of the assert that glenn fink was
triggering. we still don't know why he was triggering it.


svn:r3841
2005-03-23 20:42:37 +00:00
Roger Dingledine
7373042a7b fix assert triggers (bugs 109 and 96), and put in some
debugging logs to notice future repeat bugs.


svn:r3826
2005-03-23 02:52:55 +00:00
Roger Dingledine
e28b8aaa40 make httpsproxy more likely to work
(don't let OR conns do tls until they've finished connecting and
doing the proxy dance.)


svn:r3824
2005-03-22 23:57:18 +00:00
Nick Mathewson
df9c8feac7 Commit fixes for several pending tor core tasks: document all DOCDOCed functions; time out uncontrolled unattached streams; feed reasons to SOCKS5 (refactoring connection_ap_handshake_socks_reply in the process); change DirFetchPeriod/StatusFetchPeriod to have a special "Be smart" value.
svn:r3769
2005-03-17 12:38:37 +00:00
Nick Mathewson
97dad670ea Renormalize whitespace
svn:r3757
2005-03-14 03:18:35 +00:00
Nick Mathewson
115271f65e Implement the common case of ATTACHSTREAM.
svn:r3751
2005-03-12 04:22:01 +00:00
Nick Mathewson
afe414f070 Revise all calls to connection_edge_end to avoid sending MISC, and to take errno into account where possible.
svn:r3720
2005-03-01 22:42:31 +00:00
Nick Mathewson
4ddf768a4f Forward-port new reasons; clean up code more; add code to convert new reasons to SOCKS5 reply codes; add code to convert errnos to reasons. New code still needs to get invoked.
svn:r3719
2005-03-01 22:16:15 +00:00
Nick Mathewson
b7b05dc1b2 make control interface stream IDs monotonically increasing to prevent possible races
svn:r3715
2005-03-01 01:15:01 +00:00
Nick Mathewson
97bc49bd72 Try a little harder to avoid openssl SSL* double-free reports.
svn:r3710
2005-02-28 02:52:51 +00:00
Nick Mathewson
26e6eb7539 Check returns from libevent calls better; stop poking at internals of events to see if they are live.
svn:r3691
2005-02-25 05:42:01 +00:00
Nick Mathewson
24d7ae6fe8 Insert missing ! in assert_connection_ok; test was accidentally reversed in revision 1.329 yesterday. Should fix bug 102
svn:r3685
2005-02-24 17:08:27 +00:00
Nick Mathewson
22c38b0f9b Clarify comment. Use CONN_IS_EDGE more. Try to be more zealous about calling connection_edge_end when things go bad with edge conns in connection.c
svn:r3671
2005-02-23 20:35:26 +00:00
Nick Mathewson
6e6d95b3db Change from inet_ntoa to a threadproof tor_inet_ntoa.
svn:r3656
2005-02-22 08:18:36 +00:00
Nick Mathewson
c2d5b67dd2 After we successfully connect, try handling pending stuff immediately, rather than waiting for the next call to connection_handle_write. Roger: is this right?
svn:r3647
2005-02-22 03:02:33 +00:00
Roger Dingledine
cbb4803ec8 forward-port some fixes
svn:r3631
2005-02-17 01:12:50 +00:00
Roger Dingledine
37ca621301 when a client asks us for a dir mirror and we don't have one,
launch an attempt to get a fresh one.


svn:r3609
2005-02-10 06:31:34 +00:00
Roger Dingledine
07a3307460 remove redundant lines
svn:r3607
2005-02-09 23:54:30 +00:00
Nick Mathewson
89d422914a Patch from adam langley: always remove sockets from libevent before closing them. Should fix epoll-related bugs.
svn:r3606
2005-02-09 23:16:31 +00:00
Roger Dingledine
efa9bb5535 fix the latest bug: don't explode when some router declares a
bandwidthburst of 500 gigabytes.

this bug seems to have taken down most of the network. oops.


svn:r3523
2005-02-03 22:58:22 +00:00
Roger Dingledine
2e97593d25 define TOR_FRAGILE if you want tor to give you a core when
something goes wrong. this should only be used by people actively
tracking bugs.


svn:r3487
2005-02-01 00:37:16 +00:00
Roger Dingledine
a0312f3590 don't double-detach a closing exit conn that's waiting for dns resolve
svn:r3477
2005-01-31 01:27:49 +00:00
Roger Dingledine
692a57c8e8 but don't spring the trip on worker children, because it turns
out they don't actually remove anything before freeing the conns.


svn:r3476
2005-01-31 01:02:20 +00:00
Roger Dingledine
d6489d8e41 lay a trap for situations where we connection_free something
that's still on one of the lists.

in particular, this will detect situations where we mark-for-close
and then free it ourselves.


svn:r3475
2005-01-31 00:33:32 +00:00
Roger Dingledine
38be533c69 Handle unavailable hidden services better. We try each intro point
until none are left, then we try to refetch the descriptor. If it's
the same one we had before, then close streams right then. Whenever
a new stream arrives, even if it's right after, optimistically try
refetching the descriptor, just in case.


svn:r3379
2005-01-19 23:15:59 +00:00
Roger Dingledine
bafb3e4a5b fix another integer underflow caused by buckets going negative
svn:r3346
2005-01-12 12:19:00 +00:00
Roger Dingledine
3809c0ab91 tolerate bandwidtch buckets going negative (i hope)
svn:r3344
2005-01-12 10:00:38 +00:00
Nick Mathewson
324b192f68 Make Tor use Niels Provos's libevent instead of it's current
poll-but-sometimes-select mess.  This will let us use faster async cores
(like epoll, kpoll, and /dev/poll), and hopefully work better on Windows
too.

There are some fairly nasty changes to main.c here; this will almost
certainly break something.  But hey, that's what alphas are for.


svn:r3341
2005-01-12 06:42:32 +00:00
Nick Mathewson
65c4fa2614 Split mark-dir-failed-and-retry logic into separate function; make it retry runningrouters as well as directory fetches; note that the do-we-need-to-give-up test is wrong.
svn:r3256
2005-01-03 20:07:07 +00:00
Nick Mathewson
5f40d6bf72 Make directory fail-and-retry logic happen in connection_about_to_close(); fixes win32 bug.
svn:r3253
2005-01-03 19:51:10 +00:00
Roger Dingledine
036384fd8e respond to an 009 XXX
svn:r3201
2004-12-22 02:55:26 +00:00
Roger Dingledine
011ad3cba5 clean up logging,
make it clearer which warns are bugs,
make the control log event match its specification,
point out a bug in how we deal with failure when renewing the tls context.


svn:r3138
2004-12-13 00:44:39 +00:00
Roger Dingledine
012255fe60 fix the other half of the pipe race
svn:r3111
2004-12-07 16:37:32 +00:00
Roger Dingledine
2532e9405e Now we allow writing to the buffer even when the stream if marked for
close, if we're planning to wait to flush it.

This is important because we were sending a socks reject back if we're
closing and hadn't already sent one, but it wasn't actually getting
written since the conn was already marked-for-close.


svn:r3074
2004-12-04 07:13:37 +00:00
Roger Dingledine
ef04cfcbad one more typo
svn:r3054
2004-12-01 04:13:15 +00:00
Nick Mathewson
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +00:00
Nick Mathewson
6e88abf418 If we are using select, make sure we stay within FD_SETSIZE.
svn:r3051
2004-12-01 03:15:59 +00:00
Nick Mathewson
7fbd297532 Suggestion from weasel: Make tor --version --version dump the cvs Id of every file.
svn:r3019
2004-11-29 22:25:31 +00:00
Roger Dingledine
c1dc17e6e2 put in initial support for ".nickname.exit" addresses, to let alice
decide what exit node to use; based on a patch by geoff goodell.

needs more work: e.g. it goes bananas building new circuits when the
chosen exit node's exit policy rejects the connection.


svn:r3015
2004-11-29 08:34:54 +00:00
Roger Dingledine
22727b4edc wrong is ok, and right is fine, but in between is apparently
totally unacceptable to me.


svn:r3005
2004-11-28 11:39:53 +00:00
Nick Mathewson
6f5dbefa7e Normalize space: add one between every control keyword and control clause.
svn:r3003
2004-11-28 09:05:49 +00:00
Nick Mathewson
f77ff938b7 remember; tor_socket_errno has side effects!
svn:r2997
2004-11-28 05:48:02 +00:00
Roger Dingledine
7c9a707900 remove emacs droppings, since nick says he doesn't need them anymore
svn:r2989
2004-11-26 04:00:55 +00:00
Roger Dingledine
914d346095 update conn_state_to_string
svn:r2979
2004-11-24 07:58:15 +00:00
Roger Dingledine
83e7043eb8 don't process marked-for-close conns further.
(fix assert trigger -- if we're lucky.)


svn:r2975
2004-11-24 06:41:58 +00:00
Nick Mathewson
fe32c2d141 Fix sign-related warnings
svn:r2942
2004-11-22 22:50:17 +00:00
Nick Mathewson
d4754b334c Compile cleanly on windows; prevent some insane bandwidth cases (e.g., "BandwidthBurst 1000 TB" from occuring.
svn:r2941
2004-11-22 22:24:10 +00:00
Roger Dingledine
310a8da0d2 break reached_eof() out of process_inbuf()
svn:r2930
2004-11-21 10:14:57 +00:00
Roger Dingledine
6a516dfdd3 be more greedy about filling up all relay cells.
this may have some bugs in it still.
and it may end up not being what we want to do.


svn:r2928
2004-11-21 07:43:12 +00:00
Roger Dingledine
dd19cf6ba3 kill -USR2 now moves all logs to loglevel debug
plus fix some typos


svn:r2914
2004-11-20 07:33:55 +00:00
Nick Mathewson
8acaf8e187 Add "MEMUNIT" and "INTERVAL" types to configuration. Also tweak Accounting setup. More docs needed
svn:r2911
2004-11-20 00:37:00 +00:00
Roger Dingledine
67aa3b66c5 clean up socks handling, refuse connections to port 0
svn:r2888
2004-11-15 07:50:15 +00:00
Nick Mathewson
08627d5d87 Track whether descriptor is dirty/uploaded. When any options are set, mark it dirty. Once a minute, regenerate and upload the server descriptor if it is dirty.
svn:r2832
2004-11-13 16:53:48 +00:00
Nick Mathewson
60880cda84 Resolve a bunch of FIXME items; mark a lot more for attention; ask for clarification on some. Turn all XXXX008 ("showstopper for 0.0.8 release") items into XXXX009 or XXXX, since plainly they were not showstoppers for 0.0.8. Add/clean some docs.
svn:r2808
2004-11-12 16:39:03 +00:00
Nick Mathewson
2a5bcb29e6 Resolve FIXME: Possible solution to note_disconnect problem; needs thought and review.
svn:r2807
2004-11-12 05:52:19 +00:00
Nick Mathewson
0faab62cd9 Resolve FIXMES: sometimes an error code is just an error code
svn:r2805
2004-11-12 05:03:50 +00:00
Nick Mathewson
5a5be93f80 Normalize whitespace; add a "tell me about all the unnormalized whitespace" target; fix a braino in dirserv.c
svn:r2758
2004-11-09 20:04:00 +00:00
Roger Dingledine
394554cfbf Clean up copyrights.
Break connection_consider_empty_buckets() out of
connection_read_bucket_decrement().


svn:r2698
2004-11-07 01:33:06 +00:00
Roger Dingledine
6c61ed4fb5 Make options no longer a global variable.
Now we can try setting an option but back out if it fails to parse, or
  if it's disallowed (e.g. changing RunAsDaemon from 1 to 0).
Use parse_line_from_str rather than parse_line_from_file.


svn:r2692
2004-11-06 05:18:11 +00:00
Roger Dingledine
59453ac6ef add a ControlPort and control listener conn.
note that print_usage is obsolete.


svn:r2671
2004-11-04 06:41:49 +00:00
Roger Dingledine
d0c158c8d6 clarify the bandwidthburst and bandwidthrate are in bytes
(niels had thought they were in bits, or kb, or something)


svn:r2669
2004-11-04 03:25:43 +00:00
Roger Dingledine
a4753283dd better interface for connection_ap_handshake_socks_reply()
make --list-fingerprint print the fingerprint again


svn:r2668
2004-11-03 23:13:28 +00:00
Nick Mathewson
451f8b5045 - Implement all of control interface except authentication, setconfig,
and actually making the sockets.
- Make sure that identity-based nicknames start with $.
- Use new string_join interface.


svn:r2661
2004-11-03 18:33:07 +00:00
Nick Mathewson
4fdaa5de51 Streamline the two redundant "Has the second rolled over?" checks in prepare_for_poll and connection_bucket_refill; also, generate BANDWIDTH control events
svn:r2657
2004-11-03 16:38:04 +00:00
Roger Dingledine
12e92eb82f connection_read_bucket_decrement() has a side-effect that
we need to get even if we just read 0 bytes


svn:r2656
2004-11-03 10:18:31 +00:00
Nick Mathewson
347d3f9d62 Start implementing control interface.
svn:r2652
2004-11-03 01:32:26 +00:00
Nick Mathewson
8db0abb687 First attempt at hibernation code. It needs more work around the XXXXs, but first I want arma to review the basic approach while I meditate on how to fix them.
svn:r2649
2004-11-02 23:47:32 +00:00
Nick Mathewson
ad4dc74482 Use a stricter set of warnings; make them all pass.
svn:r2645
2004-11-02 03:02:17 +00:00
Roger Dingledine
984ffec105 implement first piece of hibernation
still need to track bandwidth, and make decisions based on bandwidth


svn:r2630
2004-10-31 20:28:41 +00:00
Nick Mathewson
2fbf31533b Tricksy compiler warnings! We hates them, hates them forever, my precious!
svn:r2615
2004-10-27 21:14:11 +00:00
Roger Dingledine
0113a643a2 quick-and-dirty dir policy since the dirservers are getting hammered
nick, could you abstract this sometime so we don't repeat the
sockspolicy code twice?


svn:r2589
2004-10-25 06:16:26 +00:00
Nick Mathewson
ef4ac65f5e Document the swiss-army-knife that retry_listeners has become
svn:r2584
2004-10-24 01:50:33 +00:00
Nick Mathewson
0df2d383d1 Many non-native speakers use Tor. It is our duty to ensure that our log messages set an example of good English spelling.
svn:r2583
2004-10-24 01:29:01 +00:00
Nick Mathewson
57f09573f5 Every 60 seconds, check whether the listeners are still alive, and relaunch the dead ones.
svn:r2581
2004-10-24 01:22:40 +00:00
Nick Mathewson
5d53828c57 Handle more errnos from accept() without closing the connection. This may fix a bug that could close OR listeners when (a) TCP connections were hung up before accept() could be called, or (b) during FD exhaustion.
svn:r2579
2004-10-24 00:55:18 +00:00
Roger Dingledine
de65052312 don't assert multiple things in the same tor_assert()
svn:r2544
2004-10-16 22:14:52 +00:00
Nick Mathewson
25a046df74 Fix unit tests, make it compile
svn:r2543
2004-10-16 21:57:24 +00:00
Nick Mathewson
47dc024f7e Change interface of parse_addr_port() to return address in host order, since most users seem to want that.
svn:r2542
2004-10-16 21:53:30 +00:00
Nick Mathewson
0f144d6a04 fix warning on win32
svn:r2518
2004-10-14 15:41:41 +00:00
Roger Dingledine
cf9664151d bugfix on a really old bug:
if read() fails on a stream, send back an end cell before you
close it down.


svn:r2509
2004-10-14 09:28:31 +00:00
Nick Mathewson
1c9426d6e0 Build without warnings on mac gcc 3.3
svn:r2487
2004-10-14 03:18:14 +00:00
Roger Dingledine
aebc3a03ba more int to size_t conversions, fixing one or more amd64 bugs
plus a whitespace patch on config.c from vicman


svn:r2482
2004-10-14 02:47:09 +00:00
Nick Mathewson
0d5a847f12 Remove need for dirservers file: now, we note trusted dirservers in configuration options, and only need to remember addr:port and key digest for each one.
svn:r2479
2004-10-14 01:44:32 +00:00
Roger Dingledine
2b7b86f5e6 stop trying to print a NULL
plus make router_nickname_is_approved() more obviously unused


svn:r2469
2004-10-13 20:17:45 +00:00
Nick Mathewson
e0cce8fba8 Unify tests for "did I originate this nonopen OR connection?"
svn:r2468
2004-10-13 20:05:57 +00:00
Nick Mathewson
508970f85d fix typo
svn:r2466
2004-10-13 19:55:40 +00:00
Nick Mathewson
149f57bdef answer question about rep_hist_note_connect_failed
svn:r2464
2004-10-13 19:42:36 +00:00
Nick Mathewson
0383afac9a Use parse_addr_port() function instead of ad-hoc variants
svn:r2441
2004-10-12 15:52:09 +00:00
Roger Dingledine
136d4e5739 prefer tor_free to free
plus complain more loudly when we fail to parse a dir we just fetched


svn:r2401
2004-09-29 06:52:36 +00:00
Nick Mathewson
c66e4c4870 Flush more changes from sandbox
- make clients cache directories and use them to seed their router lists
   at startup.  This means clients have a datadir again.
 - Introduce a global_write_bucket.  We need to respond better to exhausting
   it.
 - Remove the last vestiges of LinkPadding and TrafficShaping.
 - Configuration infrastructure support for warning on obsolete options.
 - Refactor directory header parsing to use smartlist_split_string.
 - Respond to content-encoding headers by trying to uncompress as appropriate.
 - Reply with a deflated directory when a client asks for "dir.z".
   (We could use allow-encodings instead, but allow-encodings isn't
   specified in HTTP 1.0.)


svn:r2335
2004-09-08 06:52:33 +00:00
Nick Mathewson
9836ccda8c Move a paren 4 characters to the left; fix a bug in OutboundBindAddress
svn:r2330
2004-09-02 23:25:23 +00:00
Roger Dingledine
2d8a1f208a if they ask for exactly one entrynode, don't pick it as an exitnode.
also, fix part of the zero-identity-router-in-stats bug


svn:r2252
2004-08-17 07:09:02 +00:00
Roger Dingledine
0a6e27208b o Handle servers with dynamic IP addresses: don't replace
options->Address with the resolved one at startup.
  o detect our address right before we make a routerinfo each time.
o external IP vs bind-IP. Already done, just use options->Address.
o OutboundBindAddress config option, to bind to a specific
  IP address for outgoing connect()s.


svn:r2241
2004-08-16 11:43:18 +00:00
Roger Dingledine
699a9d8b46 commit some minor fixes from this sandbox so i can commit the next one
svn:r2229
2004-08-15 05:28:09 +00:00
Roger Dingledine
7506cce649 stop wasting cpu time on authdirservers
we were making a new directory only when the old one was dirty, but
every time we made one, we'd dirty it by testing it right then.


svn:r2199
2004-08-08 11:15:38 +00:00
Roger Dingledine
b2c7b5adfb fix a race condition in 008pre2: don't try to extend onto a connection
that's still handshaking.

for servers in clique mode, require the conn to be open before you'll
choose it for your path.


svn:r2198
2004-08-08 10:32:36 +00:00
Roger Dingledine
276d953b22 fix an assert: check the sockspolicy before we make/add the connection,
else we close a connection without assigning it a state, which is bad
because it fails assert_conn_ok()


svn:r2156
2004-08-06 09:56:36 +00:00
Roger Dingledine
0da256ef97 when we get a sigint, don't accept new connections/circuits,
but delay 30 seconds until exiting.
if we get a second sigint, exit immediately.


svn:r2070
2004-07-20 23:31:00 +00:00
Roger Dingledine
dc7951a5a7 a whole swath of fixes
introduce an authdir_mode() macro to match the others.
don't initialize uptime to the number of seconds since 1970.
non-authoritative dirservers don't cache their directory on disk.
make only authdirservers use clique_mode.
only read approved-routers file if you're an authdirserver.
even authdirservers fetch a new directory in do_hup.
retry_all_connections() is now called retry_all_listeners().
router_parse_list_from_string() correctly reports the router number
  it's working on.
only call dirserv_add_own_fingerprint() and
   dirserv_add_descriptor() on startup if we're an authdirserver.
if AuthDir and !ORPort then fail.
if AuthDir and ClientOnly then fail.


svn:r2061
2004-07-20 10:17:43 +00:00
Roger Dingledine
a5ff0527e6 it turns out we weren't looking at the result from getsockopt().
now we do.
but i'm not sure it matters, since we also poll for reads, and if
there's an error with the connecting socket, poll is supposed to
return readable, so we should notice it then.

who knows.


svn:r2057
2004-07-19 23:26:21 +00:00
Nick Mathewson
54c129d8dc abstract ORPort/SocksPort checks into server_mode(), proxy_mode(), clique_mode(), etc. Dont change underlying comments.
svn:r2054
2004-07-18 21:47:04 +00:00
Nick Mathewson
c2103eb63a Finish most pre2 items: make running-routers list work right; rename secret key files; make even more lookup-by-nickname use lookup-by-id; default nicknames to hostname.
svn:r2043
2004-07-13 18:23:40 +00:00
Roger Dingledine
d37850bb98 only count bytes transmitted to/from non-local IPs
svn:r2041
2004-07-13 16:58:01 +00:00
Roger Dingledine
86e0ede07e checkpoint: start working on bandwidth tracking and
letting clients evaluate whether they're suitable servers


svn:r2037
2004-07-13 07:42:20 +00:00
Roger Dingledine
2325050b1b tor now tolerates down dirservers better
svn:r2031
2004-07-12 20:39:40 +00:00
Roger Dingledine
538655cd80 if connecting to an OR fails immediately, mark it as down
svn:r2029
2004-07-12 18:19:55 +00:00
Roger Dingledine
cbf73b2bc5 touchups all over
put uptime in descriptor


svn:r2011
2004-07-04 22:48:11 +00:00
Nick Mathewson
7d8de8cd10 More digest/nickname fixes
svn:r2000
2004-07-02 23:40:03 +00:00
Nick Mathewson
541add90a1 Track routers by hash of identity key; use hex hash of identity key in place of nickname; accept (and use) hash of identity key in EXTEND cells.
svn:r1994
2004-07-01 01:16:59 +00:00
Nick Mathewson
3708886939 Implement RESOLVE/RESOLVED cells and socks resolve code
svn:r1978
2004-06-17 18:13:09 +00:00
Nick Mathewson
17b5b3685f Make tor build on win32 again; handle locking for server
svn:r1948
2004-06-05 01:50:35 +00:00
Roger Dingledine
69931106f8 be sure to detach streams from the circuit linked list before freeing them
also, don't bother marking a conn for close if you're about to free it


svn:r1935
2004-06-02 18:32:24 +00:00
Roger Dingledine
f51061439b when the dns resolve is cancelled, or fails, be sure to remove
conn from circ->resolving_streams

otherwise it gets freed and stays there, causing seg faults.


svn:r1915
2004-05-21 12:25:15 +00:00
Roger Dingledine
b6faca2268 enable checking the socks policy
svn:r1906
2004-05-20 04:16:43 +00:00
Nick Mathewson
80365b9897 Allow multiple exit policy lines; mostly add support for AP policies
svn:r1905
2004-05-20 02:42:50 +00:00
Roger Dingledine
b37450ce55 do all the heavy lifting in connection_about_to_close_connection,
not in _connection_mark_for_close

this will hopefully clean up the huge cyclical function mess


svn:r1903
2004-05-19 23:32:20 +00:00
Nick Mathewson
d95f347b14 Add Port to *bindAddress.
svn:r1901
2004-05-19 20:25:44 +00:00
Roger Dingledine
630e930799 don't flush the buf from inside connection_write_to_buf
svn:r1859
2004-05-12 22:56:26 +00:00
Roger Dingledine
1cf1836990 break connection_edge_end out of connection_mark_for_close
svn:r1858
2004-05-12 21:12:33 +00:00
Nick Mathewson
537fb82cbb Make some functions static
svn:r1857
2004-05-12 20:58:27 +00:00
Roger Dingledine
32c42a0ee2 break rend_client_desc_fetched out of connection_mark_for_close
svn:r1856
2004-05-12 20:36:44 +00:00
Roger Dingledine
7ee6194f3a break part of circuit.c into relay.c
svn:r1854
2004-05-12 19:49:48 +00:00
Nick Mathewson
f1bc7af9f5 Make "connected" a different case from "finished_flushing"; always close_immediate whhen connect() fails.
svn:r1852
2004-05-12 19:17:09 +00:00
Roger Dingledine
3cdf2d67da it's amazing what a bit of punctuation can do for appearances
svn:r1843
2004-05-10 10:27:54 +00:00
Roger Dingledine
341d6f2cab more cleanup, including fleshing out or.h more
svn:r1839
2004-05-10 07:37:10 +00:00
Nick Mathewson
81922a125c More doxygenation.
svn:r1832
2004-05-10 04:34:48 +00:00
Roger Dingledine
397466a23d give connection.c a skeletal file/brief header
svn:r1831
2004-05-10 03:56:58 +00:00
Roger Dingledine
8f6aa6688f function header comments for connection.c, including doxygen markup
svn:r1825
2004-05-10 01:32:57 +00:00
Roger Dingledine
b384c5a18d bugfix: do directory_send_command only after we've established a socket
also many comments, cleaning, etc


svn:r1823
2004-05-09 16:33:04 +00:00
Roger Dingledine
9bf9ca4d09 bugfix: add a circ->resolving_streams field, and make dns resolving streams not actually in the connection_array until they're done resolving.
bugfix: actually complain if we duplicate mark-for-close a circuit

add more logging for relay ends that claim dns resolve failed, so we can
find out why they're not being retried.


svn:r1798
2004-05-06 11:08:04 +00:00
Nick Mathewson
2ba0776b02 Only connection_add connections once they have conn->s sett; refactor code around this. Should make stuff more bulletproof.
svn:r1788
2004-05-05 01:26:57 +00:00
Nick Mathewson
af08c4f878 Working strerror for windows socket errors, plus some snide comments.
svn:r1775
2004-05-02 20:18:21 +00:00
Roger Dingledine
25909c2c29 patches on patches
svn:r1763
2004-05-02 03:15:55 +00:00
Nick Mathewson
f6fe336ad4 Documenmt buffers.c; remove function that nobody ever calls.
svn:r1760
2004-05-01 22:08:43 +00:00
Nick Mathewson
6fa2ded74c Fix windows compile
svn:r1757
2004-05-01 20:55:31 +00:00
Nick Mathewson
908ccb9dcd Handle windows socket errors correctly; comment most of common.
svn:r1756
2004-05-01 20:46:28 +00:00
Nick Mathewson
9322641710 Use socketclose on windows as appropriate; end pid files with newline
svn:r1745
2004-04-28 21:14:56 +00:00
Roger Dingledine
dd335d9bb2 use tor_lookup_hostname for binding local addresses too
svn:r1744
2004-04-28 20:57:03 +00:00
Roger Dingledine
80d0b634a4 add a debugging entry, to find the wants-to-read-but-can't bug
svn:r1719
2004-04-26 21:15:06 +00:00
Roger Dingledine
fb2279b90b since we don't support truncateds much, don't bother sending them;
just close the circ.

(this wasn't relevant before, because we were mis-handling destroys.)


svn:r1711
2004-04-26 04:32:01 +00:00
Roger Dingledine
10f3b74cb9 tell us the nickname of the OR that hung up on us
svn:r1706
2004-04-26 01:50:08 +00:00
Roger Dingledine
482d7e7cd3 resolve a double-mark-for-close when things die inside connection_handle_write
svn:r1702
2004-04-25 22:23:54 +00:00
Roger Dingledine
25d54257fb use tor_assert
remove obsolete BUF_OK macro


svn:r1697
2004-04-25 20:37:37 +00:00
Nick Mathewson
0fca143ea1 Remove onion_pkey from connection, since onion keys can change more often than connections. Also add more log messages
svn:r1693
2004-04-25 19:04:11 +00:00
Roger Dingledine
e355ed0e15 log correctly if decoding onion failed
svn:r1690
2004-04-25 04:49:11 +00:00
Nick Mathewson
c44016e86e Merge flagday into main branch.
svn:r1683
2004-04-24 22:17:50 +00:00
Roger Dingledine
8e686d0c72 we added more AP conns, oops
svn:r1569
2004-04-08 07:25:54 +00:00
Roger Dingledine
e79a578fec if the rend desc cache entry was fetched more than 15 mins ago,
then try to fetch a new one. but if the new fetch fails, use the
old one.


svn:r1540
2004-04-07 22:41:00 +00:00
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
7793078dff alice can now look up bob's service descriptor,
choose an intro point, connect to it,
choose a rend point, connect to it and establish a cookie,
get an ack from the rendezvous point,
and know when both circs are ready for her.

APConns don't use conn->purpose anymore

don't initiate a renddesc lookup if one is already in progress

also fix a buffer overflow in nickname parsing (only exploitable
by the operator though)


svn:r1471
2004-04-05 00:47:48 +00:00
Roger Dingledine
bbc9484957 fix some bugs; more remain
svn:r1450
2004-04-03 00:55:53 +00:00
Roger Dingledine
2d3ac08633 Refactor directory servers
* read all the time (before we would ignore eof sometimes, oops)
* we can handle different urls now
* send back 404 for an un-handled url
* commands initiated by the client can handle payloads now
* introduce conn->purpose to avoid exponential state-space explosion


svn:r1400
2004-03-30 22:57:49 +00:00
Roger Dingledine
bcda3ebaef bugfix: we were closing socks-request connections immediately, rather
than flushing them, if they were timing out before we marked them


svn:r1366
2004-03-29 20:04:09 +00:00
Roger Dingledine
e6a2e03524 hold socks reply open until flushed (if possible)
svn:r1356
2004-03-28 09:48:21 +00:00
Roger Dingledine
56dfc3151f work around a tsocks bug
when an AP connection dies early, be sure to do a socks reject
for it. if you just hang up, tsocks goes into an infinite loop.


svn:r1352
2004-03-27 05:45:52 +00:00
Roger Dingledine
9ab5f3c067 fix an assert trigger where an OP would fail to handshake, and we'd
expect it to have a nickname.


svn:r1351
2004-03-27 01:28:14 +00:00
Roger Dingledine
4d747cd954 a missing comma could wreak all sorts of havoc.
svn:r1335
2004-03-26 18:29:05 +00:00
Nick Mathewson
2ba2f02181 Integrate the new "rephist" [rep(utation) hist(ory)] module to trace
successful/failed connections, successful/failed extends, and
connection uptimes.

It's still not done: more tests are needed, and not everything calls
connection/circuit_mark_for_close properly.  This skews the results.

Also, there needs to be a 'testing' mode for non-OP ORs, where they
periodically build circuits just to test whether extends work.


svn:r1313
2004-03-20 04:59:29 +00:00
Roger Dingledine
74ef3a63ae bugfix: decrement OR connections from global_bucket too
bugfix: don't return immediately for has_pending_tls_data unless
        the conn is allowed to read


svn:r1270
2004-03-14 17:06:29 +00:00
Roger Dingledine
703b2d3cf8 refactor bandwidth-control token buckets
this is a checkpoint commit; there still remain some
bugs, er, somewhere.


svn:r1269
2004-03-14 16:00:52 +00:00
Roger Dingledine
87797bcde5 get rid of those pesky tabs
svn:r1264
2004-03-12 13:00:34 +00:00
Nick Mathewson
9b4203266e Make OP work on windows! (Also misc logging tweaks)
svn:r1258
2004-03-11 06:19:08 +00:00
Nick Mathewson
0e5a134709 Fix DOS line endings; autoconfize checks for strptime and inet_aton
svn:r1248
2004-03-09 22:09:13 +00:00
Nick Mathewson
2da54de968 Make tor build on windows again. More work still needed
svn:r1247
2004-03-09 22:01:17 +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
Nick Mathewson
b7633e2e67 Try to find out early if buffers get trashed or double-freed.
svn:r1225
2004-03-03 22:49:15 +00:00
Roger Dingledine
419a672222 holding until flush was borked
we were never writing anything when hold_open_until_flushed was set,
since conn_write returns early if marked_for_conn is set.

seems a bit better now.


svn:r1214
2004-03-03 08:46:18 +00:00
Roger Dingledine
d8e5f3a3a2 close immediately when write() fails too, else things will turn bad
svn:r1212
2004-03-03 07:26:34 +00:00
Roger Dingledine
3c71d09402 use conn->hold_open_until_flushed for streams
and also note/fix a variety of other stream-based bugs


svn:r1210
2004-03-03 06:26:34 +00:00
Nick Mathewson
f4e4dac801 Implement hold_open_until_flushed. I may have missed something important.
svn:r1209
2004-03-03 05:08:01 +00:00
Nick Mathewson
6379dbbe2a warn more when losing data on closed/marked connections.
svn:r1203
2004-03-03 02:07:57 +00:00
Roger Dingledine
49281424ae bugfix: close_immediate called buf_clear but listeners don't have bufs
svn:r1202
2004-03-03 01:58:45 +00:00
Nick Mathewson
a1e4c6dc85 Fix assertion failure spotted by arma.
Apparently, when a DNS failure was already cached, then when we tried
to mark the exit connection as closed, we'd try to remove it from the
pending queue anyway, and hit an assert.  Now, we put failed-resolve
connections in a separate state so that mark_for_close does the right
thing.


svn:r1196
2004-03-02 07:24:11 +00:00
Roger Dingledine
195ee8c845 create a separate connection_edge_destroy() function
svn:r1176
2004-02-29 00:11:37 +00:00
Roger Dingledine
ae67c48805 bugfix: in some cases, connection_mark_for_close wasn't marking the conn
svn:r1174
2004-02-28 23:52:56 +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
Nick Mathewson
f039eca658 Stop trying to flush on broken sockets marked for close.
svn:r1163
2004-02-28 19:14:11 +00:00
Roger Dingledine
80410fa8dc some comments to point nick at the latest bugs
svn:r1162
2004-02-28 11:48:22 +00:00
Roger Dingledine
cec2eee533 enable assert_connection_ok()
we weren't actually asserting much. oops.


svn:r1160
2004-02-28 07:51:30 +00:00
Roger Dingledine
70c43e152a note bug in assert_connection_ok
svn:r1159
2004-02-28 07:48:28 +00:00
Roger Dingledine
dd632e697e clean up some log messages and severities
still plenty more left to clean


svn:r1158
2004-02-28 07:01:22 +00:00
Roger Dingledine
e59f19ca03 some more small fixes
svn:r1152
2004-02-28 04:44:48 +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
88e222ff76 Make has_sent_end irrelevant: only try to send end if reason is nonzero
svn:r1148
2004-02-28 03:06:31 +00:00
Roger Dingledine
d0ad9b147a and another one
svn:r1147
2004-02-27 23:30:27 +00:00
Roger Dingledine
611f117ce1 patches/answers to nick's commit
svn:r1146
2004-02-27 23:23:33 +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
Roger Dingledine
195dfd35a8 Fix a bug where you might flush some data on a tls connection, and then
add some more data to be flushed but never turn POLLOUT on. not sure
how commonly this bug was hit, but it would be a doozy.

Also add some asserts to see if it happens elsewhere.


svn:r1142
2004-02-27 04:42:14 +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
1b25794a56 bugfix: if the exit stream is pending on the resolve, and a destroy
arrives, then the stream wasn't getting removed from the pending list.

this may have been the lucky-bug.
this commit may also not actually fix the bug. it's darn hard to
reproduce.


svn:r1122
2004-02-25 06:57:57 +00:00
Roger Dingledine
7985f525ec fix some bugs in assert_connection_ok
svn:r1118
2004-02-24 22:33:30 +00:00
Roger Dingledine
f00dc6fe1e last minute fix: don't early-flush non-tls streams
e.g., this breaks directory service


svn:r1033
2004-01-31 00:36:00 +00:00
Roger Dingledine
3516ae1a26 add an ap_conn connecting state; report connecting delay
svn:r1011
2004-01-20 09:21:46 +00:00
Roger Dingledine
f5ebf4c712 push out a tls record's worth of data once you've got it
svn:r1009
2004-01-20 02:14:51 +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
f3fdbadfdf randomize the initial circ_id and stream_id, so an adversary who
breaks in part-way through can't learn how many circs/streams have
been made


svn:r960
2003-12-28 04:46:09 +00:00
Roger Dingledine
a5e6ec244f rename circ_id_t to uint16_t for code clarity
change message when using non-recommended tor version


svn:r954
2003-12-19 19:55:02 +00:00
Roger Dingledine
45a66c6955 make a relay_header_t struct and pack/unpack funcs
split 7-byte stream_id string into 2-byte recognized and 2-byte stream_id
fix two seg faults in fetch_from_buf_http
fix several lurking seg faults in handling unexpected relay cells

still need to
 * clean up relay_crypt
 * use relay dummies if there's going to be a conflict with rh.recognized
 * check for a conflict when generating stream_ids


svn:r953
2003-12-19 05:09:51 +00:00
Roger Dingledine
6a19e64066 remove trailing whitespace
svn:r951
2003-12-17 21:09:31 +00:00
Roger Dingledine
21cc01299b infrastructure for integrity-checks in relay cells
make circuit_consider_sending_sendme use connection_edge_send_command
fix endian bug in relay length handling (maybe)


svn:r946
2003-12-16 22:56:50 +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
36ea39ec9c on hup, close and rebind listener ports too (in case their config has changed)
svn:r926
2003-12-14 06:03:46 +00:00
Roger Dingledine
48e42e9346 back out the broken change from yesterday
svn:r891
2003-12-09 01:04:11 +00:00
Roger Dingledine
8bd7c94bf6 general cleanups
svn:r889
2003-12-07 22:03:47 +00:00
Roger Dingledine
d172fdd300 fix vicious bug in connection_ap_attach_pending that caused it to
never work.
fix vicious bug in choose_good_exit_server that caused it to *skip over*
  pending circuits, and look only at *non-pending circuits*, when choosing
  a good exit node for the new circuit.
bugfix: remove incorrect asserts in circuit_get_newest()


svn:r876
2003-12-03 09:50:02 +00:00
Roger Dingledine
02ec2cdb34 bugfix: we were writing to stderr even when it's closed
svn:r868
2003-11-30 09:51:35 +00:00
Roger Dingledine
3818776f62 remove a conn_close_if_marked warning
Nov 27 15:45:19.003 [warn] connection_write_to_buf(): write_to_buf failed. Closing connection (fd 42).
Nov 27 15:45:19.010 [warn] conn_close_if_marked(): Conn (socket 42) still wants to flush. Losing 0 bytes!


svn:r866
2003-11-30 09:35:26 +00:00
Roger Dingledine
00de055f43 bugfix: an offline OP would leak all its sockets and stop working
svn:r865
2003-11-29 02:50:12 +00:00
Nick Mathewson
1155ae9b03 Bring assert_connection_ok up to date
svn:r863
2003-11-23 18:14:19 +00:00
Roger Dingledine
c00953d2a1 make more sure we can't end up with two connections to the same OR
fix leaked pk in connection_tls_finish_handshake


svn:r839
2003-11-18 10:17:52 +00:00
Roger Dingledine
ac56486bf6 use the tor_malloc_zero wrapper
svn:r837
2003-11-18 08:20:19 +00:00
Nick Mathewson
7bde42676b Rename aci to circ_id throughout.
svn:r784
2003-11-11 03:01:48 +00:00
Nick Mathewson
dafb0e6a6e Make AP connections wait for a circuit if none exists.
Also:
  - Refactor socks request into a separate struct
  - Add a separate 'waiting for circuit' state to AP connections
    between 'waiting for socks' and 'open'.

Arma: can you check out the XXX's I've added to connection_edge? I may
be mishandling some async and close logic.


svn:r783
2003-11-11 02:41:31 +00:00
Roger Dingledine
1969c8a92f client now survives going offline better
fix badness in usage()
if neither socksport nor orrport is defined, quit
obsolete connection_flush_buf()


svn:r780
2003-11-10 08:06:55 +00:00
Roger Dingledine
52589289fe add DirBindAddress, parse the BindAddress's when you bind
exit if bind fails
add usage printfs
rearrange config options for readability


svn:r674
2003-10-25 12:01:09 +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
e4127e4d36 move closer to being able to reload config on HUP
rename APPort to SocksPort
introduce new tor_free() macro


svn:r642
2003-10-21 09:48:17 +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
11a23fc280 clean up logging, allow user to specify log files
If DebugLogFile is specified, log to it at -l debug
If LogFile is specified, log to it at the -l from the commandline
  (default info)
If no LogFile *and* not a Daemon, then log to stdout.
Make conn->s = -1 by default (this might break things)
When kill -USR1, prefer to log at INFO, but make sure they always see it.


svn:r596
2003-10-15 18:50:16 +00:00
Nick Mathewson
959b5585a5 Stop using stdout for non-debugging cases
svn:r592
2003-10-15 18:28:32 +00:00
Roger Dingledine
58ec05877a make the buffer resize stuff work
and make listener connections not have bufs


svn:r584
2003-10-14 03:06:48 +00:00
Roger Dingledine
b9628f266f change WARNING to WARN
and fix a few typos


svn:r571
2003-10-10 01:48:32 +00:00
Nick Mathewson
ecfb36823e Refactor, rename, and clarify
svn:r569
2003-10-09 18:45:14 +00:00
Nick Mathewson
36939303c9 Update LICENSE and copyright dates.
svn:r560
2003-10-08 02:04:08 +00:00
Roger Dingledine
de6cbe53c0 some early bugfixes
our log() conflicts with log(3)
distribute only the correct files from doc/ and src/config/
sometimes laptops go back in time. i guess that's ok for now.
and bump the version number because we're live.


svn:r544
2003-10-07 16:30:05 +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
5c8fc2f705 mark all dirservers up at boot; mark a dirserver down if dir fetch fails
svn:r519
2003-09-30 21:27:16 +00:00
Nick Mathewson
d0273ee135 We need to call get_connection_array before using its outputs
svn:r513
2003-09-30 19:25:16 +00:00
Roger Dingledine
2da3e4da0d move connection_array accessors from main.c to connection.c
(leave poll_array accessors in main.c)


svn:r512
2003-09-30 19:06:22 +00:00
Roger Dingledine
013c4e1467 move the tls handshake stuff to connection_or
svn:r510
2003-09-30 18:45:55 +00:00
Roger Dingledine
4533da06c9 getting closer to having dirserv working
we now add our own descriptor to the descriptor list
and we rebuild the directory (and dump to disk) after receiving a POST


svn:r509
2003-09-30 08:18:10 +00:00
Roger Dingledine
c4c66e2c7f expand the scheduler to address SSL_read()'s pending bytes
svn:r505
2003-09-28 06:48:20 +00:00
Nick Mathewson
0e0169d6fa Write necessary backends for online directory generation. I think.
svn:r503
2003-09-27 21:30:10 +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
Roger Dingledine
3b5191d36d various bugfixes and updates
redo all the config files for the new format (we'll redo them again soon)

fix (another! yuck) segfault in log_fn when input is too large
tor_tls_context_new() returns -1 for error, not NULL
fix segfault in check_conn_marked() on conn's that die during tls handshake

make ORs also initialize conn from router when we're the receiving node

make non-dirserver ORs upload descriptor to every dirserver on startup
add our local address to the descriptor
add Content-Length field to POST command
revert the Content-Length search in fetch_from_buf_http() to previous code
fix segfault in memmove in fetch_from_buf_http()
raise maximum allowed headers/body size in directory.c


svn:r484
2003-09-25 10:42:07 +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
40d0fca63a cleanups, bugfixes, more verbose logs
Fixed up the assert_*_ok funcs some (more work remains)

Changed config so it reads either /etc/torrc or the -f arg, never both

Finally tracked down a nasty bug with our use of tls:
  It turns out that if you ask SSL_read() for no more than n bytes, it
  will read the entire record from the network (and maybe part of the next
  record, I'm not sure), give you n bytes of it, and keep the remaining
  bytes internally. This is fine, except our poll-for-read looks at the
  network, and there are no bytes pending on the network, so we never know
  to ask SSL_read() for more bytes. Currently I've hacked it so if we ask
  for n bytes and it returns n bytes, then it reads again right then. This
  will interact poorly with our rate limiting; we need a cleaner solution.


svn:r481
2003-09-24 21:24:52 +00:00
Roger Dingledine
ed51df7453 bugfixes and note missing features
deal with content-length headers better when reading http
don't assume struct socks4_info is a packed struct
fail the socks handshake if destip is zero
flesh out conn_state_to_string() for dir conn
fix typo (bug) in connection_handle_read()
directory get is now called fetch, post is now upload
reopen logs on sighup


svn:r475
2003-09-21 06:15:43 +00:00
Roger Dingledine
078c5ab617 leave the socks handshake on the inbuf until it's complete
this paves the way for supporting socks5 and other handshakes
it also removes those pesky AP-only variables from connection_t

also hacked a fix for a bug where some streams weren't ending properly --
maybe because marked connections weren't flushing properly?


svn:r472
2003-09-18 08:11:31 +00:00
Roger Dingledine
b97945e411 add in directory 'post' support
svn:r471
2003-09-17 20:09:06 +00:00
Roger Dingledine
a66669859e phase out non-tls handshake, now that tls is stable.
svn:r470
2003-09-16 21:20:09 +00:00
Roger Dingledine
6f46316c31 bugfixes and refactorings
svn:r468
2003-09-16 20:57:09 +00:00
Nick Mathewson
4dddac706d Use EXIT properly in assert_connection_ok
svn:r465
2003-09-16 19:51:09 +00:00
Nick Mathewson
1b9c2f35eb Add first cut of assert_*_ok functions
svn:r464
2003-09-16 19:36:19 +00:00
Roger Dingledine
8b71b7338f clean up exported api's
svn:r461
2003-09-16 05:41:49 +00:00
Roger Dingledine
9c6343fdf8 refactor connects into connection_connect()
svn:r460
2003-09-16 01:58:46 +00:00
Roger Dingledine
ebc23f690c bugfix: onion pending queue now works
and fixed recent memory leak


svn:r456
2003-09-14 08:17:14 +00:00
Roger Dingledine
b63013e847 finally tracked down the seg fault
svn:r455
2003-09-14 06:43:18 +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
31bf3ec420 reshuffle functions for cleaner organization
svn:r451
2003-09-12 22:45:31 +00:00
Roger Dingledine
1738af9620 tls works between routers now too
things are still a bit shaky


svn:r450
2003-09-12 06:50:21 +00:00
Roger Dingledine
b1078b7a3c tls works with onion proxies now.
svn:r449
2003-09-12 06:20:36 +00:00
Roger Dingledine
fa1bfaa349 check for funny business from the remote peer
svn:r445
2003-09-11 22:19:48 +00:00
Nick Mathewson
36a3086434 Add router_get_by_pk function; use in connection_tls_finish_handshake.
svn:r441
2003-09-11 20:32:15 +00:00
Roger Dingledine
44c3a7c2d7 collect info from peer we just handshaked with
svn:r439
2003-09-11 20:06:55 +00:00
Roger Dingledine
0bac4247ca tls infrastructure now in place, give or take
svn:r434
2003-09-08 10:59:00 +00:00
Roger Dingledine
3fa170e11f more futzing towards tls
not there yet


svn:r429
2003-09-07 10:24:40 +00:00
Roger Dingledine
99035f3520 clean read_to_buf more
svn:r428
2003-09-05 11:25:24 +00:00
Roger Dingledine
7a34cdf5ee general cleanup and reabstraction, to prepare for tls
svn:r426
2003-09-05 06:04:03 +00:00
Roger Dingledine
90f22933e7 make the conn->package_window bug go away.
not resolved, but at least the servers will stop crashing.


svn:r416
2003-08-25 21:43:51 +00:00
Nick Mathewson
14c8bc598b Attempt to track down bug in conn->package_window
svn:r415
2003-08-25 20:57:23 +00:00
Roger Dingledine
33b0569fba remove duplicate packagewindow-checking code,
see if we can induce that segfault i just saw more often


svn:r407
2003-08-23 10:06:46 +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
Nick Mathewson
cd3467bb01 Attempt to make sockets code work right on windows.
svn:r398
2003-08-14 17:13:52 +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
Nick Mathewson
ac5893c626 src/or
svn:r371
2003-07-30 19:12:03 +00:00
Roger Dingledine
c6f70e36e0 implemented total read rate limiting
svn:r365
2003-07-05 07:10:34 +00:00
Roger Dingledine
75440d08c2 fix many bugs in package_window handling
svn:r363
2003-07-03 03:40:47 +00:00
Roger Dingledine
dbf3435cde simplify fetch_from_buf; cull idle dnsworkers.
svn:r354
2003-06-25 00:31:41 +00:00
Roger Dingledine
a43c015838 clean out some old comments
svn:r348
2003-06-24 05:17:39 +00:00
Nick Mathewson
95e5384af3 Change many files to new log_fn format
svn:r333
2003-06-17 22:18:26 +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
cbe7be1f78 remove on-the-fly compression feature
it wasn't working, and it was harder than we'd anticipated

not worth it.


svn:r316
2003-06-13 10:23:42 +00:00
Roger Dingledine
1454f4aded improve portability: inet_aton is missing on solaris
svn:r314
2003-06-13 09:25:55 +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
fa1d446440 OPport is gone. So is conn type OP.
svn:r298
2003-05-28 02:03:25 +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
Roger Dingledine
d7f50337c1 incremental path building in; uses ephemeral DH; onions are gone
still need to change circuit-level sendmes


svn:r264
2003-05-05 23:24:46 +00:00
Roger Dingledine
96759a609e streams are now 8 bytes, and are recognized by intermediate hops
the OP only crypts the appropriate number of times depending on which
layer (hop on the path) it's for/from.


svn:r262
2003-05-02 21:29:25 +00:00
Roger Dingledine
0560008497 terminology shift: data->relay, topic->relay, topic->stream
svn:r258
2003-05-01 06:42:29 +00:00
Nick Mathewson
5c514620fc Adjust straggling users of payload field
svn:r250
2003-04-17 17:25:32 +00:00
Nick Mathewson
32a3e704b4 Choose correct abstraction for topic_foo. Abstract random-integer code
svn:r249
2003-04-17 17:10:41 +00:00
Nick Mathewson
97d847b9e3 Factor out cell packing and unpacking
svn:r240
2003-04-16 17:44:33 +00:00
Nick Mathewson
33176c70a5 Factor out timeval-related functions.
svn:r237
2003-04-16 17:04:58 +00:00
Nick Mathewson
1fa0fc1487 Introduce a few unit tests (from older code), refactor compression setup/teardown
svn:r232
2003-04-15 19:10:18 +00:00
Roger Dingledine
1d53d8ad0e refactored some duplicate code into connection_edge.c
svn:r230
2003-04-11 22:11:11 +00:00
Roger Dingledine
833f165d68 bugfix: make onion proxies actually obey their requested bandwidth
svn:r229
2003-04-08 22:31:48 +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
b8da74d30a get rid of those nasty tabs
svn:r216
2003-03-24 03:00:20 +00:00
Roger Dingledine
9ac9db782a fix rare race condition
if the directory is remade while an OR is handshaking, the directory
needs to become dirty again when the handshake succeeds


svn:r215
2003-03-24 02:50:07 +00:00
Nick Mathewson
29da03cbdc Be loud when decompressing
svn:r213
2003-03-19 22:47:34 +00:00
Roger Dingledine
ff14dcdef7 fix arg bug; reduce confusion in package_raw_inbuf
svn:r207
2003-03-19 22:27:01 +00:00
Nick Mathewson
0fed84785e Finish zlib and half-open; switch to 3des (ede/ofb)
svn:r198
2003-03-19 20:48:56 +00:00
Roger Dingledine
64e46988f6 greatly simplify this notion of 'roles':
if your ORPort is non-zero then you must connect to all nodes
if your DirPort is non-zero then you must act like a directory server


svn:r192
2003-03-18 01:49:55 +00:00
Nick Mathewson
4ad74c2141 Do not uncompress from z_outbuf to outbuf unless outbuf is less than maximally full
svn:r188
2003-03-17 21:21:35 +00:00
Nick Mathewson
6deed60bb5 Add code for end-to-end zlib compression. Still needs flow-control
svn:r187
2003-03-17 02:42:45 +00:00
Roger Dingledine
c5ed007ac8 respond to nick's question about link padding
(nick: note that link padding is currently disabled)


svn:r178
2003-03-12 12:06:54 +00:00
Nick Mathewson
e3368a65a9 Make ACI anti-collision logic work; make sure that cells are filled with 0s.
svn:r176
2003-03-11 21:38:38 +00:00
Roger Dingledine
70b35ce8c2 lazy (just in time) directory rebuilding
svn:r174
2003-03-11 01:51:41 +00:00
Roger Dingledine
f97ddd44cd minor code cleanup
svn:r166
2003-03-05 20:03:05 +00:00
Roger Dingledine
c5e7d4ca7a when we had multiple conns on a circuit, we'd tell the wrong
one to stop reading


svn:r163
2003-02-28 23:49:52 +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
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
Roger Dingledine
84a34edfa1 expire unfinished handshakes too
don't list non-open ORs in the directory


svn:r134
2002-10-13 13:17:27 +00:00
Roger Dingledine
bf53852a00 cleanup and a variety of bugfixes
svn:r132
2002-10-02 22:54:20 +00:00
Roger Dingledine
7032d16e78 cell now has a network appearance and an internal (struct) appearance
svn:r130
2002-10-02 20:12:44 +00:00
Roger Dingledine
b3b763ad11 all listeners listen on 0.0.0.0 except AP which listens on 127.0.0.1
svn:r126
2002-10-02 01:03:00 +00:00