Commit Graph

176 Commits

Author SHA1 Message Date
Roger Dingledine
1da454a42d when returning a list of circuits, don't return a list of the same
conn over and over. that's really bad for memory.


svn:r5463
2005-11-28 02:52:17 +00:00
Nick Mathewson
652e1899ac "How about 'never'? Does 'never' work for you?"
Weasel says circuit_get_by_conn is his main timesink.  Most of its
users were just checking whether OR conns had circuits, so add a
circuit count to OR conns, and check that. One was
circuit_about_to_close_conn, which was doing an O(n^2) series of calls
to get all circs on an OR conn, so make an O(n) function for that.
Finally, circuit_get_by_edge_conn was using it as a sanity test that
has been around for a while but never found any actualy insanity, so
kill that.

circuit_get_by_conn is finally dead, which is good, since it was never
sane to begin with.


svn:r5460
2005-11-26 01:43:57 +00:00
Roger Dingledine
fe221f3dff Start the process of treating internal circuits and exit circuits
separately. It's important to keep them separate because internal
circuits have their last hops picked like middle hops, rather than like
exit hops. So exiting on them will break the user's expectations.

- Stop cannibalizing internal circuits for general exits, and stop
  cannibalizing exit circuits for rendezvous stuff.

- Don't let new exit streams attach to internal circuits.

- When deciding if we have enough circuits for internal and for exit,
  don't count the wrong ones.

- Treat predicted resolves as predicted port 80 exits.


svn:r5457
2005-11-25 08:08:56 +00:00
Nick Mathewson
a39269572f Replace balanced trees with hash tables: this should make stuff significantly faster.
svn:r5441
2005-11-23 04:18:45 +00:00
Roger Dingledine
700c370a3b misc cleanups
svn:r5428
2005-11-19 01:56:58 +00:00
Roger Dingledine
409294153f remove some redundant (and misleading) code
svn:r5425
2005-11-19 00:44:24 +00:00
Roger Dingledine
a3c53e0af9 speed up the lookup-by-circid-orconn now that it seems that
our code works.


svn:r5358
2005-11-11 19:28:32 +00:00
Roger Dingledine
862a997495 when we were cannibalizing a circuit with a particular exit
node in mind, we weren't checking to see if that exit node
was already present earlier in the circuit. oops.


svn:r5357
2005-11-11 19:25:30 +00:00
Roger Dingledine
44b3f3060a make circ->onionskin a pointer, not a static array. moria2 was using
125000 circuit_t's after it had been up for a few weeks, which translates
to 20+ megs of wasted space.


svn:r5333
2005-10-29 19:13:48 +00:00
Nick Mathewson
5d85560d9e Remove last vestiges of old logging interface.
svn:r5317
2005-10-25 18:01:01 +00:00
Nick Mathewson
a38aa81bf8 fix another segv, this time in circid fix.
svn:r5312
2005-10-25 15:31:25 +00:00
Nick Mathewson
932106f54c Efficiency hack: call tor_fix_source_file late, not early. Add "BUG" domain. Domains are now bitmasks... just in case. Make some err msgs non-general.
svn:r5309
2005-10-25 07:05:03 +00:00
Nick Mathewson
fa338d85db Fix one possible source of reuse-a-circuit-id bug; convert circuitbuild to new logging
svn:r5301
2005-10-24 19:37:45 +00:00
Nick Mathewson
1bd3f6cc9a Update more files to new log stuff.
svn:r5286
2005-10-18 22:56:40 +00:00
Roger Dingledine
102df4a982 fix some typos
svn:r5283
2005-10-18 21:39:00 +00:00
Roger Dingledine
bec2271029 fix a few comments
svn:r5262
2005-10-17 08:41:58 +00:00
Nick Mathewson
cc35e1720f Using RAND_pseudo_bytes instead of RAND_bytes is an accident waiting to happen, and does not really speed us up much when we do it. So stop doing it.
svn:r5210
2005-10-06 22:18:01 +00:00
Roger Dingledine
c3aac3ff6b infrastructure for the 'change pseudonym' button.
not used yet.


