github.com/amnezia-vpn/amneziawg-go@v0.2.8/conn/errors_linux.go (about) 1 /* SPDX-License-Identifier: MIT 2 * 3 * Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved. 4 */ 5 6 package conn 7 8 import ( 9 "errors" 10 "os" 11 12 "golang.org/x/sys/unix" 13 ) 14 15 func errShouldDisableUDPGSO(err error) bool { 16 var serr *os.SyscallError 17 if errors.As(err, &serr) { 18 // EIO is returned by udp_send_skb() if the device driver does not have 19 // tx checksumming enabled, which is a hard requirement of UDP_SEGMENT. 20 // See: 21 // https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man7/udp.7?id=806eabd74910447f21005160e90957bde4db0183#n228 22 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv4/udp.c?h=v6.2&id=c9c3395d5e3dcc6daee66c6908354d47bf98cb0c#n942 23 // If gso_size + udp + ip headers > fragment size EINVAL is returned. 24 // It occurs when the peer mtu + wg headers is greater than path mtu. 25 return serr.Err == unix.EIO || serr.Err == unix.EINVAL 26 } 27 return false 28 }