Commit Graph

552 Commits

Author SHA1 Message Date
Nick Mathewson
475eb5d6fe Apparent 311 fix: apparently passing Z_FINISH an empty string is problematic.
svn:r6702
2006-06-29 11:19:52 +00:00
Nick Mathewson
b82dfdd4a3 Make some more verbose gcc warnings go away.
svn:r6680
2006-06-22 07:34:04 +00:00
Nick Mathewson
52b8dfa95a Fix a bunch of spaces.
svn:r6678
2006-06-22 07:25:15 +00:00
Nick Mathewson
b7910202a3 Next batch of memory miserdom: mmap cached-routers file. This is sure to break somewhere.
svn:r6675
2006-06-22 07:01:54 +00:00
Nick Mathewson
e2697a62ac When requesting or serving resources via fingerprint/digest, request and respond in-order, removing duplicates.
svn:r6673
2006-06-21 04:57:12 +00:00
Peter Palfrader
7b6c435066 <nickm> ooh, that log shouldn't be there. can you take it out?
svn:r6671
2006-06-20 23:11:15 +00:00
Nick Mathewson
0799154ae1 Fix bug in networkstatus spooling: spool more than the first networkstatus.
svn:r6670
2006-06-20 23:06:52 +00:00
Nick Mathewson
0e09b26112 Fishy, but harmless.
svn:r6669
2006-06-20 16:48:32 +00:00
Roger Dingledine
ef78e4245f add a note for nick to fix
svn:r6668
2006-06-20 13:14:07 +00:00
Nick Mathewson
a9e1a4c33c Ah. We need a new zlib_state for each networkstatus we spool out.
svn:r6667
2006-06-20 06:27:13 +00:00
Nick Mathewson
4283b81a48 Start spooling v2 networkstatus docs as well.
svn:r6664
2006-06-20 00:48:23 +00:00
Nick Mathewson
3f7f069a05 Fix a tricky crash: making the_directory heap-allocated (so we could refcount it and have multiple instances as neeeded) means that calls to dirserv_regenerate_directory could invalidate the auth_dir value passed to dirserv_pick_cached_dir_obj. Big fun.
svn:r6663
2006-06-18 21:30:03 +00:00
Nick Mathewson
2552d5e60f Fix an assert that still isnt the assert we are hunting.
svn:r6662
2006-06-18 21:15:01 +00:00
Nick Mathewson
f1993b8b30 Become capable of noticing that we are done sending a directory.
svn:r6659
2006-06-18 20:58:27 +00:00
Nick Mathewson
537104c908 write_to_buf != connection_write_to_buf. Also, add a connection_write_to_buf_zlib wrapper that sucks.
svn:r6650
2006-06-18 08:46:55 +00:00
Nick Mathewson
4d02ccfed8 Stop trying to refresh when we are out of data.
svn:r6647
2006-06-18 08:19:35 +00:00
Nick Mathewson
347bcec84a Fix a couple of bugs in last patch.
svn:r6644
2006-06-18 08:07:16 +00:00
Nick Mathewson
c58cc8c16c add coverage for a default case
svn:r6643
2006-06-18 07:57:47 +00:00
Nick Mathewson
b1a8b7869a Oops. conn->requested_resource is client only.
svn:r6642
2006-06-18 07:55:04 +00:00
Nick Mathewson
1d9923da7c Instead of adding servers and v1 directories to buffers en masse, directory servers add them on the fly as their outbufs are depleted. This will save ram on busy dirservers.
svn:r6641
2006-06-18 07:38:55 +00:00
Roger Dingledine
b4e415ba3c now we can tell dirserv_dump_directory_to_string() whether we want
it to include down/invalid descriptors or not.


svn:r6618
2006-06-13 11:11:19 +00:00
Nick Mathewson
853e2d99b6 Add a new warning to our "warn a lot" list: unused parameters. This means we have to explicitly "use" unuseds, but it can catch bugs. (It caught two coding mistakes so far.)
svn:r6532
2006-06-04 22:42:13 +00:00
Roger Dingledine
f6ff3e6f0e directory authorities should be more tolerant of failed reachability
tests before crying foul to the server operator.


svn:r6509
2006-05-28 16:14:26 +00:00
Roger Dingledine
0cee3e1fc7 if the bottom eighth of the servers by bandwidth is really crummy,
try the bottom quartile instead.


svn:r6387
2006-04-15 07:15:23 +00:00
Nick Mathewson
e258276c2b Change a dumb interface. Also, increment trusted_dir_server_t.n_networkstatus_failures when an all.z download fails entirely or partially.
svn:r6345
2006-04-10 01:35:56 +00:00
Roger Dingledine
0871f4ef90 Remove about 30% of the v1 directory bulk by not including down or
invalid nodes.

This will make exitlist's running on v1 not very good. I feel sorry for
them, but not as sorry as I feel for the directory mirrors.


svn:r6332
2006-04-09 01:00:24 +00:00
Roger Dingledine
b7cadc0db5 If you're not a versioning dirserver, don't put the string
"client-versions \nserver-versions \n" in your network status.


svn:r6329
2006-04-08 21:59:15 +00:00
Roger Dingledine
24b2e0530a clean up the log lines more, and note a future work.
svn:r6324
2006-04-08 21:12:07 +00:00
Roger Dingledine
f1692ebefc when we do reachability testing and the tls cert at the other
end disagrees with a descriptor we already have, be more useful
at explaining it.


svn:r6322
2006-04-08 20:35:19 +00:00
Nick Mathewson
5d466b7611 Fix a couple of things that make GCC complain with verbose warnings on. Also, fix some whitespace.
svn:r6317
2006-04-08 05:43:52 +00:00
Nick Mathewson
eba6204315 fix some xxxs.
svn:r6307
2006-04-03 06:23:24 +00:00
Nick Mathewson
d663bfa306 Versions that drop connections for having used idle circs are as bad for stable as for guard
svn:r6296
2006-04-02 23:01:01 +00:00
Roger Dingledine
6fb27741ba Fix dirserv_get_networkstatus_v2's api: its function comments
did not at all match its behavior, and I can't think of a case
when it should return anything other than 0.

