]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
vquic: fix UDP_GRO struct cmsghdr data type
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Sat, 29 Jun 2024 00:55:55 +0000 (09:55 +0900)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 29 Jun 2024 20:28:22 +0000 (22:28 +0200)
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

lib/cf-socket.c
lib/vquic/vquic.c

index f58c78e029914dfade02e86e72d2bba945e60703..b815d0d17c61c780815cc477962623c44423a8c2 100644 (file)
@@ -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));
index 1ec2ba249c744a2db3b8af8ce4ab0e65ad636b85..ae5e22a3db6b4f60b137eb489ed62dfae04ee7d1 100644 (file)
@@ -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