[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8996: Fix router_new_address_suggestion() so it only changes last_ (in tor/trunk: . src/or)



Author: nickm
Date: 2006-11-26 13:36:51 -0500 (Sun, 26 Nov 2006)
New Revision: 8996

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/router.c
Log:
 r9396@totoro:  nickm | 2006-11-26 13:36:29 -0500
 Fix router_new_address_suggestion() so it only changes last_guessed_ip() when it actually calls resolve_my_address(). (bug found by dev-girl)



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r9396] on 96637b51-b116-0410-a10e-9941ebb49b64

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-11-26 18:36:46 UTC (rev 8995)
+++ tor/trunk/ChangeLog	2006-11-26 18:36:51 UTC (rev 8996)
@@ -33,6 +33,8 @@
       correctly in the Windows installer.
     - Avoid assert failure when our cached-routers file is empty on
       startup.
+    - Don't corrupt last_guesssed_ip in router_new_address_suggestion() when
+      we're running as a client.
 
 
 Changes in version 0.1.2.3-alpha - 2006-10-29

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2006-11-26 18:36:46 UTC (rev 8995)
+++ tor/trunk/src/or/router.c	2006-11-26 18:36:51 UTC (rev 8996)
@@ -1009,7 +1009,7 @@
 void
 router_new_address_suggestion(const char *suggestion)
 {
-  uint32_t addr, cur;
+  uint32_t addr, cur = 0;
   struct in_addr in;
   or_options_t *options = get_options();
 
@@ -1022,8 +1022,10 @@
 
   log_debug(LD_DIR, "Got X-Your-Address-Is: %s.", suggestion);
 
-  if (!server_mode(options) ||
-      resolve_my_address(LOG_INFO, options, &cur, NULL) >= 0) {
+  if (!server_mode(options))
+    return;
+
+  if (resolve_my_address(LOG_INFO, options, &cur, NULL) >= 0) {
     /* We're all set -- we already know our address. Great. */
     last_guessed_ip = cur; /* store it in case we need it later */
     return;