This fix may allow getinfo dir/status/foo to work.


svn:r6285
2006-04-01 22:00:49 +00:00
Roger Dingledine
4c996757ae We can remove about 30% of the v1 directory bulk by taking
out down or invalid nodes. We should do this once we're ready.


svn:r6273
2006-03-29 09:21:23 +00:00
Roger Dingledine
db1209a852 Refactor the decision of whether to include a router's descriptor
in the v1 directory. No actual changes yet.


svn:r6272
2006-03-29 08:56:39 +00:00
Roger Dingledine
1f4d0d2479 When deciding whether a router is Fast or Guard-worthy, consider
his advertised BandwidthRate and not just the BandwidthCapacity.

This is a bug in 0.1.0.x as well, but let's not bother backporting.


svn:r6266
2006-03-28 12:01:58 +00:00
Roger Dingledine
6f08d121d9 Refactor and consolidate addr/exit policies into a new policies.c.
Fix some minor bugs and memory leaks along the way.


svn:r6246
2006-03-27 02:25:34 +00:00
Roger Dingledine
7edfec2ae6 bump up the magic number for how quickly we start notifying
a server that it's unreachable.


svn:r6234
2006-03-24 20:57:55 +00:00
Roger Dingledine
20e66a799b Resolve problem found by weasel: the v1 directory was including
servers as much as 48 hours old, because that's how the new
routerlist->routers works. Now only include them if they're
20 hours old or less.


svn:r6230
2006-03-22 21:32:42 +00:00
Peter Palfrader
58307cd8de Maybe it compiles for devilproxy now
svn:r6229
2006-03-22 11:23:00 +00:00
Roger Dingledine
5399e394a8 and dirservers don't call you a guard if you're running a
buggy version either.


svn:r6216
2006-03-21 23:10:26 +00:00
Nick Mathewson
08aba015ab Make guard bandwidth threshold higher than fast bandwidth threshold.
svn:r6204
2006-03-20 21:49:55 +00:00
Nick Mathewson
1272485cd4 Make "Fast" based on median capacity, just like "Stable" is based on median uptime.
svn:r6203
2006-03-20 21:41:12 +00:00
Roger Dingledine
c06e6ddadd Finish the transition from the word 'verified' to the words
'named' and 'valid'.


svn:r6188
2006-03-19 01:21:59 +00:00
Roger Dingledine
cf6ba3e76f let an authdir that's not a naming authdir start even
if it doesn't have an approved-routers file. if it does,
read it and parse it as usual.


svn:r6182
2006-03-18 00:22:23 +00:00
Nick Mathewson
fb7b5545ce Implement GETINFO(dir/server/foo); status will be harder.
svn:r6165
2006-03-15 05:06:56 +00:00
Peter Palfrader
a4ec555228 change INET_NTOA_BUF_LEN+1 to INET_NTOA_BUF_LEN
add a comment in a few places where we add weird numbers to buffer lengths


svn:r6161
2006-03-14 23:40:37 +00:00
Peter Palfrader
2ef8f772a1 Fix an off-by-one buffer size in dirserv.c that magically never hit our
three authorities but broke sjmurdoch's own tor network.


svn:r6157
2006-03-14 22:43:52 +00:00
Nick Mathewson
474c60b743 Cleanup on time-relaqted constants. New conventions:
1) Surround all constants by (parens), whether we'll be using them
     in a denominator or not.
  2) Express all time periods as products (24*60*60), not as multiplied-out
     constants (86400).
  3) Comments like "(60*60) /* one hour */" are as pointless as comments
     like "c = a + b; /* set c to the sum of a and b */".  Remove them.
  4) All time periods should be #defined constants, not given inline.
  5) All time periods should have doxygen comments.
  6) All time periods, unless specified, are in seconds.  It's not necessary
     to say so.

To summarize, the old (lack of) style would allow:

  #define FOO_RETRY_INTERVAL 60*60 /* one hour (seconds) */
  next_try = now + 3600;

The new style is:

  /** How often do we reattempt foo? */
  #define FOO_RETRY_INTERVAL (60*60)

  next_try = now + RETRY_INTERVAL;


svn:r6142
2006-03-12 22:48:18 +00:00
Roger Dingledine
b67a5ba498 lower the reachability timeout, so we're more likely to act
quickly if a server stops being reachable.


svn:r6141
2006-03-12 21:24:03 +00:00
Roger Dingledine
1fc5eb329b We screwed up in anticipating how to add new dirservers:
Old servers won't realize they're supposed to stay connected
to the new dirservers, so they'll expire connections to them,
but that means the dirservers will list them as unreachable.

So the fix is to stop requiring an open connection when deciding
if a server is reachable. This makes us slightly less accurate,
but at least it will work.


svn:r6140
2006-03-12 20:57:52 +00:00
Nick Mathewson
4d3e709c4b Use escaped() for remaining cases.
svn:r6117
2006-03-11 02:21:30 +00:00
Nick Mathewson
1ce3713889 Possible bug 265 fix: authorities must be more strict than clients about age of acceptable routers; make routers publish every 12 hours; client ROUTER_MAX_AGE must be greater than NETWORKSTATUS_MAX_AGE+authoirty ROUTER_MAX_AGE.
svn:r6095
2006-03-08 06:29:52 +00:00
Nick Mathewson
5777ee0e1a Add some functions to escape values from the network before sending them to the log. Use them everywhere except for routerinfo->plaftorm, routerinfo->contact_info, and rend*.c. (need sleep now)
svn:r6087
2006-03-05 09:50:26 +00:00
Roger Dingledine
aa63a84fe1 the things we do for our windows users.
i hope they appreciate it.


