errors_linux.go raw
1 /* SPDX-License-Identifier: MIT
2 *
3 * Copyright (C) 2017-2025 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 return serr.Err == unix.EIO
24 }
25 return false
26 }
27