[or-cvs] use unverified routers in the desired positions
Roger Dingledine
arma at seul.org
Tue Aug 17 06:27:35 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuitbuild.c config.c or.h rendservice.c routerlist.c
Log Message:
use unverified routers in the desired positions
Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- circuitbuild.c 16 Aug 2004 20:47:00 -0000 1.23
+++ circuitbuild.c 17 Aug 2004 06:27:32 -0000 1.24
@@ -837,11 +837,11 @@
router->nickname, i);
continue; /* skip routers that are known to be down */
}
- if(!router->is_verified) {
+ if(!router->is_verified &&
+ !(options._AllowUnverified & ALLOW_UNVERIFIED_EXIT)) {
n_supported[i] = -1;
log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- unverified router.",
router->nickname, i);
- /* XXX008 maybe one day allow unverified routers as exits */
continue; /* skip unverified routers */
}
if(router_exit_policy_rejects_all(router)) {
@@ -948,7 +948,8 @@
case CIRCUIT_PURPOSE_C_GENERAL:
return choose_good_exit_server_general(dir);
case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
- r = router_choose_random_node(options.RendNodes, options.RendExcludeNodes, NULL, 0, 1, 0);
+ r = router_choose_random_node(options.RendNodes, options.RendExcludeNodes,
+ NULL, 0, 1, options._AllowUnverified & ALLOW_UNVERIFIED_RENDEZVOUS, 0);
return r;
default:
log_fn(LOG_WARN,"unhandled purpose %d", purpose);
@@ -1103,7 +1104,8 @@
tor_assert(r);
smartlist_add(excluded, r);
}
- choice = router_choose_random_node("", options.ExcludeNodes, excluded, 0, 1, 0);
+ choice = router_choose_random_node("", options.ExcludeNodes, excluded,
+ 0, 1, options._AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0);
smartlist_free(excluded);
return choice;
}
@@ -1134,9 +1136,9 @@
smartlist_add(excluded, r);
}
}
- choice = router_choose_random_node(options.EntryNodes,
- options.ExcludeNodes, excluded, 0, 1,
- options.StrictEntryNodes);
+ choice = router_choose_random_node(options.EntryNodes, options.ExcludeNodes,
+ excluded, 0, 1, options._AllowUnverified & ALLOW_UNVERIFIED_ENTRY,
+ options.StrictEntryNodes);
smartlist_free(excluded);
return choice;
}
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- config.c 17 Aug 2004 05:13:57 -0000 1.137
+++ config.c 17 Aug 2004 06:27:32 -0000 1.138
@@ -825,6 +825,10 @@
options->_AllowUnverified |= ALLOW_UNVERIFIED_EXIT;
else if (!strcasecmp(cp, "middle"))
options->_AllowUnverified |= ALLOW_UNVERIFIED_MIDDLE;
+ else if (!strcasecmp(cp, "introduction"))
+ options->_AllowUnverified |= ALLOW_UNVERIFIED_INTRODUCTION;
+ else if (!strcasecmp(cp, "rendezvous"))
+ options->_AllowUnverified |= ALLOW_UNVERIFIED_RENDEZVOUS;
else {
log(LOG_WARN, "Unrecognized value '%s' in AllowUnverifiedNodes",
cp);
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.408
retrieving revision 1.409
diff -u -d -r1.408 -r1.409
--- or.h 17 Aug 2004 06:06:05 -0000 1.408
+++ or.h 17 Aug 2004 06:27:32 -0000 1.409
@@ -808,10 +808,11 @@
typedef struct circuit_t circuit_t;
-#define ALLOW_UNVERIFIED_ENTRY 1
-#define ALLOW_UNVERIFIED_EXIT 2
-#define ALLOW_UNVERIFIED_MIDDLE 4
-
+#define ALLOW_UNVERIFIED_ENTRY 1
+#define ALLOW_UNVERIFIED_EXIT 2
+#define ALLOW_UNVERIFIED_MIDDLE 4
+#define ALLOW_UNVERIFIED_RENDEZVOUS 8
+#define ALLOW_UNVERIFIED_INTRODUCTION 16
/** Configuration options for a Tor process */
typedef struct {
@@ -1392,12 +1393,11 @@
int all_directory_servers_down(void);
struct smartlist_t;
void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list);
-void router_add_running_routers_to_smartlist(struct smartlist_t *sl);
int router_nickname_matches(routerinfo_t *router, const char *nickname);
routerinfo_t *router_choose_random_node(char *preferred, char *excluded,
struct smartlist_t *excludedsmartlist,
int preferuptime, int preferbandwidth,
- int strict);
+ int allow_unverified, int strict);
routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port);
routerinfo_t *router_get_by_nickname(const char *nickname);
routerinfo_t *router_get_by_hexdigest(const char *hexdigest);
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- rendservice.c 15 Aug 2004 20:31:11 -0000 1.78
+++ rendservice.c 17 Aug 2004 06:27:32 -0000 1.79
@@ -9,6 +9,8 @@
#include "or.h"
+extern or_options_t options; /* command-line and config-file options */
+
static circuit_t *find_intro_circuit(routerinfo_t *router, const char *pk_digest);
/** Represents the mapping from a virtual port of a rendezvous service to
@@ -821,8 +823,8 @@
/* The directory is now here. Pick three ORs as intro points. */
for (j=prev_intro_nodes; j < NUM_INTRO_POINTS; ++j) {
router = router_choose_random_node(service->intro_prefer_nodes,
- service->intro_exclude_nodes,
- exclude_routers, 1, 0, 0);
+ service->intro_exclude_nodes, exclude_routers, 1, 0,
+ options._AllowUnverified & ALLOW_UNVERIFIED_INTRODUCTION, 0);
if (!router) {
log_fn(LOG_WARN, "Could only establish %d introduction points for %s",
smartlist_len(service->intro_nodes), service->service_id);
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- routerlist.c 17 Aug 2004 06:06:05 -0000 1.123
+++ routerlist.c 17 Aug 2004 06:27:32 -0000 1.124
@@ -189,7 +189,9 @@
/** Add every router from our routerlist that is currently running to
* <b>sl</b>.
*/
-void router_add_running_routers_to_smartlist(smartlist_t *sl) {
+static void
+router_add_running_routers_to_smartlist(smartlist_t *sl, int allow_unverified)
+{
routerinfo_t *router;
int i;
@@ -198,8 +200,8 @@
for(i=0;i<smartlist_len(routerlist->routers);i++) {
router = smartlist_get(routerlist->routers, i);
- /* XXX008 for now, only choose verified routers */
- if(router->is_running && router->is_verified) {
+ if(router->is_running &&
+ (allow_unverified || router->is_verified)) {
if(!clique_mode()) {
smartlist_add(sl, router);
} else {
@@ -289,7 +291,7 @@
routerinfo_t *router_choose_random_node(char *preferred, char *excluded,
smartlist_t *excludedsmartlist,
int preferuptime, int preferbandwidth,
- int strict)
+ int allow_unverified, int strict)
{
smartlist_t *sl, *excludednodes;
routerinfo_t *choice;
@@ -312,7 +314,7 @@
smartlist_free(sl);
if(!choice && !strict) {
sl = smartlist_create();
- router_add_running_routers_to_smartlist(sl);
+ router_add_running_routers_to_smartlist(sl, allow_unverified);
smartlist_subtract(sl,excludednodes);
if(excludedsmartlist)
smartlist_subtract(sl,excludedsmartlist);
More information about the tor-commits
mailing list