svn:r6004
2006-02-13 09:37:53 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Nick Mathewson
e5a574ce2e Move "sort list of versions" logic into routerparse.c; make version-checking code say which versions it would have accepted. (not tested.)
svn:r5927
2006-02-06 05:04:27 +00:00
Roger Dingledine
6535087845 when building v2 statuses or v1 running-routers, don't admit the
existence of descriptors older than a day.

we still cache them in case anybody asks, but we don't actively
mention them.


svn:r5913
2006-02-05 02:33:40 +00:00
Nick Mathewson
bfe285be61 Add a missing printf arg
svn:r5861
2006-01-24 04:01:13 +00:00
Nick Mathewson
9f42c9d650 Make dirservers generate a separate "guard" flag to mean, "would make a good entry guard". Make clients parse it and vote on it.
svn:r5856
2006-01-24 00:31:16 +00:00
Nick Mathewson
2dd566d5d5 Indirect access to the signed_descriptor field to make it easier to keep them lazily on disk.
svn:r5827
2006-01-12 18:04:17 +00:00
Nick Mathewson
5c78c89471 Appease verbose gcc warning: make dirserv_compute_stable_uptime() static.
svn:r5792
2006-01-11 03:59:55 +00:00
Roger Dingledine
c8e6003412 balance the reachability testing so a smidgen of it happens
every 10 seconds. this way we don't try to do 500 tls's at
once every 20 minutes.


svn:r5763
2006-01-10 07:21:01 +00:00
Nick Mathewson
43a4f8c7f3 Be more aggressive about throwing away expired router descriptors: they are of no use to anybody. Better still: dont serve expired descriptors by fingerprint. The only people who ask for them are busted 0.1.1.10 Tors that will throw them away and re-request them after 30 minutes.
svn:r5762
2006-01-10 04:57:12 +00:00
Nick Mathewson
5d709e8517 Fix bug in last commit. Also, fix bug 231: authorities should never treat their own descriptor changes as cosmetic.
svn:r5755
2006-01-08 21:33:15 +00:00
Nick Mathewson
e30516f33f Fix bug 236: caches should cache up to 16 unrecognized network-status docs.
svn:r5754
2006-01-08 21:26:33 +00:00
Roger Dingledine
f8a59965a1 cleanups, and remove some unreachable code.
svn:r5727
2006-01-04 06:43:03 +00:00
Roger Dingledine
485aa9415d authdirs now stop whining so loudly about bad descriptors that they fetch
from other dirservers. now when there's a log complaint, it's for sure
from a freshly uploaded descriptor.


svn:r5726
2006-01-04 04:42:10 +00:00
Roger Dingledine
9af33ef39c when we choose not to use a server descriptor from our cache, don't
log it so loudly.


svn:r5713
2006-01-03 10:42:20 +00:00
Roger Dingledine
2efa056777 make the "stable" flag in network-status be the median of the uptimes
of running valid servers. that way the cutoff adapts to the stability
of the network as a whole.


svn:r5693
2006-01-02 03:32:55 +00:00
Nick Mathewson
89eded7b17 Add "panic" option to reject all servers not in fingerprint list.
svn:r5601
2005-12-15 21:39:38 +00:00
Nick Mathewson
280c62314e Make clients look at the fast and stable flags in networkstatus, not at the bandwidth and uptime declared in the router descriptors.
svn:r5599
2005-12-15 21:30:57 +00:00
Nick Mathewson
24e79df0b6 Whitespace fixes; comments.
svn:r5596
2005-12-15 21:17:40 +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
Nick Mathewson
27a201ac80 Have dirctory authorites note which servers make good V2 directory caches in publishe network-status.
svn:r5574
2005-12-12 01:03:28 +00:00
Roger Dingledine
58366ffd24 when we changed from log_fn to debug/info/notice/warn/err,
we screwed up the formatting in wild and unpredictable ways.

fix it before it becomes convention to format logs in wild and
unpredictable ways.

still need to do src/common/ someday.


svn:r5551
2005-12-10 09:36:26 +00:00
Roger Dingledine
9b0a40ec78 crank the max line limit down to 150 chars.
svn:r5550
2005-12-10 08:27:01 +00:00
Nick Mathewson
39265dd72e In my private little universe, terminals are still 80 columns. Impose a 160-character-per-line limit; this will creep down.
svn:r5548
2005-12-09 05:37:26 +00:00
Roger Dingledine
a438f2abcd let the user configure a sockslistenaddress on other private IPs
besides 127.x.y.z without complaining.
and give a better message in the log.


svn:r5544
2005-12-09 02:46:46 +00:00
Nick Mathewson
b1d034d2ab Fix bug 212: Directory authorities should not try to download server descriptors that they know they will reject.
svn:r5514
2005-12-06 06:55:43 +00:00
Nick Mathewson
3bd613b44d Rename connection_get_by_identity_digest to reflect that it is OR-only. Make it use a hashtable instead of a linear search.
svn:r5469
2005-11-30 03:01:16 +00:00
Nick Mathewson
447a3a7ff2 Funny. I could have sworn that it compiled.
svn:r5467
2005-11-29 17:17:02 +00:00
Nick Mathewson
94e8dcef44 Fix a bug weasel found: when we are an authority and somebody requests "all" statuses, cconsider regenerating our own.
svn:r5466
2005-11-29 17:14:10 +00:00
Peter Palfrader
a48b722432 Ancient gcc does not like you when you declare variables in the middle of a block
svn:r5437
2005-11-20 16:53:49 +00:00
Peter Palfrader
b9d37a2d58 Add a new controller event type that allows controllers to get all
server descriptors that were uploaded to a router in its role as authoritative
dirserver.


