[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
patch, option to set client circuit length.
- To: or-talk@xxxxxxxxxxxxx
- Subject: patch, option to set client circuit length.
- From: robo mojo <robo.mojo@xxxxxxxxx>
- Date: Mon, 7 Apr 2008 01:20:45 -0700 (PDT)
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: or-talk-outgoing@xxxxxxxx
- Delivered-to: or-talk@xxxxxxxx
- Delivery-date: Mon, 07 Apr 2008 04:22:59 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=YXfg3ayNRRDwofy9hSCaAK58S17U3LlOroYpttSt1RMUK3vB3chv2CGBMkij2UDWCtCbF7TKRp2Rx72RSAnmxtPhr4tuSGOy3pJBcnlaMeNfQYjbaIeGlORKz/lw2LihfMqGKUpDCjqVfE4AjM9O4qYN37iVmCDYpUvzD6+lNus=;
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-talk@xxxxxxxxxxxxx
A quick patch to add an option ClientCircuitLen,
which determines the minimum number of hops for
client circuits. It can be either 3, 2, or random.
The default is 3 of course. Random will cause it
to evenly randomize between building circuits with
2 and 3 hops.
This only affects circuits for client purposes.
Circuits made for hidden services aren't affected
(maybe that should be a different option?).
This also doesn't address how or if circuit use
should be changed, only circuit building.
Thoughts?
Index: src/or/config.c
===================================================================
--- src/or/config.c (revision 14305)
+++ src/or/config.c (working copy)
@@ -159,6 +159,7 @@
V(BridgeRelay, BOOL, "0"),
V(CircuitBuildTimeout, INTERVAL, "1 minute"),
V(CircuitIdleTimeout, INTERVAL, "1 hour"),
+ V(ClientCircuitLen, STRING, "3"),
V(ClientDNSRejectInternalAddresses, BOOL,"1"),
V(ClientOnly, BOOL, "0"),
V(ConnLimit, UINT, "1000"),
@@ -425,6 +426,8 @@
{ "AllowNonRFC953Hostnames", "If set to 1, we don't automatically reject "
"hostnames for having invalid characters." },
/* CircuitBuildTimeout, CircuitIdleTimeout */
+ { "ClientCircuitLen", "Sets the number of hops for client circuits "
+ "to 3, 2, or random." },
{ "ClientOnly", "If set to 1, Tor will under no circumstances run as a "
"server, even if ORPort is enabled." },
{ "EntryNodes", "A list of preferred entry nodes to use for the first hop "
@@ -3324,6 +3327,11 @@
});
}
+ if (strcmp(options->ClientCircuitLen, "3") &&
+ strcmp(options->ClientCircuitLen, "2") &&
+ strcasecmp(options->ClientCircuitLen, "random"))
+ REJECT("ClientCircuitLen must be 3, 2, or random.");
+
return 0;
#undef REJECT
#undef COMPLAIN
Index: src/or/or.h
===================================================================
--- src/or/or.h (revision 14305)
+++ src/or/or.h (working copy)
@@ -442,6 +442,7 @@
#define CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED 11
/** Client-side circuit purpose: at Alice, rendezvous established. */
#define CIRCUIT_PURPOSE_C_REND_JOINED 12
+#define _CIRCUIT_PURPOSE_C_MAX 12
/** Hidden-service-side circuit purpose: at Bob, waiting for introductions. */
#define CIRCUIT_PURPOSE_S_ESTABLISH_INTRO 13
@@ -2347,6 +2348,8 @@
/** Optionally, a file with GeoIP data. */
char *GeoIPFile;
+ char *ClientCircuitLen;
+
} or_options_t;
/** Persistent state for an onion router, as saved to disk. */
Index: src/or/circuitbuild.c
===================================================================
--- src/or/circuitbuild.c (revision 14305)
+++ src/or/circuitbuild.c (working copy)
@@ -1036,10 +1036,19 @@
{
int num_acceptable_routers;
int routelen;
+ or_options_t *options = get_options();
tor_assert(routers);
- routelen = 3;
+ if (purpose <= _CIRCUIT_PURPOSE_C_MAX &&
+ strcmp(options->ClientCircuitLen, "3")) {
+ routelen = 2;
+ if (!strcasecmp(options->ClientCircuitLen, "random") &&
+ crypto_rand_int(2))
+ routelen++;
+ } else {
+ routelen = 3;
+ }
if (exit &&
purpose != CIRCUIT_PURPOSE_TESTING &&
purpose != CIRCUIT_PURPOSE_S_ESTABLISH_INTRO)
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com