]> granicus.if.org Git - curl/commitdiff
singleipconnect: unstick the ipv6-connection boolean
authorDaniel Stenberg <daniel@haxx.se>
Mon, 17 Oct 2011 20:01:09 +0000 (22:01 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 17 Oct 2011 21:12:58 +0000 (23:12 +0200)
Previously the bit was set before the connection was found working so if
it would first fail to an ipv6 address and then connect fine to a IPv4
address the variable would still be TRUE.

Reported by: Thomas L. Shinnick
Bug: http://curl.haxx.se/bug/view.cgi?id=3421912

lib/connect.c

index 309ba355a8fc3ac494a63a6f01c0d6903ac06e60..2a1876e71a8ec012fe6753f8b4a3e2bce12fbdda 100644 (file)
@@ -907,11 +907,6 @@ singleipconnect(struct connectdata *conn,
 
   Curl_persistconninfo(conn);
 
-#ifdef ENABLE_IPV6
-  if(addr.family == AF_INET6)
-    conn->bits.ipv6 = TRUE;
-#endif
-
   if(data->set.tcp_nodelay)
     tcpnodelay(conn, sockfd);
 
@@ -999,6 +994,10 @@ singleipconnect(struct connectdata *conn,
     /* we are connected, awesome! */
     *connected = TRUE; /* this is a true connect */
     infof(data, "connected\n");
+#ifdef ENABLE_IPV6
+    conn->bits.ipv6 = (addr.family == AF_INET6)?TRUE:FALSE;
+#endif
+
     Curl_updateconninfo(conn, sockfd);
     *sockp = sockfd;
     return CURLE_OK;