svn:r5436
2005-11-19 18:35:43 +00:00
Roger Dingledine
7aae63994f Recover better from TCP connections to Tor servers that are broken but
don't tell you (it happens!); and rotate TLS connections once a week.

1) If an OR conn becomes more than a week old, make it obsolete.
2) If it's obsolete and empty, kill it.
3) When an OR makes a second connection to you, allow it.
4) If we want to send a new create cell, but the best conn we've
   got is obsolete, and the router is 0.1.1.9-alpha-cvs or later, ask
   for a new conn instead.
5) When we time out on circuit building on the first hop, make that
   connection obsolete.


svn:r5429
2005-11-19 06:57:44 +00:00
Nick Mathewson
75d85c8214 On directory servers, old_routers was wasting hundreds of bytes per superseded router descriptor. Roll the signed descriptor info and identifying info into a cache_info struct, and use only that for old_routers.
svn:r5349
2005-11-05 20:15:27 +00:00
Roger Dingledine
1991f6cf48 more doc cleanups and reorganizing
svn:r5336
2005-11-01 03:48:51 +00:00
Nick Mathewson
f2617c6b79 Free the v2 directory networkstatus on exit. (Not a leak.)
svn:r5330
2005-10-29 05:01:12 +00:00
Nick Mathewson
4cb2435388 aaand another leak. Oops, I guess I lied to weasel when I told him there was no leak here.
svn:r5329
2005-10-28 19:10:53 +00:00
Nick Mathewson
e594ce92fe Start making directory caches retain old routerinfo_t. The code to remove old ones is definitely some textbook C problem.
svn:r5323
2005-10-27 00:34:39 +00:00
Nick Mathewson
e5633c2e66 fix a nasty corruption bug
svn:r5319
2005-10-25 18:33:33 +00:00
Nick Mathewson
5d85560d9e Remove last vestiges of old logging interface.
svn:r5317
2005-10-25 18:01:01 +00:00
Nick Mathewson
049f6c0131 Switch remaining files to new log interface.
svn:r5315
2005-10-25 17:52:14 +00:00
Nick Mathewson
7f20dec1cd When warning about a networkstatus fp, we need to put it in hex.
svn:r5293
2005-10-24 03:25:12 +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
3347c1741d Refactor routerlist access slightly: always use router_get_by_routerlist(); change its interface; add modifier functions to add/remove elements from the current routerlist (so we can add indices).
svn:r5276
2005-10-18 17:43:54 +00:00
Peter Palfrader
d8daa910a6 Make dirserv_get_routerdescs() return better http 404 error messages instead of a generic "Servers unavailable."
svn:r5274
2005-10-18 17:09:57 +00:00
Peter Palfrader
00e1709244 Fix download by SD digest
svn:r5272
2005-10-18 15:58:40 +00:00
Peter Palfrader
6e8052e0f8 I wonder what a stautus is.
svn:r5271
2005-10-18 15:25:10 +00:00
Peter Palfrader
0186cb283f And close the double quote too
svn:r5269
2005-10-18 14:34:49 +00:00
Peter Palfrader
d2f1cd4196 Fix documentation of dirserv_get_routerdescs:
correct the path for queries by server key, add queries by SD digest


svn:r5268
2005-10-18 14:33:19 +00:00
Peter Palfrader
0d9aedfcea Downgrade a few INFO level logs to DEBUG again. Also add two or three new
logs in cases where a calling function's log was downgraded and we wouldn't
get any log message otherwise.


svn:r5263
2005-10-17 16:21:42 +00:00
Nick Mathewson
6101468cbe Enable trivial "download by descriptor digest" functionality.
svn:r5250
2005-10-14 04:56:20 +00:00
Nick Mathewson
972b7512c7 authorities do not replace server descriptors where nothing semantically relevant has changed since the last upload.
svn:r5240
2005-10-12 18:25:25 +00:00
Nick Mathewson
c48ccf9db4 Insert a newline between all router descriptors when generating (old style) signed directories, in case somebody was counting on that.
svn:r5231
2005-10-08 06:02:41 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
61ea516885 Check for named servers when looking them up by nickname;
warn when we'recalling a non-named server by its nickname;
don't warn twice about the same name.

Fix a bug in routers_update_status_from_networkstatus that made nearly
all clients never update routerinfo_t.is_named.

Try to list MyFamily elements by key, not by nickname.

Only warn about names that we generated ourself, or got from the local
user.

On TLS handshake, only check the other router's nickname against its
expected nickname if is_named is set.


svn:r5185
2005-10-04 22:23:31 +00:00
Nick Mathewson
e4a6a03249 switch semantics of authdirinvalid/reject
svn:r5182
2005-10-04 19:52:58 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
5c53545d81 Add a bunch more warnings to out warning suite; resolve them; pack structs a little better.
svn:r5150
2005-09-29 22:59:17 +00:00
Nick Mathewson
9050480339 Fix some compiler warnings
svn:r5124
2005-09-23 17:11:20 +00:00
Nick Mathewson
cdc912714e I love the smell of C in the morning. Make router-download rules smarter (download more so long as we dont duplicate existing requests; relaunch at staggered intervals); relaunch one a minute or on failure; reset 60 minutes; always open 3 requests if we can; add authority opinion to networkstatus; make naming rule correct. There is a remaining bug where we retry servers too quickly; We need to look at that harder.
svn:r5110
2005-09-22 06:34:29 +00:00
Roger Dingledine
1cfcc4b351 clean up misleading comment on authdir_wants_to_reject_router()
svn:r5105
2005-09-21 21:10:36 +00:00
Nick Mathewson
20b9111266 Implement new version handling code.
svn:r5100
2005-09-21 00:41:06 +00:00
Roger Dingledine
19f04ae9c3 make router_is_general_exit match its documentation
but it's still wrong maybe


