This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Update SOMAXCONN value from Linux 5.4
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Fri, 29 Nov 2019 01:10:19 +0000
- Subject: Update SOMAXCONN value from Linux 5.4
- Ironport-sdr: S4VAsxI6lFJTo6Knr0wTwPnb2K5vi2/uBld3BpSMoLpI3VHsn4WXiVVIe8eVd1TbeYgo28HSI2 SHqjnuaqCd1xucnDZ/D/N5o/wGhr/zTCY6Odfh/44OghF6ilgbXr8jlPgxnXwA5viiZr3L495s 99AEDt7oz24zj5MolSYdd6n78xJfWYVyB9eWd9bEJqluCR6GIu84/XBbgTLZTmaL8yQrjxjsry mZsDVf4Bag97LIGDSEAfTqk3T1rOhT3qbQNRtHgFkwlijV95tN6LuL7YyjTnqVwjtuVHF8p3vw M6M=
- Ironport-sdr: LdRluSc/PCnHsVWm5bNiKrshatJLx2V7EeG+dvz7t8ZrHtaIU8H1J2iuqyVf5FVbiL7DZ0ow8S feQ45lyMyd0lEMim9hHNnqOd5pQ71mnaBnu+V3P66yjlUtbRRfL/Ci4YmasbztlC0R7dxNnkMM uFkUZ22Hl2WF4P3agYxZzCp+YT/SvxveE4nZBzcib13X3TGT0+AktXxKK5QhzS8cziOZ8ZJsT2 XZXpFX9BHyUvxtJXfoQD2onk+t1tkMLeDEoP3W6HzZE1EEUkkxZArHBRgBdNis2DbZHFkDQsbC Qi4=
Linux 5.4 changes the SOMAXCONN value from 128 to 4096 (this isn't in
a uapi header; various constants related to the kernel/userspace
interface, including this one, are in the non-uapi linux/socket.h
header).
This patch increases the value in glibc. As I understand it, it is
safe to use a higher value even with older kernels (the kernel will
simply adjust the value passed to listen to be no more than the value
supported in the kernel), and SOMAXCONN is actually only a default for
a sysctl value in the kernel that can be changed at runtime. So I
think updating the value in glibc is a reasonable and safe thing to
do.
Tested for x86_64.
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 3e88d66328..7537a7e86b 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -169,7 +169,7 @@ typedef __socklen_t socklen_t;
#define SOL_XDP 283
/* Maximum queue length specifiable by listen. */
-#define SOMAXCONN 128
+#define SOMAXCONN 4096
/* Get the definition of the macro to define the common sockaddr members. */
#include <bits/sockaddr.h>
--
Joseph S. Myers
joseph@codesourcery.com