summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-09-25 22:12:54 +0000
committerNick Mathewson <nickm@torproject.org>2006-09-25 22:12:54 +0000
commit49ad1eefa1569a5c8a9ee757fa854edf4cfff8cb (patch)
tree2ffeafde38a7ee4d2061cfc79bd98e5a64b0dd06 /src
parent01f9e97d43014f9d404d9b09031bed814ac507a3 (diff)
downloadtor-49ad1eefa1569a5c8a9ee757fa854edf4cfff8cb.tar.gz
tor-49ad1eefa1569a5c8a9ee757fa854edf4cfff8cb.zip
Add an EnforceDistinctSubnets option so that clients who know what they are doing (mainly people with private testing networks) can disable our same-/16 detection.
svn:r8504
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c1
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/routerlist.c4
3 files changed, 6 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 50d986c355..5872ded220 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -152,6 +152,7 @@ static config_var_t _option_vars[] = {
VAR("DirPort", UINT, DirPort, "0"),
OBSOLETE("DirPostPeriod"),
VAR("DirServer", LINELIST, DirServers, NULL),
+ VAR("EnforceDistinctSubnets", BOOL, EnforceDistinctSubnets,"1"),
VAR("EntryNodes", STRING, EntryNodes, NULL),
VAR("ExcludeNodes", STRING, ExcludeNodes, NULL),
VAR("ExitNodes", STRING, ExitNodes, NULL),
diff --git a/src/or/or.h b/src/or/or.h
index bb7d0b6685..4db05824f4 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1581,6 +1581,8 @@ typedef struct {
char *ServerDNSResolvConfFile; /**< If provided, we configure our internal
* resolver from the file here rather than from
* /etc/resolv.conf (Unix) or the registry (Windows). */
+ int EnforceDistinctSubnets; /** If true, don't allow multiple routers in the
+ * same network zone in the same circuit. */
} or_options_t;
/** Persistent state for an onion router, as saved to disk. */
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 7f0dc577d6..ecef569180 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -629,10 +629,12 @@ routerlist_add_family(smartlist_t *sl, routerinfo_t *router)
{
routerinfo_t *r;
config_line_t *cl;
+ or_options_t *options = get_options();
/* First, add any routers with similar network addresses.
* XXX It's possible this will be really expensive; we'll see. */
- routerlist_add_network_family(sl, router);
+ if (options->EnforceDistinctSubnets)
+ routerlist_add_network_family(sl, router);
if (!router->declared_family)
return;