svn:r5199
2005-10-05 22:31:21 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
c6347cdb0e suppress all our usual compiler warnings, including a longstanding one from tree.h
svn:r5149
2005-09-29 20:49:41 +00:00
Nick Mathewson
18c11eb3bc Be consistent about preferring foo* to struct foo*
svn:r4637
2005-07-22 21:12:10 +00:00
Nick Mathewson
149e9a5900 remove pointless XXXX. It was there to remind me to do something I already did.
svn:r4557
2005-07-14 16:37:33 +00:00
Roger Dingledine
2259032ea1 trivial changes on nick's rendezvous commit
svn:r4553
2005-07-14 08:43:19 +00:00
Roger Dingledine
271d49958e fix another compile warn
svn:r4516
2005-07-01 02:02:24 +00:00
Nick Mathewson
ec83652357 Logic to implement rendezvous/introduction via unknown servers.
- Add a new extend_info_t datatype to hold information needed to
  extend a circuit (addr,port,keyid,onion_key).  Use it in cpath and
  build_state.  Make appropriate functions take or return it instead of
  routerinfo_t or keyid.

- #if 0 needless check in circuit_get_by_edge_conn; if nobody triggers this
  error in 0.1.0.10, nobody will trigger it.

- Implement new hidden service descriptor format, which contains "extend
  info" for introduction points, along with protocol version list.
  - Parse new format.
  - Generate new format
  - Cache old and new formats alongside each other.
  - Directories serve "old" format if asked in old way, "newest available"
    format if asked in new way.
  - Use new format to find introduction points if possible; otherwise fall
    back.  Keep nickname lists and extendinfo lists in sync.
  - Tests for new format.

- Implement new "v2" INTRODUCE cell format.
  - Accept new format
  - Use new format if we have a versioned service descriptor that says the
    server accepts the new format.

- Add documentation for functions and data types.


svn:r4506
2005-06-29 21:46:55 +00:00
Nick Mathewson
64fc1f7bae Implement all the rest of the new controller protocol, debug a little, add some new features, add ADDRMAP events.
svn:r4460
2005-06-19 20:40:41 +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
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
Nick Mathewson
a6f51001a5 New whitespace normalization rule: no blank line at EOF.
svn:r4378
2005-06-09 16:46:51 +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
ab34901263 New and frightening code to implement fast-path first-hop CREATE_FAST cells. Watch out when we bump the version to 0.1.0.6-rc!
svn:r4162
2005-05-02 22:35:18 +00:00
Nick Mathewson
c6769a80fb Fixs a signed/unsigned comparison
svn:r4055
2005-04-08 03:26:23 +00:00
Nick Mathewson
6face4f482 Add missing "char"
svn:r4054
2005-04-08 03:07:07 +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
c92a2620d4 Try RB_TREE instead of SPLAY_TREE, but with a single-entry caching optimization.
svn:r4041
2005-04-07 05:09:19 +00:00
Nick Mathewson
a035b8e3c3 Make compare_orconn_circid_entries marginally faster and inlined, if that helps
svn:r4040
2005-04-07 04:50:25 +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
Nick Mathewson
4453e3794a Add a pointer from edge connections to their corresponding circuit (ulp!); add some debugging sanity-checking for cirid_orconn_map stuff
svn:r4024
2005-04-06 06:13:49 +00:00
Nick Mathewson
b7cdcf3462 Hopefully, this will make ORs much faster, and not break them: keep a big splay tree of (circid,orconn)->circuit mappings to make circuit_get_by_circid_conn much faster.
svn:r4020
2005-04-06 05:33:32 +00:00
Roger Dingledine
658463a751 clean up the circuit-mark-for-close patch
svn:r3994
2005-04-03 05:31:41 +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
7cf33ed495 resolve another 'hasn't sent end yet' bug
svn:r3911
2005-03-29 00:35:35 +00:00
Nick Mathewson
631ab5c69b Add a magic value to cpath_layer_t to make sure that we can tell valid cpaths from freed ones. I audited this once; it could use another audit.
svn:r3831
2005-03-23 06:21:48 +00:00
Roger Dingledine
f1ba4296c1 clean up and refactor some more
svn:r3798
2005-03-22 01:01:15 +00:00
Roger Dingledine
35953edae0 Implement controller's "extendcircuit" directive.
Also refactor circuit building so we plan the whole path ahead
of time.


svn:r3797
2005-03-22 00:42:38 +00:00
Roger Dingledine
4a497e5030 if our clock jumps forward by 100 seconds or more, assume something
has gone wrong with our network and abandon all not-yet-used circs.


svn:r3792
2005-03-19 23:58:42 +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
115271f65e Implement the common case of ATTACHSTREAM.
svn:r3751
2005-03-12 04:22:01 +00:00
Nick Mathewson
e14f812a67 Still more code to make sure we send the right number and kind of RELAY END cells
svn:r3723
2005-03-02 03:13:05 +00:00
Nick Mathewson
f672577bc6 Free even more things on shutdown. Temporarily move tor_free_all out from #ifdef so it gets tested more.
svn:r3614
2005-02-11 01:26:47 +00:00
Roger Dingledine
a7138f2535 fix another rogue connection_free that was causing us troubles
there are no doubt more lurking.


