mirror of https://github.com/tailscale/tailscale/
portlist,tstest: skip tests on kernels with /proc/net/tcp regression
Linux kernel versions 6.6.102-104 and 6.12.42-45 have a regression in /proc/net/tcp that causes seek operations to fail with "illegal seek". This breaks portlist tests on these kernels. Add kernel version detection for Linux systems and a SkipOnKernelVersions helper to tstest. Use it to skip affected portlist tests on the broken kernel versions. Thanks to philiptaron for the list of kernels with the issue and fix. Updates #16966 Signed-off-by: Andrew Dunham <andrew@tailscale.com>alexc/better-localbackend-logging
parent
1ccece0f78
commit
16587746ed
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
//go:build linux
|
||||||
|
|
||||||
|
package tstest
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
)
|
||||||
|
|
||||||
|
// KernelVersion returns the major, minor, and patch version of the Linux kernel.
|
||||||
|
// It returns (0, 0, 0) if the version cannot be determined.
|
||||||
|
func KernelVersion() (major, minor, patch int) {
|
||||||
|
var uname unix.Utsname
|
||||||
|
if err := unix.Uname(&uname); err != nil {
|
||||||
|
return 0, 0, 0
|
||||||
|
}
|
||||||
|
release := unix.ByteSliceToString(uname.Release[:])
|
||||||
|
|
||||||
|
// Parse version string (e.g., "5.15.0-...")
|
||||||
|
parts := strings.Split(release, ".")
|
||||||
|
if len(parts) < 3 {
|
||||||
|
return 0, 0, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
major, err := strconv.Atoi(parts[0])
|
||||||
|
if err != nil {
|
||||||
|
return 0, 0, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
minor, err = strconv.Atoi(parts[1])
|
||||||
|
if err != nil {
|
||||||
|
return 0, 0, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch version may have additional info after a hyphen (e.g., "0-76-generic")
|
||||||
|
// Extract just the numeric part before any hyphen
|
||||||
|
patchStr, _, _ := strings.Cut(parts[2], "-")
|
||||||
|
|
||||||
|
patch, err = strconv.Atoi(patchStr)
|
||||||
|
if err != nil {
|
||||||
|
return 0, 0, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return major, minor, patch
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
//go:build !linux
|
||||||
|
|
||||||
|
package tstest
|
||||||
|
|
||||||
|
// KernelVersion returns (0, 0, 0) on unsupported platforms.
|
||||||
|
func KernelVersion() (major, minor, patch int) {
|
||||||
|
return 0, 0, 0
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue