Commit Graph

342 Commits

Author SHA1 Message Date
Sebastian Hahn
4556f2e7c8 Rename router_get_by_digest()
We now call the function router_get_by_id_digest() to make clear that
we're talking about the identity digest here, not descriptor digest.
2010-10-14 17:49:51 +02:00
Nick Mathewson
26e897420e Initial conversion to use node_t throughout our codebase.
A node_t is an abstraction over routerstatus_t, routerinfo_t, and
microdesc_t.  It should try to present a consistent interface to all
of them.  There should be a node_t for a server whenever there is
  * A routerinfo_t for it in the routerlist
  * A routerstatus_t in the current_consensus.
(note that a microdesc_t alone isn't enough to make a node_t exist,
since microdescriptors aren't usable on their own.)

There are three ways to get a node_t right now: looking it up by ID,
looking it up by nickname, and iterating over the whole list of
microdescriptors.

All (or nearly all) functions that are supposed to return "a router"
-- especially those used in building connections and circuits --
should return a node_t, not a routerinfo_t or a routerstatus_t.

A node_t should hold all the *mutable* flags about a node.  This
patch moves the is_foo flags from routerinfo_t into node_t.  The
flags in routerstatus_t remain, but they get set from the consensus
and should not change.

Some other highlights of this patch are:

  * Looking up routerinfo and routerstatus by nickname is now
    unified and based on the "look up a node by nickname" function.
    This tries to look only at the values from current consensus,
    and not get confused by the routerinfo_t->is_named flag, which
    could get set for other weird reasons.  This changes the
    behavior of how authorities (when acting as clients) deal with
    nodes that have been listed by nickname.

  * I tried not to artificially increase the size of the diff here
    by moving functions around.  As a result, some functions that
    now operate on nodes are now in the wrong file -- they should
    get moved to nodelist.c once this refactoring settles down.
    This moving should happen as part of a patch that moves
    functions AND NOTHING ELSE.

  * Some old code is now left around inside #if 0/1 blocks, and
    should get removed once I've verified that I don't want it
    sitting around to see how we used to do things.

There are still some unimplemented functions: these are flagged
with "UNIMPLEMENTED_NODELIST()."  I'll work on filling in the
implementation here, piece by piece.

I wish this patch could have been smaller, but there did not seem to
be any piece of it that was independent from the rest.  Moving flags
forces many functions that once returned routerinfo_t * to return
node_t *, which forces their friends to change, and so on.
2010-10-01 18:14:27 -04:00
Nick Mathewson
d84d20cbb2 Try to make most routerinfo_t interfaces const 2010-10-01 18:14:27 -04:00
Sebastian Hahn
05072723cb Create routerparse.h 2010-07-27 10:00:46 +02:00
Sebastian Hahn
df9d42cef5 Create rephist.h 2010-07-27 10:00:46 +02:00
Sebastian Hahn
b0cd4551ab Create relay.h 2010-07-27 10:00:45 +02:00
Sebastian Hahn
69fcbbaa89 Create networkstatus.h 2010-07-27 07:58:16 +02:00
Sebastian Hahn
bec1c838ca Create directory.h 2010-07-27 07:58:15 +02:00
Sebastian Hahn
c4f8f1316e Create config.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
01c7b60a80 Create circuituse.h 2010-07-27 07:58:14 +02:00
Sebastian Hahn
174a88dd79 Create circuitlist.h 2010-07-27 07:58:13 +02:00
Sebastian Hahn
21155204c6 Create circuitbuild.h 2010-07-27 07:58:13 +02:00
Sebastian Hahn
85a1d635d5 Create rendservice.h 2010-07-27 07:56:26 +02:00
Sebastian Hahn
7caa8351b8 Create rendclient.h 2010-07-27 07:56:26 +02:00
Sebastian Hahn
31e81439e1 Create rendcommon.h 2010-07-27 07:56:25 +02:00
Sebastian Hahn
cbee969f40 Create routerlist.h 2010-07-27 07:56:25 +02:00
Sebastian Hahn
c53b6cc831 Create router.h 2010-07-27 07:56:25 +02:00
Nick Mathewson
b006e3279f Merge remote branch 'origin/maint-0.2.1'
Conflicts:
	src/common/test.h
	src/or/test.c
2010-02-27 17:16:31 -05:00
Nick Mathewson
c3e63483b2 Update Tor Project copyright years 2010-02-27 17:14:21 -05:00
Roger Dingledine
580066f2f6 Switch to a StrictNodes config option.
This is step one of handling ExcludedNodes better. This first
step is just to make EntryNodes and ExitNodes do what they did
before.
2009-12-21 03:52:31 -05:00
Nick Mathewson
350181529e Merge branch 'safelogging2'
Conflicts:
	ChangeLog
2009-12-15 17:26:09 -05:00
Nick Mathewson
fcbd65b45c Refactor the safe_str_*() API to make more sense.
The new rule is: safe_str_X() means "this string is a piece of X
information; make it safe to log."  safe_str() on its own means
"this string is a piece of who-knows-what; make it safe to log".
2009-12-15 17:25:34 -05:00
Nick Mathewson
0c1b3070cf Now that FOO_free(NULL) always works, remove checks before calling it. 2009-12-12 02:07:59 -05:00
Sebastian Hahn
3807db001d *_free functions now accept NULL
Some *_free functions threw asserts when passed NULL. Now all of them
accept NULL as input and perform no action when called that way.

This gains us consistence for our free functions, and allows some
code simplifications where an explicit null check is no longer necessary.
2009-12-12 03:29:44 +01:00
Sebastian Hahn
f258647433 Allow SafeLogging to exclude client related information 2009-12-12 02:26:11 +01:00
Karsten Loesing
c8b27a8e9e Improve log statement when publishing v2 hs desc. 2009-10-26 23:09:10 -07:00
Karsten Loesing
d2b4b49ff0 Reduce log level for someone else sending us weak DH keys.
See task 1114. The most plausible explanation for someone sending us weak
DH keys is that they experiment with their Tor code or implement a new Tor
client. Usually, we don't care about such events, especially not on warn
level. If we really care about someone not following the Tor protocol, we
can set ProtocolWarnings to 1.
2009-10-25 23:47:05 -07:00
Roger Dingledine
2394336426 read the "circwindow" parameter from the consensus
backport of c43859c5c1
backport of 0d13e0ed14
2009-10-14 17:07:32 -04:00
Roger Dingledine
b02b11c4b4 a mish-mash of stuff in my sandbox 2009-09-17 01:58:39 -04:00
Roger Dingledine
7d838971dd Merge commit 'karsten/no-time-maint-0.2.1' 2009-09-16 20:45:01 -04:00
Nick Mathewson
f9226ae030 Merge commit 'origin/maint-0.2.1' 2009-09-15 12:53:44 -04:00
Roger Dingledine
c43859c5c1 Read "circwindow=x" from the consensus and use it
Tor now reads the "circwindow" parameter out of the consensus,
and uses that value for its circuit package window rather than the
default of 1000 cells. Begins the implementation of proposal 168.
2009-09-15 06:33:33 -04:00
Karsten Loesing
995606a7e1 Avoid calling time(NULL) too often.
Found by "rotator".
2009-09-03 10:17:08 +02:00
Roger Dingledine
fcacf22491 Fix obscure 64-bit big-endian hidserv bug
Fix an obscure bug where hidden services on 64-bit big-endian
systems might mis-read the timestamp in v3 introduce cells, and
refuse to connect back to the client. Discovered by "rotor".
Bugfix on 0.2.1.6-alpha.
2009-09-02 20:36:11 -04:00
Nick Mathewson
1cda6f3e75 Merge commit 'origin/maint-0.2.1' 2009-09-01 15:59:40 -04:00
Sebastian Hahn
aea9cf1011 Fix compile warnings on Snow Leopard
Big thanks to nickm and arma for helping me with this!
2009-09-01 18:36:27 +02:00
Nick Mathewson
cb18fc2190 Merge commit 'origin/maint-0.2.1' 2009-05-27 18:12:18 -04:00
Nick Mathewson
ec7e054668 Spell-check Tor. 2009-05-27 17:55:51 -04:00
Karsten Loesing
948835c680 Remove unused rendversion parameters. YAGNI. 2009-05-04 13:46:30 -04:00
Karsten Loesing
f79688ddef Clients do not request version 0 hidserv descs anymore. 2009-05-04 13:46:30 -04:00
Karsten Loesing
0d68da2381 Drop version 0 hidserv support on service side. 2009-05-04 13:46:29 -04:00
Karsten Loesing
9b32e8c141 Update copyright to 2009. 2009-05-04 11:28:27 -04:00
Karsten Loesing
4ebcc4da34 Update copyright to 2009. 2009-05-02 22:00:54 +02:00
Nick Mathewson
30ec1d1d50 Don't double-free successful_uploads.
When we used smartlist_free to free the list of succesful uploads
because we had succeeded in uploading everywhere, we did not actually
set the successful_uploads field to NULL, so later it would get freed
again in rend_service_descriptor_free.  Fix for bug 948; bug
introduced in 0.2.1.6-alpha.

svn:r19073
2009-03-18 14:35:24 +00:00
Nick Mathewson
c4b8fef362 Remove svn $Id$s from our source, and remove tor --version --version.
The subversion $Id$ fields made every commit force a rebuild of
whatever file got committed.  They were not actually useful for
telling the version of Tor files in the wild.

svn:r17867
2009-01-04 00:35:51 +00:00
Nick Mathewson
426b53d85a Apply patch from Karsten to fix bug 879. Backport candidate.
svn:r17562
2008-12-10 18:16:58 +00:00
Roger Dingledine
bbf0f5a266 explain patch4 better. whee.
svn:r17111
2008-10-15 21:12:51 +00:00
Roger Dingledine
a5769eefa4 patch4 from proposal 155:
Hidden services start out building five intro circuits rather
than three, and when the first three finish they publish a service
descriptor using those. Now we publish our service descriptor much
faster after restart.


svn:r17110
2008-10-15 20:59:48 +00:00
Karsten Loesing
5f457e4fa6 Minor correction of commentation.
svn:r16958
2008-09-24 17:33:07 +00:00
Nick Mathewson
8bc1536a9e Add patch 4 from Karsten for proposal 121, slightly modified. Karsten should definitely re-review the bits I changed.
svn:r16955
2008-09-24 14:44:29 +00:00
Karsten Loesing
e4942e809e Exclude v0 rendezvous descriptors when considering republication.
svn:r16939
2008-09-23 09:30:57 +00:00
Roger Dingledine
fa64d8041f minor cleanups on karsten's patch
svn:r16810
2008-09-09 09:21:21 +00:00
Roger Dingledine
ef7af1d61e karsten's patch for bug 767.
svn:r16808
2008-09-09 08:41:58 +00:00
Nick Mathewson
0b8117a5c0 Fix numerous memory leaks: some were almost impossible to trigger, and some almost inevitable.
svn:r16779
2008-09-05 20:52:15 +00:00
Nick Mathewson
24f1d29be1 Apply proposal 121 patch 3, with minor tweaks and a few comments.
svn:r16598
2008-08-19 15:41:28 +00:00
Nick Mathewson
97245376d9 Next patch from Karsten: client-side configuration stuff for proposal 121.
svn:r16510
2008-08-12 16:12:26 +00:00
Nick Mathewson
60a0ae198d Patch cleanups from karsten
svn:r16479
2008-08-09 15:13:28 +00:00
Nick Mathewson
7994f49d43 Fix bug in my changes to karsten's patch
svn:r16477
2008-08-08 16:45:22 +00:00
Nick Mathewson
22259a0877 The first of Karsten's proposal 121 patches: configure and maintain client authorization data. Tweaked a bit: see comments on or-dev.
svn:r16475
2008-08-08 14:36:11 +00:00
Nick Mathewson
960a0f0a99 r17641@31-33-44: nickm | 2008-08-05 16:07:53 -0400
Initial conversion of uint32_t addr to tor_addr_t addr in connection_t and related types.  Most of the Tor wire formats using these new types are in, but the code to generate and use it is not.  This is a big patch.  Let me know what it breaks for you.


svn:r16435
2008-08-05 20:08:19 +00:00
Karsten Loesing
1fe07f66f4 In some edge cases it occurs that the router descriptor of a previously picked introduction point becomes obsolete. In that case, don't stick to using that introduction point, but simply give up on it. Reverts some part of r15825.
svn:r16404
2008-08-04 23:35:12 +00:00
Karsten Loesing
ff9c3c006f Remove dead code that was left from marking HiddenService(Exclude)Nodes obsolete in task 754.
svn:r16401
2008-08-04 22:42:27 +00:00
Nick Mathewson
ed781e6971 r17338@aud-055: nickm | 2008-07-24 11:21:06 +0200
Refactor the router_choose_random_node interface: any function with 10 parameters, most of which are boolean and one of which is unused, should get refactored like this.


svn:r16167
2008-07-24 09:22:34 +00:00
Nick Mathewson
15b2b8bd69 r17309@aud-055: nickm | 2008-07-23 16:05:43 +0200
Patch from Christian Wilms: remove (HiddenService|Rend)(Exclude)?Nodes options.  They never worked properly, and nobody seems to be using them.  Resolves bug 754.


svn:r16144
2008-07-23 14:07:32 +00:00
Nick Mathewson
c8160bce1f r17188@tombo: nickm | 2008-07-18 14:35:18 -0400
Add new ExcludeExitNodes option.  Also add a new routerset type to handle Exclude[Exit]Nodes.  It is optimized for O(1) membership tests, so as to make choosing a random router run in O(N_routers) time instead of in O(N_routers*N_Excluded_Routers).


svn:r16061
2008-07-18 18:36:32 +00:00
Karsten Loesing
9231858ff5 Fix bug 763. When a hidden service is giving up on an introduction point candidate that was not included in the last published rendezvous descriptor, don't reschedule publication of the next descriptor.
svn:r15825
2008-07-10 21:02:01 +00:00
Karsten Loesing
024de76e5d I was told there is an extend_info_free(). I won't leak memory again. I won't leak memory again. I won't ...
svn:r15335
2008-06-17 19:13:05 +00:00
Karsten Loesing
693d7e3e35 When establishing a hidden service, introduction points that originate from cannibalized circuits are completely ignored and not included in rendezvous service descriptors. Bugfix on 0.2.0.14-alpha. Backport candidate.
svn:r15332
2008-06-17 17:10:03 +00:00
Roger Dingledine
6bd006bdb8 you can't strcasecmp on 20-byte digests
what if they contain nuls?
(worse, what if they *don't* contain nuls? ;)


svn:r15149
2008-06-11 22:46:31 +00:00
Karsten Loesing
33f846b313 In very rare situations new hidden service descriptors were published earlier than 30 seconds after the last change to the service, with the 30 seconds being the current voodoo saying that a descriptor is stable.
svn:r15113
2008-06-10 23:31:55 +00:00
Roger Dingledine
707da4f73f start checking the return value of crypto_pk_asn1_encode() while
we're trying to establish an introduction point. bug reported
by veracode.


svn:r13599
2008-02-19 23:33:02 +00:00
Nick Mathewson
dbcf29d301 r18228@catbus: nickm | 2008-02-19 18:05:53 -0500
Chris Palmer notes that almost nobody is using smartlist_set_capacity().  Chris Palmer is right.  Remove this basically pointless function.


svn:r13596
2008-02-19 23:05:56 +00:00
Nick Mathewson
275bb57a77 r18068@catbus: nickm | 2008-02-13 11:33:19 -0500
Patch from karsten: make hidden service code respect SafeLogging.


svn:r13493
2008-02-13 16:34:00 +00:00
Nick Mathewson
f3eaeb99a3 r18051@catbus: nickm | 2008-02-12 15:20:43 -0500
Re-tune mempool parametes based on testing on peacetime: use smaller chuncks, free them a little more aggressively, and try very hard to concentrate allocations on fuller chunks.  Also, lots of new documentation.


svn:r13484
2008-02-12 20:20:52 +00:00
Nick Mathewson
842a33ff20 Update some copyright notices: it is now 2008.
svn:r13412
2008-02-07 05:31:47 +00:00
Nick Mathewson
a869574c56 r17947@catbus: nickm | 2008-02-06 11:57:53 -0500
Fix a bunch of DOCDOC items; document the --quiet flag; refactor a couple of XXXX020 items.


svn:r13405
2008-02-06 16:58:05 +00:00
Nick Mathewson
368f62c79d r17933@catbus: nickm | 2008-02-05 19:54:28 -0500
Stamp out a bunch of atoi users; make more tor_parse_long() users check their outputs.


svn:r13395
2008-02-06 00:54:47 +00:00
Nick Mathewson
c8a689c9e8 r17909@catbus: nickm | 2008-02-05 14:48:22 -0500
As planned, rename networkstatus_vote_t to networkstatus_t, now that v3 networkstatuses are working and standard and v2 networkstatuses are obsolete.


svn:r13383
2008-02-05 21:39:29 +00:00
Roger Dingledine
6dfd2f531c Revert r13301 and part of r13304. I guess nick's svk messed up.
svn:r13305
2008-01-27 01:03:30 +00:00
Nick Mathewson
ad07366da5 Fix compile with warnings enabled
svn:r13301
2008-01-26 22:03:13 +00:00
Roger Dingledine
af4b735e9a move hidden-service stuff out of directory.c
svn:r13287
2008-01-26 00:42:13 +00:00
Roger Dingledine
cbe9863422 patch "14a" from karsten: don't fail if we can't find
REND_NUMBER_OF_CONSECUTIVE_REPLICAS v2 hsdirs.


svn:r13263
2008-01-24 22:46:29 +00:00
Nick Mathewson
4a3b7496f0 r17639@catbus: nickm | 2008-01-15 19:09:21 -0500
Fix some hard to trigger but nonetheless real memory leaks spotted by an anonymous contributor.  Needs review.  Partial backport candidate.


svn:r13147
2008-01-16 05:27:19 +00:00
Nick Mathewson
da06bfb80f r15653@tombo: nickm | 2007-12-23 14:15:12 -0500
Refactor circuit_launch* functions to take a bitfield of flags rather than 4 separate nonconsecutive flags arguments.  Also, note a possible but in circuit_find_to_cannibalize, which seems to be ignoring its purpose argument.


svn:r12948
2007-12-23 19:15:22 +00:00
Roger Dingledine
3f4080d15d tiny tweaks on r12900
svn:r12901
2007-12-21 09:33:11 +00:00
Roger Dingledine
90fcfade4e revert r12841 and r12842, and commit karsten's "patch 13"
svn:r12900
2007-12-21 09:28:22 +00:00
Roger Dingledine
71c84abdff cleanups on r12825
svn:r12826
2007-12-15 20:50:56 +00:00
Roger Dingledine
31324f3e7f apply karsten's "patch 12"
svn:r12825
2007-12-15 20:28:09 +00:00
Roger Dingledine
1d8a8063b9 clean up copyrights, and assign 2007 copyrights to The Tor Project, Inc
svn:r12786
2007-12-12 21:09:01 +00:00
Roger Dingledine
fea55c7c2d two pieces of r12607 for karsten to look at closer
svn:r12609
2007-11-29 15:37:17 +00:00
Roger Dingledine
8ac5f24c33 easy tweaks on r12607
svn:r12608
2007-11-29 15:30:32 +00:00
Roger Dingledine
aaf35cccf7 karsten's second refactoring patch
svn:r12607
2007-11-29 15:25:04 +00:00
Nick Mathewson
42f7ae3eae r16435@catbus: nickm | 2007-11-05 14:23:07 -0500
Patch from karsten: tidy up v2 hidden service directory logic, and fix a few bugs.


svn:r12388
2007-11-05 19:23:57 +00:00
Nick Mathewson
bf2717ff3d r14678@tombo: nickm | 2007-11-03 16:12:31 -0400
Try to make hidden service directory lookup functions a bit more efficient: go for fewer O(n) operations, and look at the consensus rather than the routerinfo list.


svn:r12361
2007-11-03 20:12:41 +00:00
Nick Mathewson
832ef9562f r14623@tombo: nickm | 2007-11-01 22:25:18 -0400
More tweaks from karsten, with some cleanup and commentary.


svn:r12319
2007-11-02 02:25:28 +00:00
Nick Mathewson
fcd42ebef4 r16301@catbus: nickm | 2007-10-31 16:43:49 -0400
A couple of small tweaks to karsten's latest patch, and note an issue with using a bitmap to represent a single int.


svn:r12300
2007-10-31 20:48:08 +00:00
Nick Mathewson
779b615bc2 r16300@catbus: nickm | 2007-10-31 15:36:41 -0400
Next patch from Karsten:  rename some macros, tunnel dir connections, generate (and upload) multiple descriptors as appropriate.


svn:r12299
2007-10-31 20:48:06 +00:00
Nick Mathewson
e136f00ca8 r16262@catbus: nickm | 2007-10-29 13:21:35 -0400
Patch from Karsten: Code to act as (and use) v2 hidden service directories.


svn:r12272
2007-10-29 19:10:42 +00:00
Nick Mathewson
d94a978b32 r16237@catbus: nickm | 2007-10-28 15:45:25 -0400
Tidy v2 hidden service descriptor format code: fix memory leaks, fix reference problems, note magic numbers, note questions, remove redundant checks, remove a possible stack smashing bug when encoding a descriptor with no protocols supported.


svn:r12255
2007-10-28 19:48:16 +00:00
Nick Mathewson
c58675ca72 r16236@catbus: nickm | 2007-10-28 14:36:30 -0400
Patch from Karsten Loesing: encode and parse v2 rendezvous descriptors.


svn:r12254
2007-10-28 19:48:14 +00:00