From f4758cd524907a921853c29a575fb78dcf267e54 Mon Sep 17 00:00:00 2001 From: Ethan Everett <84542561+eeverettrbx@users.noreply.github.com> Date: Mon, 8 Sep 2025 16:50:58 -0700 Subject: [PATCH] quic: ignore EMSGSIZE on receive Some OSes (Linux, macOS, more?) will generate an EMSGSIZE socket error on the next recv all after receiving an ICMP Packet Too Big on an unconnected UDP socket. These can be safely ignored as QUIC's DPLPMTUD uses MTU probes that do not rely on receiving ICMP packets. Closes #18505 --- lib/vquic/vquic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vquic/vquic.c b/lib/vquic/vquic.c index 647450a29b..3a0ac87238 100644 --- a/lib/vquic/vquic.c +++ b/lib/vquic/vquic.c @@ -404,7 +404,7 @@ static CURLcode recvmmsg_packets(struct Curl_cfilter *cf, } while((mcount = recvmmsg(qctx->sockfd, mmsg, n, 0, NULL)) == -1 && - SOCKERRNO == SOCKEINTR) + (SOCKERRNO == SOCKEINTR || SOCKERRNO == SOCKEMSGSIZE)) ; if(mcount == -1) { if(SOCKERRNO == EAGAIN || SOCKERRNO == SOCKEWOULDBLOCK) { @@ -420,7 +420,7 @@ static CURLcode recvmmsg_packets(struct Curl_cfilter *cf, goto out; } Curl_strerror(SOCKERRNO, errstr, sizeof(errstr)); - failf(data, "QUIC: recvmsg() unexpectedly returned %d (errno=%d; %s)", + failf(data, "QUIC: recvmmsg() unexpectedly returned %d (errno=%d; %s)", mcount, SOCKERRNO, errstr); result = CURLE_RECV_ERROR; goto out; @@ -497,7 +497,7 @@ static CURLcode recvmsg_packets(struct Curl_cfilter *cf, msg.msg_controllen = sizeof(msg_ctrl); while((nread = recvmsg(qctx->sockfd, &msg, 0)) == -1 && - SOCKERRNO == SOCKEINTR) + (SOCKERRNO == SOCKEINTR || SOCKERRNO == SOCKEMSGSIZE)) ; if(nread == -1) { if(SOCKERRNO == EAGAIN || SOCKERRNO == SOCKEWOULDBLOCK) { @@ -571,7 +571,7 @@ static CURLcode recvfrom_packets(struct Curl_cfilter *cf, while((nread = recvfrom(qctx->sockfd, (char *)buf, bufsize, 0, (struct sockaddr *)&remote_addr, &remote_addrlen)) == -1 && - SOCKERRNO == SOCKEINTR) + (SOCKERRNO == SOCKEINTR || SOCKERRNO == SOCKEMSGSIZE)) ; if(nread == -1) { if(SOCKERRNO == EAGAIN || SOCKERRNO == SOCKEWOULDBLOCK) {