summaryrefslogtreecommitdiff
path: root/include/linux/socket.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-10-30 19:36:20 +0300
committerDavid S. Miller <davem@davemloft.net>2019-11-01 00:01:40 +0300
commit19f92a030ca6d772ab44b22ee6a01378a8cb32d4 (patch)
tree29ef4d4bfa78c7b0e21b4adeb0ffc27691021e75 /include/linux/socket.h
parent6d6f0383b697f004c65823c2b64240912f18515d (diff)
downloadlinux-19f92a030ca6d772ab44b22ee6a01378a8cb32d4.tar.xz
net: increase SOMAXCONN to 4096
SOMAXCONN is /proc/sys/net/core/somaxconn default value. It has been defined as 128 more than 20 years ago. Since it caps the listen() backlog values, the very small value has caused numerous problems over the years, and many people had to raise it on their hosts after beeing hit by problems. Google has been using 1024 for at least 15 years, and we increased this to 4096 after TCP listener rework has been completed, more than 4 years ago. We got no complain of this change breaking any legacy application. Many applications indeed setup a TCP listener with listen(fd, -1); meaning they let the system select the backlog. Raising SOMAXCONN lowers chance of the port being unavailable under even small SYNFLOOD attack, and reduces possibilities of side channel vulnerabilities. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willy Tarreau <w@1wt.eu> Cc: Yue Cao <ycao009@ucr.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/socket.h')
-rw-r--r--include/linux/socket.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/socket.h b/include/linux/socket.h
index fc0bed59fc84..4049d9755cf1 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -263,7 +263,7 @@ struct ucred {
#define PF_MAX AF_MAX
/* Maximum queue length specifiable by listen. */
-#define SOMAXCONN 128
+#define SOMAXCONN 4096
/* Flags we can use with send/ and recv.
Added those for 1003.1g not all are supported yet