]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
HTTP3: fix invalid use of sendto for connected UDP socket
authorJavier Blazquez <jblazquez@riotgames.com>
Mon, 28 Oct 2019 00:16:24 +0000 (17:16 -0700)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 28 Oct 2019 19:00:33 +0000 (15:00 -0400)
On macOS/BSD, trying to call sendto on a connected UDP socket fails
with a EISCONN error. Because the singleipconnect has already called
connect on the socket when we're trying to use it for QUIC transfers
we need to use plain send instead.

Fixes #4529
Closes https://github.com/curl/curl/pull/4533

lib/vquic/ngtcp2.c

index 8647511012bf370db21f4e30cdeeec20f07dadba..c0f9b16e3849ebb6e23c08ff3b2e5123434d5202 100644 (file)
@@ -1544,9 +1544,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
     }
 
     memcpy(&remote_addr, ps.path.remote.addr, ps.path.remote.addrlen);
-    while((sent = sendto(sockfd, out, outlen, 0,
-                         (struct sockaddr *)&remote_addr,
-                         (socklen_t)ps.path.remote.addrlen)) == -1 &&
+    while((sent = send(sockfd, out, outlen, 0)) == -1 &&
           SOCKERRNO == EINTR)
       ;
 
@@ -1556,7 +1554,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
         break;
       }
       else {
-        failf(conn->data, "sendto() returned %zd (errno %d)\n", sent,
+        failf(conn->data, "send() returned %zd (errno %d)\n", sent,
               SOCKERRNO);
         return CURLE_SEND_ERROR;
       }