From f502ec3fad116d11109529bcf283e464f4822c18 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 21 Oct 2023 19:06:38 +0200 Subject: [PATCH] conn: fix cmsg data padding calculation for gso Signed-off-by: Jason A. Donenfeld --- conn/gso_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conn/gso_linux.go b/conn/gso_linux.go index b8599ce..8596b29 100644 --- a/conn/gso_linux.go +++ b/conn/gso_linux.go @@ -56,7 +56,7 @@ func setGSOSize(control *[]byte, gsoSize uint16) { hdr.Level = unix.SOL_UDP hdr.Type = unix.UDP_SEGMENT hdr.SetLen(unix.CmsgLen(sizeOfGSOData)) - copy((gsoControl)[unix.SizeofCmsghdr:], unsafe.Slice((*byte)(unsafe.Pointer(&gsoSize)), sizeOfGSOData)) + copy((gsoControl)[unix.CmsgLen(0):], unsafe.Slice((*byte)(unsafe.Pointer(&gsoSize)), sizeOfGSOData)) *control = (*control)[:existingLen+space] }