svn:r5095
2005-09-20 03:40:54 +00:00
Nick Mathewson
e86893e87b Move to new base64 digest functions. Switch to new router digest calculation. Make sure there are no duplicates in router status lists.
svn:r5088
2005-09-18 02:22:21 +00:00
Nick Mathewson
9c2ca40df3 Unify our "figure out which fingerprints we were downloading" code.
svn:r5077
2005-09-16 04:42:45 +00:00
Nick Mathewson
51da58eccf fix braino in dirserv.
svn:r5075
2005-09-15 21:10:58 +00:00
Nick Mathewson
e72e76cad6 Make authdirs smarter. Reject/invalidate by key and IP. Remember that not every authdir has to be a naming authdir.
svn:r5074
2005-09-15 14:39:05 +00:00
Nick Mathewson
ed21abfe87 And some documentation before bed.
svn:r5073
2005-09-15 06:15:31 +00:00
Nick Mathewson
b16048917c Stop downloading directories and download routers instead. This still needs some work, but at last clients are finally on the new architecture. Next comes the tuning and bugfixing.
svn:r5070
2005-09-15 05:19:38 +00:00
Nick Mathewson
e83e1df811 separate validation from naming in authoritative directory servers; simplify some router-management code.
svn:r5069
2005-09-15 00:51:42 +00:00
Nick Mathewson
bc0af7046a Oops. directory_set_dirty() needs to mark networkstatus as dirty too.
svn:r5066
2005-09-14 23:14:37 +00:00
Nick Mathewson
922cee3d0c Clean up a few warnings that make gcc twig out a bit.
svn:r5062
2005-09-14 20:59:25 +00:00
Nick Mathewson
4efa652a98 add docs, fix whitespace, and make ANY rule in routerparse a little tighter.
svn:r5031
2005-09-13 21:14:55 +00:00
Roger Dingledine
82b3b6249c fix a seg fault if we ask an authdirserver for a descriptor by
fingerprint but he doesn't know about him.


svn:r5023
2005-09-13 01:20:26 +00:00
Roger Dingledine
569efe61c0 make the patch less likely to bite us later
svn:r5021
2005-09-12 21:42:59 +00:00
Nick Mathewson
39e29738b1 Maybe I should pay more attention to return values and less to clever comments. Fortunately, the aforementioned comments came out against smacking upside the head.
svn:r5018
2005-09-12 08:49:21 +00:00
Nick Mathewson
a6271650d5 Versions should be sorted by version. Lexical sorting should be used only as a last resort.
svn:r5017
2005-09-12 08:46:37 +00:00
Roger Dingledine
689cb28098 when writing the recommended*versions lines, sort them first.
this is because weasel put his out of order and told me the code
should take care of it.


svn:r5016
2005-09-12 08:31:47 +00:00
Nick Mathewson
3dc5e77b58 Numerous changes to move towards client-side v2 directories.
connection.c:
- Add some more connection accessor functions to make directory
  download redundancy checking work.

directory.c, or.h, router.c, routerlist.c:
- Start on logic to note when networkstatus downloads fail.

dirserv.c, routerlist.c, routerparse.c:
- Start maintaining an is_named field in routerstatus_t.  Don't
  actually look at it yet.

dirserv.c, routerlist.c:
- Remove expired networkstatus objects.

or.h:
- Make some booleans into bitfields
- Add prototypes

routerlist.c:
- Sort networkstatus list by publication time
- Function to remove old (older than 10 days) networkstatus objects.
- Function to set a list of routerinfo_ts' status info from the
  current set of networkstatus objects.
- Function to tell which routerinfos we need to download based no the
  current set of networkstatus objects.
- Do not launch a networkstatus download if a redundant one is in progress.

routerparse.c:
- Keep router entries in networkstatus sorted by digest.


svn:r5012
2005-09-12 06:56:42 +00:00
Nick Mathewson
dcf1e14190 downgrade warning to info
svn:r4967
2005-09-09 21:03:57 +00:00
Nick Mathewson
0de64f224e Warn in more detail when network-status serving and fetching fails. Also, fix a small leak.
svn:r4963
2005-09-09 19:37:12 +00:00
Nick Mathewson
a938190bdb Iteration is happier when you stop.
svn:r4950
2005-09-08 21:20:20 +00:00
Nick Mathewson
4528bbfd9f Resolve some XXXs. Add some others.
svn:r4947
2005-09-08 21:01:24 +00:00
Nick Mathewson
c523e106b5 Do not generate more than 2 of each directory type per minute.
svn:r4946
2005-09-08 20:47:11 +00:00
Nick Mathewson
18e4d78354 Fix an assert in directory.c. Check received network-status objects against the list we expected to get. Do not let anyone else update our network-status object.
svn:r4945
2005-09-08 20:36:40 +00:00
Nick Mathewson
059148f588 Only caches download network-status for now, and they use a different strategy. Add an element to connection_t to remember what we are downloading, and a function to recognize our own fingerprint.
svn:r4944
2005-09-08 20:18:15 +00:00
Nick Mathewson
6c4d43c724 Special-case for retrieving own networkstatus by fingerprint: regenerate if dirty!
svn:r4943
2005-09-08 19:29:21 +00:00
Nick Mathewson
eab005c948 Ensure case match, not mismatch.
svn:r4935
2005-09-08 18:34:41 +00:00
Nick Mathewson
548a863779 Avoid assertion failure
svn:r4931
2005-09-08 18:14:23 +00:00
Roger Dingledine
36fa360c11 and fix grammar
svn:r4925
2005-09-08 06:49:23 +00:00
Nick Mathewson
8f37357193 Make GCC v4 happy with heavy warnings enabled.
svn:r4922
2005-09-08 06:37:50 +00:00
Roger Dingledine
0ac3c58480 clean up comments for router_is_general_exit()
svn:r4917
2005-09-08 05:23:55 +00:00
Nick Mathewson
5c6c88e76d More stuff for new directories.
- Distinguish v1 authorities (all currently trusted directories) from
  v2 authorities (all trusted directories).
    - Add configuration option for which dirs are v1 authories.
    - Add configuration option for whether to be a v1 authority.
    - Make trusted dirserver selection functions take options to
      choose which functionality we need.
    - Remove option when getting directory cache to see whether they
      support running-routers; they all do now.  Replace it with one
      to see whether caches support v2 stuff.

