Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: reflect TCP backlog size update of uint16->uint32 on Linux
The sk_max_ack_backlog was increased from uint16 to uint32 in kernel version 4.1 and above, so adopt that change to maxListenerBacklog. See torvalds/linux@becb74f Fixes #41470 Change-Id: I63a142eb28f3ac3acaca57f0903c085c6cb15a6e Reviewed-on: https://go-review.googlesource.com/c/go/+/255898 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
- Loading branch information
Showing
2 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2020 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package net | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestMaxAckBacklog(t *testing.T) { | ||
n := 196602 | ||
major, minor := kernelVersion() | ||
backlog := maxAckBacklog(n) | ||
expected := 1<<16 - 1 | ||
if major > 4 || (major == 4 && minor >= 1) { | ||
expected = n | ||
} | ||
if backlog != expected { | ||
t.Fatalf(`Kernel version: "%d.%d", sk_max_ack_backlog mismatch, got %d, want %d`, major, minor, backlog, expected) | ||
} | ||
} |