]> Cypherpunks repositories - gostls13.git/commit
net: never use backlog > 65535
authorRuss Cox <rsc@golang.org>
Tue, 12 Mar 2013 05:48:48 +0000 (01:48 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 12 Mar 2013 05:48:48 +0000 (01:48 -0400)
commite64f3f211ac03f270a2db476e01b34fd1d1c5301
treebd2078f31bffba75dea8c13bc1c3dd8d763d1f45
parent019754ed4036f9ddc7514c78548fe77a606464db
net: never use backlog > 65535

The system call takes an int, but the kernel stores it in a uint16.
At least one Linux system sets /proc/sys/net/core/somaxconn
to 262144, which ends up being 0 in the uint16. Avoid being tricked.

FreeBSD sources also store the backlog in a uint16.
Assume the problem is systemic and fix it everywhere.

Fixes #5030.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7480046
src/pkg/net/sock_bsd.go
src/pkg/net/sock_linux.go
src/pkg/net/sock_windows.go