aboutsummaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-11-23 17:31:53 -0500
committerNick Mathewson <nickm@torproject.org>2012-12-17 14:51:29 -0500
commitde4cc126cbb5e663bdd048fd782fde869be7b80a (patch)
treee06b521387454e78dc2b8bfa872c2cfac5677d50 /src/or/control.c
parent963b3d15492c6cda3feac6efcff768913352ac2c (diff)
downloadtor-de4cc126cbb5e663bdd048fd782fde869be7b80a.tar.gz
tor-de4cc126cbb5e663bdd048fd782fde869be7b80a.zip
Build and test most of the machinery needed for IPv6 virtualaddrmaps
With an IPv6 virtual address map, we can basically hand out a new IPv6 address for _every_ address we connect to. That'll be cool, and will let us maybe get around prop205 issues. This uses some fancy logic to try to make the code paths in the ipv4 and the ipv6 case as close as possible, and moves to randomly generated addresses so we don't need to maintain those stupid counters that will collide if Tor restarts but apps don't. Also has some XXXX items to fix to make this useful. More design needed.
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 75c9af6f7b..65689c46dd 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1373,10 +1373,13 @@ handle_control_mapaddress(control_connection_t *conn, uint32_t len,
"512-syntax error: invalid address '%s'", to);
log_warn(LD_CONTROL,
"Skipping invalid argument '%s' in MapAddress msg", to);
- } else if (!strcmp(from, ".") || !strcmp(from, "0.0.0.0")) {
+ } else if (!strcmp(from, ".") || !strcmp(from, "0.0.0.0") ||
+ !strcmp(from, "::")) {
+ const char type =
+ !strcmp(from,".") ? RESOLVED_TYPE_HOSTNAME :
+ (!strcmp(from, "0.0.0.0") ? RESOLVED_TYPE_IPV4 : RESOLVED_TYPE_IPV6);
const char *address = addressmap_register_virtual_address(
- !strcmp(from,".") ? RESOLVED_TYPE_HOSTNAME : RESOLVED_TYPE_IPV4,
- tor_strdup(to));
+ type, tor_strdup(to));
if (!address) {
smartlist_add_asprintf(reply,
"451-resource exhausted: skipping '%s'", line);