From: Tatsuhiro Tsujikawa Date: Sat, 29 Jun 2024 00:55:55 +0000 (+0900) Subject: vquic: fix UDP_GRO struct cmsghdr data type X-Git-Tag: curl-8_9_0~156 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9feb85a1e35ca653990a5b28a3ac25150f4e60f6;p=thirdparty%2Fcurl.git vquic: fix UDP_GRO struct cmsghdr data type The data type for UDP_GRO in struct cmsghdr is int. Limit the usage of UDP_GRO to linux only because it is not portable. Closes #14056 --- diff --git a/lib/cf-socket.c b/lib/cf-socket.c index f58c78e029..b815d0d17c 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -1899,7 +1899,8 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf, #endif } -#if defined(UDP_GRO) && (defined(HAVE_SENDMMSG) || defined(HAVE_SENDMSG)) && \ +#if defined(__linux__) && defined(UDP_GRO) && \ + (defined(HAVE_SENDMMSG) || defined(HAVE_SENDMSG)) && \ ((defined(USE_NGTCP2) && defined(USE_NGHTTP3)) || defined(USE_QUICHE)) (void)setsockopt(ctx->sock, IPPROTO_UDP, UDP_GRO, &one, (socklen_t)sizeof(one)); diff --git a/lib/vquic/vquic.c b/lib/vquic/vquic.c index 1ec2ba249c..ae5e22a3db 100644 --- a/lib/vquic/vquic.c +++ b/lib/vquic/vquic.c @@ -335,8 +335,8 @@ CURLcode vquic_send_tail_split(struct Curl_cfilter *cf, struct Curl_easy *data, #if defined(HAVE_SENDMMSG) || defined(HAVE_SENDMSG) static size_t msghdr_get_udp_gro(struct msghdr *msg) { - uint16_t gso_size = 0; -#ifdef UDP_GRO + int gso_size = 0; +#if defined(__linux__) && defined(UDP_GRO) struct cmsghdr *cmsg; /* Workaround musl CMSG_NXTHDR issue */ @@ -358,7 +358,7 @@ static size_t msghdr_get_udp_gro(struct msghdr *msg) #endif (void)msg; - return gso_size; + return (size_t)gso_size; } #endif