]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Do not randomize resolving of IP addresses in getaddr()
authorDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 18 Feb 2010 20:20:14 +0000 (21:20 +0100)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 18 Feb 2010 20:22:24 +0000 (21:22 +0100)
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>
socket.c

index fecc39837b0353cfa31564518ee034bdb625185f..e42ccb9d4a6e47d4a9db119ad57401637e2387fd 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -212,12 +212,11 @@ getaddr (unsigned int flags,
                ++n;
              ASSERT (n >= 2);
 
-             msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d addresses, choosing one by random",
+             msg (D_RESOLVE_ERRORS, "RESOLVE: NOTE: %s resolves to %d addresses, choosing the first resolved IP address",
                   hostname,
                   n);
 
-             /* choose address randomly, for basic load-balancing capability */
-             ia.s_addr = *(in_addr_t *) (h->h_addr_list[get_random () % n]);
+             ia.s_addr = *(in_addr_t *) (h->h_addr_list[0]);
            }
        }