Commit Graph

329 Commits

Author SHA1 Message Date
Nick Mathewson
6a9ca9e790 Convert some more ints to long longs in rephist.c, as suggested by windows compiler.
svn:r5789
2006-01-11 03:57:01 +00:00
Roger Dingledine
16ee6830b6 only print bandwidth lines to the state file if we're being a server.
otherwise this is pointless and probably bad for security.


svn:r5704
2006-01-02 12:19:28 +00:00
Nick Mathewson
4868d77ab8 Possible fix to state-load bug reported by weasel.
svn:r5692
2006-01-02 00:42:19 +00:00
Nick Mathewson
fc850273bd Appease some verbose GCC warnings.
svn:r5679
2005-12-29 20:25:53 +00:00
Roger Dingledine
35986a2374 simplify because we weren't using those return values anyway
svn:r5643
2005-12-24 22:48:12 +00:00
Peter Palfrader
4bd65f0f98 Keep bandwidth history accross restarts/crashes
svn:r5637
2005-12-23 23:56:42 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +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
Nick Mathewson
5d85560d9e Remove last vestiges of old logging interface.
svn:r5317
2005-10-25 18:01:01 +00:00
Nick Mathewson
1bd3f6cc9a Update more files to new log stuff.
svn:r5286
2005-10-18 22:56:40 +00:00
Nick Mathewson
7a19588a43 Use digestmap_t instead of strmap_t where appropriate. Do less hex en/decoding
svn:r5279
2005-10-18 20:12:22 +00:00
Nick Mathewson
26e7a05725 even better function start checks; give dmalloc a chance of working.
svn:r5162
2005-09-30 01:39:24 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
faa4f420de Remove extraneous space on read-history lines.
svn:r5123
2005-09-23 17:02:50 +00:00
Roger Dingledine
03d0f62da0 make the numbers in read-history and write-history into uint64s,
so they don't overflow and publish negatives in the descriptor.
fixes bug 193.


svn:r5119
2005-09-23 08:29:58 +00:00
Roger Dingledine
87fcd60aa2 predict required circuits better, with an eye toward making
hidden services faster on the service end.


svn:r4772
2005-08-13 00:22:07 +00:00
Roger Dingledine
1e0fdcae98 parameterize RephistTrackTime
svn:r4673
2005-07-25 10:29:21 +00:00
Roger Dingledine
e8a1b1d6a0 add a trivial tor-counting variable
svn:r4593
2005-07-18 06:09:04 +00:00
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
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
baa10cbbfa Instrument buffers.c and rephist.c memory usage
svn:r4317
2005-06-06 17:03:21 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Roger Dingledine
b3177d509e free some more memory at shutdown
svn:r3707
2005-02-28 01:59:18 +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
Nick Mathewson
60f234f42b Add more functions to free things to help dmalloc allong.
svn:r3613
2005-02-10 23:18:39 +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
Roger Dingledine
802d374a99 I'm a bad person.
Stop treating the uint16_t's as null-terminated strings,
and stop looking at the byte after them to see if it's null,
because sometimes you're not allowed to look there.


svn:r3108
2004-12-07 15:29:54 +00:00
Nick Mathewson
d19648b314 Renormalize whitespace
svn:r3095
2004-12-07 05:33:55 +00:00
Roger Dingledine
ef6c9d18e7 New circuit building strategy: keep a list of ports that we've used in the past 6 hours, and always try to have 2 circuits open or on the way
that will handle each such port. (We can extend this to include addresses
if exit policies shift to require that.) Seed us with port 80 so web
browsers won't complain that Tor is "slow to start up".

This was necessary because our old circuit building strategy just involved
counting circuits, and as time went by we would build up a big pile of
circuits that had peculiar exit policies (e.g. only exit to 9001-9100)
which would take up space in the circuit pile but never get used.

Fix router_compare_addr_to_addr_policy: it was not treating a port of *
as always matching, so we were picking reject *:* nodes as exit nodes too.

If you haven't used a clean circuit in an hour, throw it away, just to
be on the safe side.

This means after 6 hours a totally unused Tor client will have no
circuits open.


svn:r3078
2004-12-05 07:10:08 +00:00
Roger Dingledine
52676364b9 bugfix: router_exit_policy_rejects_all() was broken, so we were
sometimes picking middleman nodes as our last hop, which wasn't
very useful.


svn:r3075
2004-12-04 08:56:59 +00:00
Nick Mathewson
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +00:00
Roger Dingledine
bde1d5bfb2 do even less inside our signal handler,
just to be extra paranoidly safe


