Commit 217e86f8 authored by Nickolai Zeldovich's avatar Nickolai Zeldovich Committed by Arnaldo Carvalho de Melo

[NET]: Allow SOMAXCONN to be adjusted via sysctl.

parent b46f1cf2
...@@ -217,7 +217,8 @@ enum ...@@ -217,7 +217,8 @@ enum
NET_CORE_NO_CONG=14, NET_CORE_NO_CONG=14,
NET_CORE_LO_CONG=15, NET_CORE_LO_CONG=15,
NET_CORE_MOD_CONG=16, NET_CORE_MOD_CONG=16,
NET_CORE_DEV_WEIGHT=17 NET_CORE_DEV_WEIGHT=17,
NET_CORE_SOMAXCONN=18,
}; };
/* /proc/sys/net/ethernet */ /* /proc/sys/net/ethernet */
......
...@@ -29,6 +29,7 @@ extern __u32 sysctl_rmem_default; ...@@ -29,6 +29,7 @@ extern __u32 sysctl_rmem_default;
extern int sysctl_core_destroy_delay; extern int sysctl_core_destroy_delay;
extern int sysctl_optmem_max; extern int sysctl_optmem_max;
extern int sysctl_somaxconn;
#ifdef CONFIG_NET_DIVERT #ifdef CONFIG_NET_DIVERT
extern char sysctl_divert_version[]; extern char sysctl_divert_version[];
...@@ -174,6 +175,14 @@ ctl_table core_table[] = { ...@@ -174,6 +175,14 @@ ctl_table core_table[] = {
}, },
#endif /* CONFIG_NET_DIVERT */ #endif /* CONFIG_NET_DIVERT */
#endif /* CONFIG_NET */ #endif /* CONFIG_NET */
{
.ctl_name = NET_CORE_SOMAXCONN,
.procname = "somaxconn",
.data = &sysctl_somaxconn,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
},
{ .ctl_name = 0 } { .ctl_name = 0 }
}; };
......
...@@ -1206,14 +1206,16 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen) ...@@ -1206,14 +1206,16 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
* ready for listening. * ready for listening.
*/ */
int sysctl_somaxconn = SOMAXCONN;
asmlinkage long sys_listen(int fd, int backlog) asmlinkage long sys_listen(int fd, int backlog)
{ {
struct socket *sock; struct socket *sock;
int err; int err;
if ((sock = sockfd_lookup(fd, &err)) != NULL) { if ((sock = sockfd_lookup(fd, &err)) != NULL) {
if ((unsigned) backlog > SOMAXCONN) if ((unsigned) backlog > sysctl_somaxconn)
backlog = SOMAXCONN; backlog = sysctl_somaxconn;
err = security_socket_listen(sock, backlog); err = security_socket_listen(sock, backlog);
if (err) { if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment