[or-cvs] r11129: Fix a bug caught by Kate: when we switched from masks to bit (in tor/trunk: . src/or)
nickm at seul.org
nickm at seul.org
Wed Aug 15 21:53:34 UTC 2007
Author: nickm
Date: 2007-08-15 17:53:34 -0400 (Wed, 15 Aug 2007)
New Revision: 11129
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/connection_edge.c
Log:
r14583 at catbus: nickm | 2007-08-15 17:52:35 -0400
Fix a bug caught by Kate: when we switched from masks to bits in 0.2.0.3-alpha, we added a spurious ! that made us never believe that any address fell inside a virtual address range. While we're at it, save a trip around the loop in the common case.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r14583] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-08-15 20:47:42 UTC (rev 11128)
+++ tor/trunk/ChangeLog 2007-08-15 21:53:34 UTC (rev 11129)
@@ -32,6 +32,8 @@
where no controller could authenticate. Now we exit.
- If we require CookieAuthentication, stop generating a new cookie
every time we change any piece of our config.
+ - Fix a bug with AutomapHostsOnResolve that would always cause the second
+ request to fail. Bug reported by Kate. Bugfix on 0.2.0.3-alpha.
Changes in version 0.2.0.4-alpha - 2007-08-01
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2007-08-15 20:47:42 UTC (rev 11128)
+++ tor/trunk/src/or/connection_edge.c 2007-08-15 21:53:34 UTC (rev 11129)
@@ -992,6 +992,7 @@
{
char buf[64];
struct in_addr in;
+ tor_assert(addressmap);
if (type == RESOLVED_TYPE_HOSTNAME) {
char rand[10];
@@ -1013,8 +1014,10 @@
}
in.s_addr = htonl(next_virtual_addr);
tor_inet_ntoa(&in, buf, sizeof(buf));
- if (!strmap_get(addressmap, buf))
+ if (!strmap_get(addressmap, buf)) {
+ ++next_virtual_addr;
break;
+ }
++next_virtual_addr;
--available;
@@ -1023,8 +1026,8 @@
log_warn(LD_CONFIG, "Ran out of virtual addresses!");
return NULL;
}
- if (!addr_mask_cmp_bits(next_virtual_addr, virtual_addr_network,
- virtual_addr_netmask_bits))
+ if (addr_mask_cmp_bits(next_virtual_addr, virtual_addr_network,
+ virtual_addr_netmask_bits))
next_virtual_addr = virtual_addr_network;
}
return tor_strdup(buf);
More information about the tor-commits
mailing list