summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-02-18 21:20:14 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-04-27 23:07:36 +0200
commit373d38555caa31d3e7b0746c6469a3cbb9be7ec0 (patch)
tree525b5629477d4a1bcdaaa986080f7a68fbc504ac
parent3d0a688b2f80d6e6afb39500d9ca46c443309b34 (diff)
downloadopenvpn-373d38555caa31d3e7b0746c6469a3cbb9be7ec0.tar.gz
openvpn-373d38555caa31d3e7b0746c6469a3cbb9be7ec0.tar.xz
openvpn-373d38555caa31d3e7b0746c6469a3cbb9be7ec0.zip
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>
-rw-r--r--socket.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/socket.c b/socket.c
index 65fbcd7..594b50a 100644
--- 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]);
}
}