svn:r3050
2004-12-01 02:54:13 +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
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
Roger Dingledine
921c40abe7 fail more gracefully next time
svn:r2954
2004-11-23 09:01:37 +00:00
Nick Mathewson
bb18d4238f Dont keep rephist info for routers that havent had activity for 24 hours.
svn:r2926
2004-11-21 05:14:46 +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
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
Nick Mathewson
cd753df7bf Resolve many XXXs and all DOCDOCs
svn:r2755
2004-11-09 18:22:17 +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
Nick Mathewson
36bbab2f2b Fix in warning fix
svn:r2617
2004-10-27 21:54:44 +00:00
Nick Mathewson
f8771625c6 Check return of tor_snprintf
svn:r2616
2004-10-27 21:30:47 +00:00
Nick Mathewson
6980929e64 Use strlcpy, not strcpy.
svn:r2610
2004-10-27 06:48:16 +00:00
Nick Mathewson
44d4516155 Use tor_snprintf, not snprintf
svn:r2609
2004-10-27 06:37:34 +00:00
Nick Mathewson
06fa8fc05f Avoid strcat; use snprintf or strlcat instead
svn:r2605
2004-10-27 06:25:29 +00:00
Nick Mathewson
bc62f8e983 Replace sprintf with snprintf
svn:r2602
2004-10-27 05:53:07 +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
Roger Dingledine
5c53c63aa0 Fix a potential buffer overflow found by Ilja van Sprundel.
We don't think this is exploitable, but best to fix it anyway.


svn:r2437
2004-10-11 21:55:19 +00:00
Roger Dingledine
20b8819023 even better, only print extend attempts if there are any.
svn:r2285
2004-08-18 09:57:50 +00:00
Roger Dingledine
a447570036 stop taking strlen of an uninitialized buffer
we were (are?) printing garbage in the rephist stats


svn:r2284
2004-08-18 09:49:17 +00:00
Nick Mathewson
9bcd4a9c6a make last patch compile
svn:r2255
2004-08-17 07:14:45 +00:00
Nick Mathewson
525a4fc365 Stop logging events that happen to uninitialized digests
svn:r2254
2004-08-17 07:12:05 +00:00
Nick Mathewson
98b8a89aa8 Fix comment
svn:r2207
2004-08-09 04:27:42 +00:00
Nick Mathewson
0652a0e90a Fix a fencepost error in the last bandwidth reporting fix
svn:r2202
2004-08-08 19:14:44 +00:00
Roger Dingledine
44ff309c26 touch-ups
svn:r2192
2004-08-07 09:01:04 +00:00
Nick Mathewson
28a6d0901f Handle loop initialization for bandwidth tracking properly
svn:r2190
2004-08-07 05:13:55 +00:00
Nick Mathewson
f6cc218742 Refactor ISO-style (yyyy-mm-dd hh:mm:ss) time parsing into util.c; rename format/parse_rfc1123_time; make rephist remember used bandwidth; published used bandwidth in descriptors in 15-minute chunks. Breaks unittests.
svn:r2182
2004-08-07 02:46:16 +00:00
Nick Mathewson
bed5696185 Keep track of a whole day of bandwidth, not just 12 hrs
svn:r2168
2004-08-06 20:46:50 +00:00
Nick Mathewson
5b61dd0457 Fix all warnings on win32 build
svn:r2127
2004-08-03 23:57:05 +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
Nick Mathewson
18d752e518 Correct "advance-time" logic
svn:r2069
2004-07-20 23:25:00 +00:00
Nick Mathewson
e57698cc6e Track bandwidth usage to estimate capacity
svn:r2065
2004-07-20 20:57:46 +00:00
Nick Mathewson
bc36db351f Resolve all DOCDOCs.
svn:r2050
2004-07-16 22:23:18 +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
Nick Mathewson
76f769deb9 Remaining 008pre1 items done; deferred where more design is needed.
More docs and (way more!) testing needed.

Done:
 - Authdirservers down directories from others.
 - Generate and use running-routers lists
 - Cache directories; store across reboots.
 - Refactor directory parsing a bit; note potential trouble spots.


svn:r1985
2004-06-25 00:29:31 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Nick Mathewson
81922a125c More doxygenation.
svn:r1832
2004-05-10 04:34:48 +00:00
Nick Mathewson
682a805092 Comments for nearly all non-tricky files
svn:r1796
2004-05-05 21:32:43 +00:00
Roger Dingledine
25d54257fb use tor_assert
remove obsolete BUF_OK macro


svn:r1697
2004-04-25 20:37:37 +00:00
Roger Dingledine
4e996a4ce8 tabs
svn:r1456
2004-04-03 02:14:20 +00:00
Nick Mathewson
47b9d4439a Possible fix for c99 aliasing warnings
svn:r1360
2004-03-29 06:18:04 +00:00
Roger Dingledine
ed0ef86c0e make OR not crash when non-OR connection dies
svn:r1319
2004-03-20 20:37:49 +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
Nick Mathewson
da9d5ccfda Add initial history-tracking backend code for reputation module. Not called or tested yet.
svn:r1310
2004-03-20 01:48:05 +00:00