- Parse, cache, and serve network-status objects properly.

- Serve compressed groups of router descriptors.  The compression logic
  here could be more memory-efficient.

-


svn:r4911
2005-09-07 16:42:53 +00:00
Roger Dingledine
33b2abbc90 remove redundant logs about unreachable servers
svn:r4905
2005-09-03 04:37:30 +00:00
Nick Mathewson
467fd6e4e6 fix order of items in network-status
svn:r4904
2005-09-03 02:38:39 +00:00
Nick Mathewson
9bc3d34682 Add contact field to generated network-status objects
svn:r4897
2005-09-02 20:30:03 +00:00
Roger Dingledine
1b04f38145 subtle change to avoid some false positives:
if a server went down for six hours and then came back, we would
complain to it that it's unreachable. now we wait until the third
consecutive descriptor post that we thought it was unreachable,
before complaining to it.


svn:r4891
2005-09-01 08:13:40 +00:00
Roger Dingledine
711cad94ed when we think a router is unreachable, pass the message back to the
server's logs, and make it a 'warn'.
also, fix a memory leak for rejected router descriptors.


svn:r4889
2005-08-31 06:14:37 +00:00
Roger Dingledine
4240410a9d don't whine about reachability if the guy is hibernating now.
speaking of which, we don't actually parse is_hibernating out
of the router descriptor right now. nick, can you fix this?


svn:r4886
2005-08-30 06:48:24 +00:00
Roger Dingledine
e9524f9d2d refactor -- no actual changes
svn:r4885
2005-08-30 06:43:07 +00:00
Roger Dingledine
a8c0c51e0b a bit of cleanup
svn:r4884
2005-08-30 06:01:13 +00:00
Nick Mathewson
0691c7221e Update routerinfo_t.is_running when generating network status on authdirserver.
svn:r4883
2005-08-29 18:42:36 +00:00
Nick Mathewson
e3a058f33a Change semantics of set_cached_dir; fix massive authdir memleak.
svn:r4880
2005-08-28 04:20:37 +00:00
Nick Mathewson
ed070b0fdb Set a variable that exists. That works better.
svn:r4868
2005-08-26 22:16:09 +00:00
Nick Mathewson
a74ad8efea Remember to mark v2 networkstatus non-dirty when we generate it; also, fix spaces.
svn:r4866
2005-08-26 22:08:24 +00:00
Roger Dingledine
77f52e3467 fix some logs and comments
svn:r4864
2005-08-26 21:55:38 +00:00
Nick Mathewson
ae4a183ed8 Change the return values on dirserv_add_descriptor
svn:r4863
2005-08-26 21:46:24 +00:00
Roger Dingledine
53431a4950 fix compile complaints (and a bug)
svn:r4862
2005-08-26 21:30:52 +00:00
Nick Mathewson
e24d540d81 We no longer need dirserv_load_from_directory_string, so dirserv_add_descriptor no longer has to keep track of where each descriptor ends.
svn:r4861
2005-08-26 21:28:16 +00:00
Nick Mathewson
f559c49c39 Make network-status strings wellformed
svn:r4857
2005-08-26 21:11:53 +00:00
Nick Mathewson
9a3be928e9 Note that a descriptor has changed when we receive a new directory.
svn:r4855
2005-08-26 21:02:18 +00:00
Nick Mathewson
0e649ac60a Remove descriptor_list and use routerlist instead. Make directories manage routerlist a little better.
svn:r4854
2005-08-26 20:59:04 +00:00
Roger Dingledine
f3bccdce73 if dirservers set assumereachable, it overrides their individual
reachability testing


svn:r4851
2005-08-26 20:08:12 +00:00
Nick Mathewson
0239249160 Only free strmap if it is allocated.
svn:r4846
2005-08-26 18:48:13 +00:00
Nick Mathewson
ff25a7707a fix syntax err
svn:r4843
2005-08-26 18:35:52 +00:00
Nick Mathewson
88989be99b More documenting
svn:r4842
2005-08-26 18:02:49 +00:00
Nick Mathewson
d54d7b7ec1 Add some documentation; move the signature generation logic into routerparse.c along with the hash generation logic; make router signing use it as well.
svn:r4840
2005-08-26 15:34:53 +00:00
Nick Mathewson
e68bed8782 Fall back to routerlist instead of descriptor_list when we are a cache.
svn:r4837
2005-08-25 20:54:12 +00:00
Nick Mathewson
4dc3cb9fd9 Fix a segfault when starting a dir cache
svn:r4836
2005-08-25 20:45:53 +00:00
Nick Mathewson
54a6a8f0ef Start implementing the server side of the new directory protocol.
Probably very buggy, since I can't actually run an authdir.

Features
- Generate and publish new network-status format
- Code to cache and re-serve network-status objects generated by others.
- Publish individual descriptors (by fingerprint, by "all", and by
  "tell me yours.")  [Still needs compression logic]
- Publish client and server recommended versions seprately.
- Add digest of descriptor to routerinfo_t, so we can track them better, and
  length, so we can server them more easily.

Cleanups
- Unify code to sign directory-like things
- Make resolve_my_address() able to tell you which name it wound up resolving.
- Unify code to store and serve directory-like things so it all uses
  cached_dir_t.
