Browse code

Do not randomize resolving of IP addresses in getaddr()

Based on a discussion on the mailing list and in the IRC meeting Feb 18,
it was decided to remove get_random() from the getaddr() function as that
can conflict with round-robin/randomization done by DNS servers.

This change must be documented in the release notes.

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>

David Sommerseth authored on 2010/02/19 05:20:14
Showing 1 changed files
... ...
@@ -212,12 +212,11 @@ getaddr (unsigned int flags,
212 212
 		++n;
213 213
 	      ASSERT (n >= 2);
214 214
 
215
-	      msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d addresses, choosing one by random",
215
+	      msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d addresses, choosing the first resolved IP address",
216 216
 		   hostname,
217 217
 		   n);
218 218
 
219
-	      /* choose address randomly, for basic load-balancing capability */
220
-	      ia.s_addr = *(in_addr_t *) (h->h_addr_list[get_random () % n]);
219
+	      ia.s_addr = *(in_addr_t *) (h->h_addr_list[0]);
221 220
 	    }
222 221
 	}
223 222