Maximum segment size fixes (#25)

* Fixed MSS sent in SYN and SYN-ACK

* Fixed tests
This commit is contained in:
ddirect
2026-01-25 07:37:17 +02:00
committed by GitHub
parent 7edaea1093
commit 91fea9ae58
5 changed files with 11 additions and 6 deletions
+2 -1
View File
@@ -140,7 +140,8 @@ func TestTCPListener_ConcurrentEcho(t *testing.T) {
func kernelLoop(ctx context.Context, server *StackAsync, clients []StackAsync) {
const MTU = 1500
buf := make([]byte, MTU)
const carrierDataSize = MTU + 14
buf := make([]byte, carrierDataSize)
rng := rand.New(rand.NewSource(1)) // Seed 1 for deterministic but randomized order
order := make([]int, len(clients))
for i := range order {
+2 -1
View File
@@ -47,7 +47,8 @@ func TestDNS_QueryReceivesAnswer(t *testing.T) {
}
// Client sends DNS query.
var buf [MTU]byte
const carrierDataSize = MTU + 14
var buf [carrierDataSize]byte
n, err := client.Encapsulate(buf[:], -1, 0)
if err != nil {
t.Fatal("client Encapsulate failed:", err)
+2 -1
View File
@@ -217,9 +217,10 @@ func newTCPStacks(t *testing.T, randSeed int64, mtu int) (s1, s2 *StackAsync, c1
}
func testerFrom(t *testing.T, mtu int) *tester {
carrierDataSize := mtu + 14
return &tester{
t: t,
buf: make([]byte, mtu),
buf: make([]byte, carrierDataSize),
}
}