- Unify code to set the value of cached_dir_t objects.


svn:r4835
2005-08-25 20:33:17 +00:00
Roger Dingledine
86f85f240c be much more conservative about logging reachability complaints.
the ones it logs now are probably genuine problem servers.


svn:r4832
2005-08-24 14:31:32 +00:00
Roger Dingledine
a120cc20c1 Dirservers now do their own external reachability testing of each
Tor server, and only list them as running if they've been found to
be reachable.

Dirservers also log trouble servers, but only start complaining loudly
after they've been up for an hour, to reduce false positives. We still
need to do something about the fact that it is quite loud when there
are many trouble servers.


svn:r4829
2005-08-24 02:31:02 +00:00
Nick Mathewson
50452c32ec fix bug 180: handle duplicate lines in approved-routers files.
svn:r4825
2005-08-23 22:00:35 +00:00
Roger Dingledine
cc1b82ade8 when listing min-bandwidth servers in the controller, don't get
fooled by a low bandwidthrate


svn:r4777
2005-08-14 08:38:34 +00:00
Roger Dingledine
ff54050fda let unregistered-servers take a parameter (the min bandwidth)
nick, is this an ugly hack of your protocol?


svn:r4775
2005-08-13 02:20:00 +00:00
Roger Dingledine
66b21a19db Add a 'quit' command for the controller.
Add a 'getinfo unregistered-servers' for arma's internal use.


svn:r4774
2005-08-13 01:55:23 +00:00
Nick Mathewson
18c11eb3bc Be consistent about preferring foo* to struct foo*
svn:r4637
2005-07-22 21:12:10 +00:00
Roger Dingledine
7c7c95c3f6 anonymous bugfix on our pointer arithmetic
svn:r4535
2005-07-12 22:56:06 +00:00
Nick Mathewson
30571317dd Fix unit tests that used old signature for add_fingerprint_to_dir
svn:r4495
2005-06-27 22:25:09 +00:00
Roger Dingledine
419d647353 more cleanups before i go wild
svn:r4469
2005-06-21 01:00:42 +00:00
Roger Dingledine
9c67ae34f1 overall cleanup and streamlining and doccing
also fix a DoS avenue on dirservers


svn:r4468
2005-06-20 23:04:13 +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
Roger Dingledine
fcd0fc3364 flesh out the source file descriptions for doxygen
svn:r4404
2005-06-11 05:31:17 +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
15f937c95e when a dirserver gets a mismatched fingerprint, log the expected
fp and the received fp


svn:r4372
2005-06-09 10:21:55 +00:00
Roger Dingledine
978648bff8 also print the platform string for rejected descriptors
svn:r4160
2005-05-02 22:06:04 +00:00
Roger Dingledine
15c1853bd6 don't print nulls
svn:r4159
2005-05-02 21:54:16 +00:00
Roger Dingledine
c9e83eb1b4 when we refuse a router descriptor, log contactinfo and source address.
svn:r4156
2005-05-02 21:48:54 +00:00
Nick Mathewson
69dc4e1675 Remove support for looking at old directory/routerdesc elements; mark non-new elements optional; switch to new format for dir-signing-key; start accepting newer elements so we can mark them as non-opt later; make tor-spec say the right stuff.
svn:r4154
2005-05-02 21:22:31 +00:00
Roger Dingledine
914ee87e07 stop re-reading and re-parsing the directory as soon as we make it.
it was nice for checking if we've got bugs, but it's really quite
expensive too. it was also nice for updating our routerinfo's
immediately, but we'll update them like everybody else when we fetch
a new dir from somebody else.


svn:r4128
2005-04-27 00:48:05 +00:00
Roger Dingledine
bf79b5266f those should be notices, not warns
svn:r4079
2005-04-12 22:09:04 +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
Roger Dingledine
dd98412ce1 allow servers to publish descriptors from 12 hours in the future.
hopefully this will allow more slack and let crummier servers help
out too.


svn:r4046
2005-04-07 21:01:00 +00:00
Nick Mathewson
7709547c08 When we connect and finish TLS negotiation with address:port, it is obvious that any other key or nickname we might know about (as an authdirserver) does not actually exist at address:port.
svn:r4036
2005-04-06 21:09:47 +00:00
Nick Mathewson
3014b03b67 Add missing comma. Oops
svn:r4017
2005-04-06 03:20:06 +00:00
Nick Mathewson
88fe4d6292 Handle changed router status correctly when reloading fingerprint file
svn:r4016
2005-04-06 01:09:26 +00:00
Nick Mathewson
1b5e2182fa Log msg spelling fix
svn:r4015
2005-04-06 00:53:13 +00:00
Nick Mathewson
374edd356e Change replacement semantics for directory entries: fix bug 121.
svn:r4012
2005-04-06 00:01:35 +00:00
Roger Dingledine
823b7d4d8b automatically approve nodes running 0.1.0.2-rc or later
svn:r4001
2005-04-03 19:01:47 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Nick Mathewson
6e4bccc4ac Make GETINFO for "network-status" work on non-authdirs
svn:r3837
2005-03-23 19:15:10 +00:00
Nick Mathewson
b9016bd18f Fix several bugs (including some crashes) related to control interface; implement missing desc/name functionality.
svn:r3836
2005-03-23 08:40:11 +00:00
Nick Mathewson
0b7a9e2e7b Be willing to cache directories from up to ROUTER_MAX_AGE seconds into the future, now that we are more tolerant of skew.
svn:r3832
2005-03-23 06:39:53 +00:00
Nick Mathewson
905c16846a Fix a few more instances of memory not freed on exit (found by weasel).
svn:r3830
2005-03-23 06:20:50 +00:00
Roger Dingledine
ed9524a626 Remove controller getinfo support for "desc/all-ids".
Replace it with getinfo "network-status" just like in directories.
This way the controller can learn which servers are running, which
are verified, etc.