svn:r3478
2005-01-31 03:47:38 +00:00
Roger Dingledine
ff48179372 make cannibalizing for rend circs prey on the pleb circs first
if possible, rather than the elite ones.


svn:r3378
2005-01-19 23:13:20 +00:00
Roger Dingledine
d2400a5afd Introduce a notion of 'internal' circs, which are chosen without regard
to the exit policy of the last hop. Intro and rendezvous circs must
be internal circs, to avoid leaking information. Resolve and connect
streams can use internal circs if they want.

New circuit pooling algorithm: make sure to have enough circs around
to satisfy any predicted ports, and also make sure to have 2 internal
circs around if we've required internal circs lately (with high uptime
if we've seen that lately).

Split NewCircuitPeriod config option into NewCircuitPeriod (30 secs),
which describes how often we retry making new circuits if current ones
are dirty, and MaxCircuitDirtiness (10 mins), which describes how long
we're willing to make use of an already-dirty circuit.

Once rendezvous circuits are established, keep using the same circuit as
long as you attach a new stream to it at least every 10 minutes. (So web
browsing doesn't require you to build new rend circs every 30 seconds.)

Cannibalize GENERAL circs to be C_REND, C_INTRO, S_INTRO, and S_REND
circ as necessary, if there are any completed ones lying around when
we try to launch one.

Re-instate the ifdef's to use version-0 style introduce cells, since
there was yet another bug in handling version-1 style. We'll try switching
over again after 0.0.9 is obsolete.

Bugfix: when choosing an exit node for a new non-internal circ, don't take
into account whether it'll be useful for any pending x.onion addresses --
it won't.

Bugfix: we weren't actually publishing the hidden service descriptor when
it became dirty. So we only published it every 20 minutes or so, which
means when you first start your Tor, the hidden service will seem broken.


svn:r3360
2005-01-17 18:13:09 +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
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
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
Nick Mathewson
c9af37d1ba Resolve FIXME items: make circuit_free_cpath_node static
svn:r2792
2004-11-10 14:28:04 +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
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
2fbf31533b Tricksy compiler warnings! We hates them, hates them forever, my precious!
svn:r2615
2004-10-27 21:14:11 +00:00
Roger Dingledine
0b36c29c4d fix wrong comment
svn:r2585
2004-10-24 17:11:44 +00:00
Roger Dingledine
7c3ab346f6 various tweaks and fixes
svn:r2548
2004-10-16 22:56:46 +00:00
Roger Dingledine
7798e3d770 fix the stale pointer assert bug reported by joe magic
svn:r2436
2004-10-11 01:17:42 +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
Roger Dingledine
198e5f4c16 fix a seg fault when you try to launch a circ
svn:r2002
2004-07-03 01:45:13 +00:00
Nick Mathewson
7d8de8cd10 More digest/nickname fixes
svn:r2000
2004-07-02 23:40:03 +00:00
Roger Dingledine
62dcf9e20f some of the infrastructure to let ORs connect on demand
svn:r1998
2004-07-02 09:29:01 +00:00
Roger Dingledine
fbbb4d01c3 bugfix: while closing a circuit, we were freeing the conns that were
pending resolve, but not removing them from the pending resolve list


svn:r1933
2004-06-02 18:11:28 +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
Nick Mathewson
80be19d9da Tighten assert_cpath_layer_ok assumptions
svn:r1904
2004-05-19 23:51:39 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Roger Dingledine
d7815e85a7 assert_cpath_ok has always been broken
re-disable it.


svn:r1864
2004-05-13 07:44:21 +00:00
Roger Dingledine
ef561c0e42 Break files apart into more modules
* \file circuitbuild.c
 * \brief The actual details of building circuits.

 * \file circuitlist.c
 * \brief Manage the global circuit list.

 * \file circuituse.c
 * \brief Launch the right sort of circuits, attach streams to them.

 * \file connection_edge.c
 * \brief Handle edge streams.

 * \file onion.c
 * \brief Functions to queue create cells, and handle onionskin
 * parsing and creation.

 * \file relay.c
 * \brief Handle relay cell encryption/decryption, plus packaging and
 * receiving from circuits.


svn:r1863
2004-05-13 07:24:49 +00:00