summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2016-02-02 05:57:59 +0000
committeralfred <alfred@FreeBSD.org>2016-02-02 05:57:59 +0000
commitb04e8a547e7e868f83d0fab68feb768770323303 (patch)
tree1d237b239ea69d18618f1b1b173368ea98474a31 /sys/kern
parent578b3baef33491b548d2f0443135e50d55f2b2c2 (diff)
downloadFreeBSD-src-b04e8a547e7e868f83d0fab68feb768770323303.zip
FreeBSD-src-b04e8a547e7e868f83d0fab68feb768770323303.tar.gz
Increase max allowed backlog for listen sockets
from short to int. PR: 203922 Submitted by: White Knight <white_knight@2ch.net> MFC After: 4 weeks
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_debug.c6
-rw-r--r--sys/kern/uipc_socket.c10
2 files changed, 11 insertions, 5 deletions
diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c
index caecad9..7c8b93c 100644
--- a/sys/kern/uipc_debug.c
+++ b/sys/kern/uipc_debug.c
@@ -461,9 +461,9 @@ db_print_socket(struct socket *so, const char *socketname, int indent)
db_print_indent(indent);
/* so_list skipped */
- db_printf("so_qlen: %d ", so->so_qlen);
- db_printf("so_incqlen: %d ", so->so_incqlen);
- db_printf("so_qlimit: %d ", so->so_qlimit);
+ db_printf("so_qlen: %u ", so->so_qlen);
+ db_printf("so_incqlen: %u ", so->so_incqlen);
+ db_printf("so_qlimit: %u ", so->so_qlimit);
db_printf("so_timeo: %d ", so->so_timeo);
db_printf("so_error: %d\n", so->so_error);
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 350ca3c..5d2247f 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -196,7 +196,7 @@ VNET_DEFINE(struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST + 1]);
* NB: The orginal sysctl somaxconn is still available but hidden
* to prevent confusion about the actual purpose of this number.
*/
-static int somaxconn = SOMAXCONN;
+static u_int somaxconn = SOMAXCONN;
static int
sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
@@ -209,7 +209,13 @@ sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
if (error || !req->newptr )
return (error);
- if (val < 1 || val > USHRT_MAX)
+ /*
+ * The purpose of the UINT_MAX / 3 limit, is so that the formula
+ * 3 * so_qlimit / 2
+ * below, will not overflow.
+ */
+
+ if (val < 1 || val > UINT_MAX / 3)
return (EINVAL);
somaxconn = val;
OpenPOWER on IntegriCloud