svn:r3801
2005-03-22 03:27:51 +00:00
Nick Mathewson
bbaa3c7792 Implement more control spec functionality
- Mapaddress
- Postdescriptor
- GetInfo on descriptors

Required changes elsewhere:
- Keep the most recent running_routers_t in the routerlist_t. That way we
  can learn about new routers and remember whether we were last told that
  they were up or down.  Also enables more simplifications.
- Keep the signed descriptor inside routerinfo_t.  This makes
  descriptor_entry_t in dirservers.c unneeded.
- Rename AddressMap (the verb) to MapAddress. Keep AddressMap as a noun.
- Check addresses for plausibility before mapping them.


svn:r3696
2005-02-25 20:46:13 +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
Peter Palfrader
d19aaa9a46 Fix arma's fix for my leak
svn:r3485
2005-01-31 23:47:25 +00:00
Roger Dingledine
ab8691c343 fix a minor memory leak found by weasel
svn:r3484
2005-01-31 20:38:57 +00:00
Roger Dingledine
191e52179c distinguish between "well-formed and rejected" and "not well
formed", when parsing server descriptors.


svn:r3458
2005-01-29 11:23:34 +00:00
Roger Dingledine
7fd8dfe6ea accept LDAP (389/tcp) and LDAPS (636/tcp) in default exit policy
svn:r3457
2005-01-29 11:16:23 +00:00
Nick Mathewson
de9b46ad64 clean a couple of messages
svn:r3401
2005-01-21 23:16:07 +00:00
Nick Mathewson
fd41cbcadf Have reason string for serverdesc post requests contain actual serverdesc status. Also fix return values of dirserv_add_descriptor to work as advertised.
svn:r3391
2005-01-20 20:18:32 +00:00
Roger Dingledine
cd1f50d2f0 new config option DirAllowPrivateAddresses for authdirservers.
now by default they refuse router descriptors that have non-IP
or private-IP addresses.


svn:r3321
2005-01-06 21:03:27 +00:00
Nick Mathewson
91bafc476e Fix a fun bug: do not rewrite a cached directory back to the cache; otherwise we will think it is recent and not fetch a newer one.
svn:r3319
2005-01-06 20:11:52 +00:00
Roger Dingledine
59504f4831 bugfix: if a server uploads a descriptor that's unapproved, actually
tell him so.


svn:r3243
2005-01-03 17:47:32 +00:00
Nick Mathewson
ded8e79979 remove sentence-fragment comment refering to a design that never happened.
svn:r3220
2004-12-24 02:50:27 +00:00
Nick Mathewson
e8585dfe97 Remove length restriction when generating directories.
svn:r3218
2004-12-24 02:17:32 +00:00
Nick Mathewson
7117366810 Fix for running-routers length bug
svn:r3216
2004-12-24 01:41:52 +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
Nick Mathewson
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +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
f91152ce6a Clarify a bunch of log messages
svn:r2983
2004-11-25 04:20:10 +00:00
Nick Mathewson
22dba27d8d Normalize a few more kinds of whitespace. We now dislike:
- func (args)
  - if (x){
This doesn't normalize if(x), for(x); while(x), and friends.


svn:r2943
2004-11-22 23:28:26 +00:00
Nick Mathewson
7a8ac5dfef Tweak on patch to make authoritative directory servers cache
directories on disk.  Make authdirservers cache *their own*
directories instead of the ones they download.  This gives better
liveness, and marginally better resistance to broken authdirservers.

Authdirservers don't cache running-routers at all: r-r isn't stored to
disk, so there's no point right now.


svn:r2893
2004-11-15 16:17:59 +00:00
Roger Dingledine
dbd4dadff7 Authoritative dirservers now also cache the directory, since
they weren't writing anything into their datadirectory, so
when they stop and start, they would know nothing until they
fetched a directory from another authdirserver.


svn:r2891
2004-11-15 09:38:17 +00:00
Nick Mathewson
22a0d82749 Cache running-routers; compress running-routers; serve compressed running-routers.z
svn:r2883
2004-11-15 04:04:20 +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
Nick Mathewson
548d4174ef When listing router status, include ourself if we are awake
svn:r2752
2004-11-09 17:12:56 +00:00
Roger Dingledine
b773045a58 only non-authdirservers cache the dir they just fetched
svn:r2747
2004-11-09 10:38:42 +00:00
Roger Dingledine
cad26b343d once normalized, DataDirectory is always defined
svn:r2734
2004-11-09 07:20:21 +00:00
Roger Dingledine
6521c2ce51 Stop using the wrong DataDirectory when we're validating.
Also validate/normalize the DataDirectory better.


svn:r2732
2004-11-09 07:05:53 +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
ad4dc74482 Use a stricter set of warnings; make them all pass.
svn:r2645
2004-11-02 03:02:17 +00:00
Roger Dingledine
85c79ffbc7 canonicalize "src" and "dest" arg order in crypto.c (and others)
svn:r2644
2004-11-02 02:28:51 +00:00
Nick Mathewson
11d330be5e Tweaks to prevent obsolete restarting tors from hammering the dirservers. (1) Cache a received directory as soon as the signature checks out. (2) Treat a cached directory as "recent" based on its mtime. (3) If we have a recent directory, we dont need to fetch a newer one for DirFetchPostPeriod. This needs review!
svn:r2618
2004-10-28 18:37:52 +00:00
Nick Mathewson
6874c39904 Fix windows build
svn:r2613
2004-10-27 18:14:38 +00:00
Roger Dingledine
75ad4615d1 stop freeing arbitrary memory
fix a couple of memory leaks


svn:r2611
2004-10-27 12:34:02 +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