summaryrefslogtreecommitdiffstats
path: root/crypto/bio/bss_dgram.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-09-08 15:26:40 +0100
committerHugo Landau <hlandau@openssl.org>2023-09-11 07:43:26 +0100
commit5d96106c43d5b4e2d97406e5d3934323ae5bd1b4 (patch)
treeb06ebaa829c97d7e28de65d05a40a270cc546419 /crypto/bio/bss_dgram.c
parentc499cbc3239e3ac93fa5acf85cec7ea7df116518 (diff)
Fix a build failure where recvmmsg is available but not sendmmsg
Some old glibc versions have recvmmsg but not sendmmsg. We require both to use that functionality. Introduce a test to check we have a sufficiently recent version of glibc. Fixes #22021 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/22036)
Diffstat (limited to 'crypto/bio/bss_dgram.c')
-rw-r--r--crypto/bio/bss_dgram.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index b0c08b362a..3f57de539f 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -50,6 +50,17 @@
# define M_METHOD_RECVFROM 3
# define M_METHOD_WSARECVMSG 4
+# if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+# if !(__GLIBC_PREREQ(2, 14))
+# undef NO_RECVMMSG
+ /*
+ * Some old glibc versions may have recvmmsg and MSG_WAITFORONE flag, but
+ * not sendmmsg. We need both so force this to be disabled on these old
+ * versions
+ */
+# define NO_RECVMMSG
+# endif
+# endif
# if !defined(M_METHOD)
# if defined(OPENSSL_SYS_WINDOWS) && defined(BIO_HAVE_WSAMSG) && !defined(NO_WSARECVMSG)
# define M_METHOD M_METHOD_WSARECVMSG