mirror of
https://github.com/tailscale/tailscale.git
synced 2026-12-04 23:52:20 -08:00
tstest/natlab/vmtest: add buggy Linux 7.0 gokrazy repro
Add a GokrazyBuggyLinux70 VM image that boots the Linux 7.0 kernel package from github.com/tailscale/gokrazy-kernel-buggy-linux-7_0 under QEMU q35 with the emulated igb NIC. The image lets vmtest exercise the UDP GSO regression independently of the host kernel version. Add TTA helpers to report ethtool netdev features and to run a TCP bulk-send probe between VMs. The diagnostic test verifies that QEMU's igb path exposes tx-udp-segmentation and tx-gso-partial. The mitigation test boots a buggy gokrazy node and a regular gokrazy node, demonstrates that a TCP transfer stalls without never-gso-equal-tail, then applies the node attribute and verifies the same transfer succeeds. Updates #19777 Change-Id: I21f1e5dc85d556eb514ffa361ee39aad142b7f2b Signed-off-by: Brad Fitzpatrick <[email protected]>
This commit is contained in:
1 parent
5d935c8900
commit
5e33c4125f
17 files changed
+684
-76
No files matched your search
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/safchain/ethtool"
|
||||
)
|
||||
|
||||
type netdevFeatureReport struct {
|
||||
Name string `json:"name"`
|
||||
Flags net.Flags `json:"flags"`
|
||||
Driver string `json:"driver,omitempty"`
|
||||
BusInfo string `json:"busInfo,omitempty"`
|
||||
Features map[string]bool `json:"features,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
func handleNetdevFeatures(w http.ResponseWriter, r *http.Request) {
|
||||
eth, err := ethtool.NewEthtool()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
defer eth.Close()
|
||||
|
||||
ifaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
var out []netdevFeatureReport
|
||||
for _, iface := range ifaces {
|
||||
if iface.Flags&net.FlagLoopback != 0 {
|
||||
continue
|
||||
}
|
||||
rep := netdevFeatureReport{
|
||||
Name: iface.Name,
|
||||
Flags: iface.Flags,
|
||||
}
|
||||
if di, err := eth.DriverInfo(iface.Name); err == nil {
|
||||
rep.Driver = di.Driver
|
||||
rep.BusInfo = di.BusInfo
|
||||
}
|
||||
if features, err := eth.Features(iface.Name); err == nil {
|
||||
rep.Features = features
|
||||
} else {
|
||||
rep.Error = err.Error()
|
||||
}
|
||||
out = append(out, rep)
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(out)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !linux
|
||||
|
||||
package main
|
||||
|
||||
import "net/http"
|
||||
|
||||
func handleNetdevFeatures(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "netdev-features not supported on this platform", http.StatusNotImplemented)
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -383,6 +384,94 @@ func main() {
|
||||
w.WriteHeader(resp.StatusCode)
|
||||
io.Copy(w, resp.Body)
|
||||
})
|
||||
ttaMux.HandleFunc("/start-tcp-sink", func(w http.ResponseWriter, r *http.Request) {
|
||||
port := r.URL.Query().Get("port")
|
||||
if port == "" {
|
||||
http.Error(w, "missing port", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
ln, err := net.Listen("tcp", ":"+port)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
c, err := ln.Accept()
|
||||
if err != nil {
|
||||
log.Printf("tcp sink on %s stopped: %v", ln.Addr(), err)
|
||||
return
|
||||
}
|
||||
go func(c net.Conn) {
|
||||
defer c.Close()
|
||||
n, err := io.Copy(io.Discard, c)
|
||||
if err != nil {
|
||||
log.Printf("tcp sink read from %s after %d bytes: %v", c.RemoteAddr(), n, err)
|
||||
}
|
||||
}(c)
|
||||
}
|
||||
}()
|
||||
fmt.Fprintf(w, "OK %s\n", ln.Addr())
|
||||
})
|
||||
ttaMux.HandleFunc("/tcp-send", func(w http.ResponseWriter, r *http.Request) {
|
||||
q := r.URL.Query()
|
||||
target := q.Get("target")
|
||||
if target == "" {
|
||||
http.Error(w, "missing target", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
total, err := strconv.ParseInt(q.Get("bytes"), 10, 64)
|
||||
if err != nil || total <= 0 {
|
||||
http.Error(w, "invalid bytes", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
chunk, err := strconv.Atoi(q.Get("chunk"))
|
||||
if err != nil || chunk <= 0 || chunk > 1<<20 {
|
||||
http.Error(w, "invalid chunk", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
timeout := 30 * time.Second
|
||||
if v := q.Get("timeout"); v != "" {
|
||||
timeout, err = time.ParseDuration(v)
|
||||
if err != nil {
|
||||
http.Error(w, "invalid timeout", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(r.Context(), timeout)
|
||||
defer cancel()
|
||||
var d net.Dialer
|
||||
c, err := d.DialContext(ctx, "tcp", target)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadGateway)
|
||||
return
|
||||
}
|
||||
defer c.Close()
|
||||
buf := make([]byte, chunk)
|
||||
if _, err := rand.Read(buf); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
deadline, _ := ctx.Deadline()
|
||||
start := time.Now()
|
||||
var sent int64
|
||||
for sent < total {
|
||||
if err := c.SetWriteDeadline(deadline); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
n := min(int64(len(buf)), total-sent)
|
||||
wrote, err := c.Write(buf[:n])
|
||||
sent += int64(wrote)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("write after %d/%d bytes: %v", sent, total, err), http.StatusBadGateway)
|
||||
return
|
||||
}
|
||||
}
|
||||
elapsed := time.Since(start)
|
||||
mbps := float64(sent*8) / elapsed.Seconds() / 1e6
|
||||
fmt.Fprintf(w, "OK sent=%d elapsed=%s mbps=%.1f target=%s\n", sent, elapsed, mbps, target)
|
||||
})
|
||||
ttaMux.HandleFunc("/fw", addFirewallHandler)
|
||||
ttaMux.HandleFunc("/wg-server-up", func(w http.ResponseWriter, r *http.Request) {
|
||||
if wgServerUp == nil {
|
||||
@@ -409,6 +498,7 @@ func main() {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.Write(logBuf.buf.Bytes())
|
||||
})
|
||||
ttaMux.HandleFunc("/netdev-features", handleNetdevFeatures)
|
||||
go hs.Serve(chanListener(conns))
|
||||
|
||||
// For doing agent operations locally from gokrazy:
|
||||
|
||||
@@ -164,4 +164,4 @@
|
||||
});
|
||||
};
|
||||
}
|
||||
# nix-direnv cache busting line: sha256-pXdOQRF8EpZ+fFYhsEgAT04k3h88gdOZ42e0AMeV4Wc=
|
||||
# nix-direnv cache busting line: sha256-GT74VncdnlHQS8aExeOB4oJrGXAkllRBcfNkvAmMjt0=
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
"sri": "sha256-uskKJHUzzIQ74VuzoQKrlz+6tCY/YKnv+BjJduPwt6Q="
|
||||
},
|
||||
"vendor": {
|
||||
"goModSum": "sha256-nI9Dzn2PeLKj9mnskoHhwZNix+6H7pA4nlB75sDAn1U=",
|
||||
"sri": "sha256-pXdOQRF8EpZ+fFYhsEgAT04k3h88gdOZ42e0AMeV4Wc="
|
||||
"goModSum": "sha256-B2VqJxzyk6flpO/x1z90/gTR2Epf9QzgE4qmGfgS61Y=",
|
||||
"sri": "sha256-GT74VncdnlHQS8aExeOB4oJrGXAkllRBcfNkvAmMjt0="
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,7 @@ require (
|
||||
github.com/tailscale/gliderssh v0.3.4-0.20260330083525-c1389c70ff89
|
||||
github.com/tailscale/goexpect v0.0.0-20210902213824-6e8c725cea41
|
||||
github.com/tailscale/gokrazy-kernel v0.0.0-20240728225134-3d23beabda2e
|
||||
github.com/tailscale/gokrazy-kernel-buggy-linux-7_0 v0.0.0-20260529210628-b94e221beeb4
|
||||
github.com/tailscale/golang-x-crypto v0.0.0-20250404221719-a5573b049869
|
||||
github.com/tailscale/hujson v0.0.0-20260302212456-ecc657c15afd
|
||||
github.com/tailscale/mkctr v0.0.0-20260107121656-ea857e3e500b
|
||||
|
||||
@@ -1157,6 +1157,8 @@ github.com/tailscale/goexpect v0.0.0-20210902213824-6e8c725cea41 h1:/V2rCMMWcsjY
|
||||
github.com/tailscale/goexpect v0.0.0-20210902213824-6e8c725cea41/go.mod h1:/roCdA6gg6lQyw/Oz6gIIGu3ggJKYhF+WC/AQReE5XQ=
|
||||
github.com/tailscale/gokrazy-kernel v0.0.0-20240728225134-3d23beabda2e h1:tyUUgeRPGHjCZWycRnhdx8Lx9DRkjl3WsVUxYMrVBOw=
|
||||
github.com/tailscale/gokrazy-kernel v0.0.0-20240728225134-3d23beabda2e/go.mod h1:7Mth+m9bq2IHusSsexMNyupHWPL8RxwOuSvBlSGtgDY=
|
||||
github.com/tailscale/gokrazy-kernel-buggy-linux-7_0 v0.0.0-20260529210628-b94e221beeb4 h1:nX/Nm4rZZqRPZF3yipQxnIZ+NST9ja8vYZz4Ir/porA=
|
||||
github.com/tailscale/gokrazy-kernel-buggy-linux-7_0 v0.0.0-20260529210628-b94e221beeb4/go.mod h1:NvpqILDHLJNybqbx3tHdleclI1m0hrueDlYPqgyNluY=
|
||||
github.com/tailscale/golang-x-crypto v0.0.0-20250404221719-a5573b049869 h1:SRL6irQkKGQKKLzvQP/ke/2ZuB7Py5+XuqtOgSj+iMM=
|
||||
github.com/tailscale/golang-x-crypto v0.0.0-20250404221719-a5573b049869/go.mod h1:ikbF+YT089eInTp9f2vmvy4+ZVnW5hzX1q2WknxSprQ=
|
||||
github.com/tailscale/hujson v0.0.0-20260302212456-ecc657c15afd h1:Rf9uhF1+VJ7ZHqxrG8pJ6YacmHvVCmByDmGbAWCc/gA=
|
||||
|
||||
@@ -12,6 +12,12 @@ natlab:
|
||||
go run build.go --build --app=natlabapp
|
||||
qemu-img convert -O qcow2 natlabapp.img natlabapp.qcow2
|
||||
|
||||
# For natlab integration tests that need the Linux 7.0 UDP GSO bug.
|
||||
# Requires ../github.com/tailscale/gokrazy-kernel-buggy-linux-7_0/vmlinuz.
|
||||
natlab-buggy-linux-7_0:
|
||||
go run build.go --build --app=natlabapp.buggy-linux-7_0
|
||||
qemu-img convert -O qcow2 natlabapp.buggy-linux-7_0.img natlabapp.buggy-linux-7_0.qcow2
|
||||
|
||||
# For natlab integration tests on macOS arm64:
|
||||
natlab-arm64:
|
||||
go run build.go --build --app=natlabapp.arm64
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# NATLab Linux test Appliance
|
||||
|
||||
This is the definition of the NATLab Linux test appliance image that boots a
|
||||
buggy Linux 7.0 kernel for UDP GSO mitigation tests.
|
||||
|
||||
It is similar to ../natlabapp, but uses the local
|
||||
github.com/tailscale/gokrazy-kernel-buggy-linux-7_0 kernel package and is
|
||||
booted by vmtest with QEMU's `igb` NIC.
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"Hostname": "natlabapp",
|
||||
"Update": {
|
||||
"NoPassword": true
|
||||
},
|
||||
"SerialConsole": "ttyS0,115200",
|
||||
"GokrazyPackages": [
|
||||
"github.com/gokrazy/gokrazy/cmd/dhcp"
|
||||
],
|
||||
"Packages": [
|
||||
"github.com/gokrazy/serial-busybox",
|
||||
"tailscale.com/cmd/tailscale",
|
||||
"tailscale.com/cmd/tailscaled",
|
||||
"tailscale.com/cmd/tta"
|
||||
],
|
||||
"PackageConfig": {
|
||||
"tailscale.com/cmd/tailscale": {
|
||||
"ExtraFilePaths": {
|
||||
"/usr": "usr-dir"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Environment": [
|
||||
"GOOS=linux",
|
||||
"GOARCH=amd64"
|
||||
],
|
||||
"KernelPackage": "github.com/tailscale/gokrazy-kernel-buggy-linux-7_0",
|
||||
"FirmwarePackage": "",
|
||||
"EEPROMPackage": "",
|
||||
"InternalCompatibilityFlags": {
|
||||
"InitImportPath": "github.com/tailscale/ts-gokrazy/gokrazyinit"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build for_go_mod_tidy_only
|
||||
|
||||
package gokrazydeps
|
||||
|
||||
import (
|
||||
_ "github.com/gokrazy/gokrazy/cmd/dhcp"
|
||||
_ "github.com/gokrazy/serial-busybox"
|
||||
_ "github.com/tailscale/gokrazy-kernel-buggy-linux-7_0"
|
||||
_ "github.com/tailscale/ts-gokrazy/gokrazyinit"
|
||||
_ "tailscale.com/cmd/tailscale"
|
||||
_ "tailscale.com/cmd/tailscaled"
|
||||
_ "tailscale.com/cmd/tta"
|
||||
)
|
||||
Binary file not shown.
@@ -16,4 +16,4 @@
|
||||
) {
|
||||
src = ./.;
|
||||
}).shellNix
|
||||
# nix-direnv cache busting line: sha256-pXdOQRF8EpZ+fFYhsEgAT04k3h88gdOZ42e0AMeV4Wc=
|
||||
# nix-direnv cache busting line: sha256-GT74VncdnlHQS8aExeOB4oJrGXAkllRBcfNkvAmMjt0=
|
||||
@@ -21,12 +21,16 @@ import (
|
||||
|
||||
// OSImage describes a VM operating system image.
|
||||
type OSImage struct {
|
||||
Name string
|
||||
URL string // download URL for the cloud image
|
||||
SHA256 string // expected SHA256 hash of the image (of the final qcow2, after any decompression)
|
||||
MemoryMB int // RAM for the VM
|
||||
IsGokrazy bool // true for gokrazy images (different QEMU setup)
|
||||
IsMacOS bool // true for macOS images (launched via tailmac, not QEMU)
|
||||
Name string
|
||||
URL string // download URL for the cloud image
|
||||
SHA256 string // expected SHA256 hash of the image (of the final qcow2, after any decompression)
|
||||
MemoryMB int // RAM for the VM
|
||||
IsGokrazy bool // true for gokrazy images (different QEMU setup)
|
||||
IsMacOS bool // true for macOS images (launched via tailmac, not QEMU)
|
||||
GokrazyApp string // gokrazy app directory/image basename; defaults to "natlabapp"
|
||||
GokrazyKernelPackage string // gokrazy kernel module path; defaults to github.com/tailscale/gokrazy-kernel
|
||||
GokrazyMachine string // QEMU machine type; defaults to microvm
|
||||
GokrazyNetDevice string // QEMU NIC device; defaults to virtio-net-device
|
||||
}
|
||||
|
||||
// GOOS returns the Go OS name for this image.
|
||||
@@ -51,12 +55,58 @@ func (img OSImage) GOARCH() string {
|
||||
return "amd64"
|
||||
}
|
||||
|
||||
func (img OSImage) gokrazyApp() string {
|
||||
if img.GokrazyApp != "" {
|
||||
return img.GokrazyApp
|
||||
}
|
||||
return "natlabapp"
|
||||
}
|
||||
|
||||
func (img OSImage) gokrazyKernelPackage() string {
|
||||
if img.GokrazyKernelPackage != "" {
|
||||
return img.GokrazyKernelPackage
|
||||
}
|
||||
return "github.com/tailscale/gokrazy-kernel"
|
||||
}
|
||||
|
||||
func (img OSImage) gokrazyMachine() string {
|
||||
if img.GokrazyMachine != "" {
|
||||
return img.GokrazyMachine
|
||||
}
|
||||
return "microvm"
|
||||
}
|
||||
|
||||
func (img OSImage) gokrazyNetDevice() string {
|
||||
if img.GokrazyNetDevice != "" {
|
||||
return img.GokrazyNetDevice
|
||||
}
|
||||
return "virtio-net-device"
|
||||
}
|
||||
|
||||
var (
|
||||
// Gokrazy is a minimal Tailscale appliance image built from the gokrazy/natlabapp directory.
|
||||
Gokrazy = OSImage{
|
||||
Name: "gokrazy",
|
||||
IsGokrazy: true,
|
||||
MemoryMB: 384,
|
||||
Name: "gokrazy",
|
||||
IsGokrazy: true,
|
||||
MemoryMB: 384,
|
||||
GokrazyApp: "natlabapp",
|
||||
GokrazyKernelPackage: "github.com/tailscale/gokrazy-kernel",
|
||||
GokrazyMachine: "microvm",
|
||||
GokrazyNetDevice: "virtio-net-device",
|
||||
}
|
||||
|
||||
// GokrazyBuggyLinux70 is a natlab gokrazy appliance that boots a Linux 7.0
|
||||
// kernel with the UDP GSO bug from tailscale/tailscale#19777. It uses QEMU's
|
||||
// emulated Intel igb NIC rather than virtio-net so the guest driver exposes
|
||||
// NETIF_F_GSO_UDP_L4 and NETIF_F_GSO_PARTIAL.
|
||||
GokrazyBuggyLinux70 = OSImage{
|
||||
Name: "gokrazy-buggy-linux-7.0",
|
||||
IsGokrazy: true,
|
||||
MemoryMB: 384,
|
||||
GokrazyApp: "natlabapp.buggy-linux-7_0",
|
||||
GokrazyKernelPackage: "github.com/tailscale/gokrazy-kernel-buggy-linux-7_0",
|
||||
GokrazyMachine: "q35",
|
||||
GokrazyNetDevice: "igb",
|
||||
}
|
||||
|
||||
// Ubuntu2404 is Ubuntu 24.04 LTS (Noble Numbat) cloud image.
|
||||
|
||||
@@ -41,20 +41,14 @@ func qemuAccelArgs() []string {
|
||||
type gokrazyPlatform struct{}
|
||||
|
||||
func (gokrazyPlatform) planSteps(e *Env, n *Node) {
|
||||
e.Step("Build gokrazy image")
|
||||
e.Step("Build gokrazy image: " + n.os.Name)
|
||||
e.Step("Launch QEMU: " + n.name)
|
||||
}
|
||||
|
||||
func (gokrazyPlatform) boot(ctx context.Context, e *Env, n *Node) error {
|
||||
e.gokrazyOnce.Do(func() {
|
||||
step := e.Step("Build gokrazy image")
|
||||
step.Begin()
|
||||
if err := e.ensureGokrazy(ctx); err != nil {
|
||||
step.End(err)
|
||||
e.t.Fatalf("ensureGokrazy: %v", err)
|
||||
}
|
||||
step.End(nil)
|
||||
})
|
||||
if _, err := e.ensureGokrazy(ctx, n.os); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
e.ensureQEMUSocket()
|
||||
|
||||
@@ -101,8 +95,12 @@ func (qemuCloudPlatform) boot(ctx context.Context, e *Env, n *Node) error {
|
||||
// startGokrazyQEMU launches a QEMU process for a gokrazy node.
|
||||
// This follows the same pattern as tstest/integration/nat/nat_test.go.
|
||||
func (e *Env) startGokrazyQEMU(n *Node) error {
|
||||
gb, err := e.gokrazyBuild(n.os)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
disk := filepath.Join(e.tempDir, fmt.Sprintf("%s.qcow2", n.name))
|
||||
if err := createOverlay(e.gokrazyBase, disk); err != nil {
|
||||
if err := createOverlay(gb.base, disk); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -118,27 +116,49 @@ func (e *Env) startGokrazyQEMU(n *Node) error {
|
||||
|
||||
logPath := filepath.Join(e.tempDir, n.name+".log")
|
||||
|
||||
console := "hvc0"
|
||||
extraKernelArgs := "pci=off nousb "
|
||||
if n.os.gokrazyMachine() != "microvm" {
|
||||
console = "ttyS0"
|
||||
extraKernelArgs = ""
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"-M", "microvm,isa-serial=off",
|
||||
"-m", fmt.Sprintf("%dM", n.os.MemoryMB),
|
||||
"-nodefaults", "-no-user-config", "-nographic",
|
||||
"-kernel", e.gokrazyKernel,
|
||||
"-append", "console=hvc0 root=PARTUUID=60c24cc1-f3f9-427a-8199-76baa2d60001/PARTNROFF=1 ro init=/gokrazy/init panic=10 oops=panic pci=off nousb tsc=unstable clocksource=hpet gokrazy.remote_syslog.target=" + sysLogAddr + " tailscale-tta=1" + envBuf.String(),
|
||||
"-drive", "id=blk0,file=" + disk + ",format=qcow2",
|
||||
"-device", "virtio-blk-device,drive=blk0",
|
||||
"-device", "virtio-serial-device",
|
||||
"-device", "virtio-rng-device",
|
||||
"-chardev", "file,id=virtiocon0,path=" + logPath,
|
||||
"-device", "virtconsole,chardev=virtiocon0",
|
||||
"-kernel", gb.kernel,
|
||||
"-append", "console=" + console + " root=PARTUUID=60c24cc1-f3f9-427a-8199-76baa2d60001/PARTNROFF=1 ro init=/gokrazy/init panic=10 oops=panic " + extraKernelArgs + "tsc=unstable clocksource=hpet gokrazy.remote_syslog.target=" + sysLogAddr + " tailscale-tta=1" + envBuf.String(),
|
||||
}
|
||||
if n.os.gokrazyMachine() == "microvm" {
|
||||
args = append(args,
|
||||
"-M", "microvm,isa-serial=off",
|
||||
"-drive", "id=blk0,file="+disk+",format=qcow2",
|
||||
"-device", "virtio-blk-device,drive=blk0",
|
||||
"-device", "virtio-serial-device",
|
||||
"-device", "virtio-rng-device",
|
||||
"-chardev", "file,id=virtiocon0,path="+logPath,
|
||||
"-device", "virtconsole,chardev=virtiocon0",
|
||||
)
|
||||
} else {
|
||||
args = append(args,
|
||||
"-M", n.os.gokrazyMachine(),
|
||||
"-drive", "file="+disk+",if=virtio,format=qcow2",
|
||||
"-serial", "file:"+logPath,
|
||||
"-device", "virtio-rng-pci",
|
||||
)
|
||||
}
|
||||
|
||||
// Add network devices — one per NIC.
|
||||
for i := range n.vnetNode.NumNICs() {
|
||||
mac := n.vnetNode.NICMac(i)
|
||||
netdevID := fmt.Sprintf("net%d", i)
|
||||
device := n.os.gokrazyNetDevice()
|
||||
if device != "virtio-net-device" {
|
||||
device += ",romfile="
|
||||
}
|
||||
args = append(args,
|
||||
"-netdev", fmt.Sprintf("stream,id=%s,addr.type=unix,addr.path=%s", netdevID, e.sockAddr),
|
||||
"-device", fmt.Sprintf("virtio-net-device,netdev=%s,mac=%s", netdevID, mac),
|
||||
"-device", fmt.Sprintf("%s,netdev=%s,mac=%s", device, netdevID, mac),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+197
-42
@@ -79,8 +79,10 @@ type Env struct {
|
||||
testVersion string
|
||||
|
||||
// gokrazy-specific paths
|
||||
gokrazyBase string // path to gokrazy base qcow2 image
|
||||
gokrazyKernel string // path to gokrazy kernel
|
||||
gokrazyMu sync.Mutex
|
||||
gokrazyBuilds map[string]gokrazyBuild // keyed by OSImage.Name
|
||||
gokrazyOnce map[string]*sync.Once // keyed by OSImage.Name
|
||||
gokrazyErr map[string]error // keyed by OSImage.Name
|
||||
|
||||
// tailmac-specific paths (macOS VMs)
|
||||
tailmacDir string // path to tailmac bin/ directory containing Host.app
|
||||
@@ -95,7 +97,6 @@ type Env struct {
|
||||
|
||||
// Shared resource initialization (sync.Once for things multiple nodes share).
|
||||
vnetOnce sync.Once
|
||||
gokrazyOnce sync.Once
|
||||
qemuSockOnce sync.Once
|
||||
dgramSockOnce sync.Once
|
||||
compileMu sync.Mutex
|
||||
@@ -114,6 +115,11 @@ type Env struct {
|
||||
nodeStatus map[string]*NodeStatus // keyed by node name
|
||||
}
|
||||
|
||||
type gokrazyBuild struct {
|
||||
base string // path to gokrazy base qcow2 image
|
||||
kernel string // path to gokrazy kernel
|
||||
}
|
||||
|
||||
// logVerbosef logs a message only when --verbose-vm-debug is set.
|
||||
func (e *Env) logVerbosef(format string, args ...any) {
|
||||
if *verboseVMDebug {
|
||||
@@ -718,6 +724,58 @@ func (e *Env) startWebServer(ctx context.Context, n *Node) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartTCPSink tells TTA on the node to start a TCP server that discards all
|
||||
// bytes it receives.
|
||||
func (e *Env) StartTCPSink(n *Node, port uint16) {
|
||||
e.t.Helper()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
reqURL := fmt.Sprintf("http://unused/start-tcp-sink?port=%d", port)
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", reqURL, nil)
|
||||
if err != nil {
|
||||
e.t.Fatalf("StartTCPSink: %v", err)
|
||||
}
|
||||
res, err := n.agent.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
e.t.Fatalf("StartTCPSink(%s): %v", n.name, err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
body, _ := io.ReadAll(res.Body)
|
||||
if res.StatusCode != 200 {
|
||||
e.t.Fatalf("StartTCPSink(%s): %s: %s", n.name, res.Status, body)
|
||||
}
|
||||
e.t.Logf("[%s] TCP sink started on port %d: %s", n.name, port, strings.TrimSpace(string(body)))
|
||||
}
|
||||
|
||||
// TCPSend sends total bytes from from to target in chunk-sized writes.
|
||||
func (e *Env) TCPSend(from *Node, target netip.AddrPort, totalBytes int64, chunk int, timeout time.Duration) (string, error) {
|
||||
e.t.Helper()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout+5*time.Second)
|
||||
defer cancel()
|
||||
v := url.Values{
|
||||
"target": {target.String()},
|
||||
"bytes": {strconv.FormatInt(totalBytes, 10)},
|
||||
"chunk": {strconv.Itoa(chunk)},
|
||||
"timeout": {timeout.String()},
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", "http://unused/tcp-send?"+v.Encode(), nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
res, err := from.agent.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
body, _ := io.ReadAll(res.Body)
|
||||
if res.StatusCode != 200 {
|
||||
return "", fmt.Errorf("%s: %s", res.Status, body)
|
||||
}
|
||||
out := strings.TrimSpace(string(body))
|
||||
e.t.Logf("[%s] TCP send: %s", from.name, out)
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SetExitNode sets the client node's exit node to use for internet traffic.
|
||||
// If exitNode is nil, the client's exit node is cleared (i.e., turned off).
|
||||
// Otherwise exitNode must be a tailnet node with an approved 0.0.0.0/0 (and
|
||||
@@ -923,6 +981,42 @@ type ClientMetric struct {
|
||||
Value int64 // the gauge or counter value
|
||||
}
|
||||
|
||||
// NetdevFeatureReport is TTA's view of a Linux network interface's ethtool
|
||||
// feature set.
|
||||
type NetdevFeatureReport struct {
|
||||
Name string `json:"name"`
|
||||
Flags uint `json:"flags"`
|
||||
Driver string `json:"driver,omitempty"`
|
||||
BusInfo string `json:"busInfo,omitempty"`
|
||||
Features map[string]bool `json:"features,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// NetdevFeatures returns the node's ethtool feature report from TTA.
|
||||
func (e *Env) NetdevFeatures(n *Node) []NetdevFeatureReport {
|
||||
e.t.Helper()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", "http://unused/netdev-features", nil)
|
||||
if err != nil {
|
||||
e.t.Fatalf("NetdevFeatures: %v", err)
|
||||
}
|
||||
res, err := n.agent.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
e.t.Fatalf("NetdevFeatures(%s): %v", n.name, err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
body, _ := io.ReadAll(res.Body)
|
||||
if res.StatusCode != 200 {
|
||||
e.t.Fatalf("NetdevFeatures(%s): %s: %s", n.name, res.Status, body)
|
||||
}
|
||||
var out []NetdevFeatureReport
|
||||
if err := json.Unmarshal(body, &out); err != nil {
|
||||
e.t.Fatalf("NetdevFeatures(%s): decode: %v: %s", n.name, err, body)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// SetAcceptRoutes toggles the node's RouteAll preference (the
|
||||
// --accept-routes flag), controlling whether it installs subnet routes
|
||||
// advertised by peers.
|
||||
@@ -1613,44 +1707,117 @@ func (e *Env) RecvTaildropFile(ctx context.Context, n *Node) (name string, conte
|
||||
return name, body
|
||||
}
|
||||
|
||||
var buildGokrazy sync.Once
|
||||
var (
|
||||
buildGokrazyMu sync.Mutex
|
||||
buildGokrazyOnce = map[string]*sync.Once{}
|
||||
buildGokrazyErr = map[string]error{}
|
||||
)
|
||||
|
||||
// ensureGokrazy builds the gokrazy base image (once per test process) and
|
||||
// locates the kernel. The build is fast (~4s) so we always rebuild to ensure
|
||||
// the baked-in binaries (tta, tailscale, tailscaled) match the current source.
|
||||
func (e *Env) ensureGokrazy(ctx context.Context) error {
|
||||
if e.gokrazyBase != "" {
|
||||
return nil // already found
|
||||
func (e *Env) ensureGokrazy(ctx context.Context, img OSImage) (gokrazyBuild, error) {
|
||||
e.gokrazyMu.Lock()
|
||||
once, ok := e.gokrazyOnce[img.Name]
|
||||
if !ok {
|
||||
once = new(sync.Once)
|
||||
mak.Set(&e.gokrazyOnce, img.Name, once)
|
||||
}
|
||||
e.gokrazyMu.Unlock()
|
||||
|
||||
once.Do(func() {
|
||||
e.ensureGokrazyOnce(ctx, img)
|
||||
})
|
||||
|
||||
if gb, err := e.gokrazyBuild(img); err == nil {
|
||||
return gb, nil
|
||||
}
|
||||
e.gokrazyMu.Lock()
|
||||
err := e.gokrazyErr[img.Name]
|
||||
e.gokrazyMu.Unlock()
|
||||
if err == nil {
|
||||
err = fmt.Errorf("gokrazy image %s was not prepared", img.Name)
|
||||
}
|
||||
return gokrazyBuild{}, err
|
||||
}
|
||||
|
||||
func (e *Env) ensureGokrazyOnce(ctx context.Context, img OSImage) {
|
||||
modRoot, err := findModRoot()
|
||||
if err != nil {
|
||||
return err
|
||||
e.setGokrazyErr(img, err)
|
||||
return
|
||||
}
|
||||
|
||||
var buildErr error
|
||||
buildGokrazy.Do(func() {
|
||||
e.t.Logf("building gokrazy natlab image...")
|
||||
cmd := exec.CommandContext(ctx, "make", "natlab")
|
||||
app := img.gokrazyApp()
|
||||
makeTarget := "natlab"
|
||||
if app != "natlabapp" {
|
||||
makeTarget = strings.TrimPrefix(app, "natlabapp.")
|
||||
makeTarget = "natlab-" + makeTarget
|
||||
}
|
||||
|
||||
buildGokrazyMu.Lock()
|
||||
once, ok := buildGokrazyOnce[app]
|
||||
if !ok {
|
||||
once = new(sync.Once)
|
||||
buildGokrazyOnce[app] = once
|
||||
}
|
||||
buildGokrazyMu.Unlock()
|
||||
|
||||
step := e.Step("Build gokrazy image: " + img.Name)
|
||||
step.Begin()
|
||||
once.Do(func() {
|
||||
e.t.Logf("building gokrazy natlab image %s...", img.Name)
|
||||
cmd := exec.CommandContext(ctx, "make", makeTarget)
|
||||
cmd.Dir = filepath.Join(modRoot, "gokrazy")
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
buildErr = fmt.Errorf("make natlab: %w", err)
|
||||
buildGokrazyMu.Lock()
|
||||
buildGokrazyErr[app] = fmt.Errorf("make %s: %w", makeTarget, err)
|
||||
buildGokrazyMu.Unlock()
|
||||
}
|
||||
})
|
||||
buildGokrazyMu.Lock()
|
||||
buildErr := buildGokrazyErr[app]
|
||||
buildGokrazyMu.Unlock()
|
||||
if buildErr != nil {
|
||||
return buildErr
|
||||
step.End(buildErr)
|
||||
e.setGokrazyErr(img, buildErr)
|
||||
return
|
||||
}
|
||||
|
||||
e.gokrazyBase = filepath.Join(modRoot, "gokrazy/natlabapp.qcow2")
|
||||
|
||||
kernel, err := findKernelPath(filepath.Join(modRoot, "go.mod"))
|
||||
kernel, err := findKernelPath(modRoot, img.gokrazyKernelPackage())
|
||||
if err != nil {
|
||||
return fmt.Errorf("finding kernel: %w", err)
|
||||
err = fmt.Errorf("finding kernel for %s: %w", img.gokrazyKernelPackage(), err)
|
||||
step.End(err)
|
||||
e.setGokrazyErr(img, err)
|
||||
return
|
||||
}
|
||||
e.gokrazyKernel = kernel
|
||||
return nil
|
||||
|
||||
gb := gokrazyBuild{
|
||||
base: filepath.Join(modRoot, "gokrazy", app+".qcow2"),
|
||||
kernel: kernel,
|
||||
}
|
||||
e.gokrazyMu.Lock()
|
||||
mak.Set(&e.gokrazyBuilds, img.Name, gb)
|
||||
e.gokrazyMu.Unlock()
|
||||
step.End(nil)
|
||||
}
|
||||
|
||||
func (e *Env) gokrazyBuild(img OSImage) (gokrazyBuild, error) {
|
||||
e.gokrazyMu.Lock()
|
||||
defer e.gokrazyMu.Unlock()
|
||||
gb, ok := e.gokrazyBuilds[img.Name]
|
||||
if !ok {
|
||||
return gokrazyBuild{}, os.ErrNotExist
|
||||
}
|
||||
return gb, nil
|
||||
}
|
||||
|
||||
func (e *Env) setGokrazyErr(img OSImage, err error) {
|
||||
e.gokrazyMu.Lock()
|
||||
defer e.gokrazyMu.Unlock()
|
||||
mak.Set(&e.gokrazyErr, img.Name, err)
|
||||
}
|
||||
|
||||
// compileBinariesForOS prepares the tta, tailscale, and tailscaled binaries
|
||||
@@ -1742,31 +1909,19 @@ func findModRoot() (string, error) {
|
||||
return filepath.Dir(gomod), nil
|
||||
}
|
||||
|
||||
// findKernelPath finds the gokrazy kernel vmlinuz path from go.mod.
|
||||
func findKernelPath(goMod string) (string, error) {
|
||||
// Import the same logic as nat_test.go.
|
||||
b, err := os.ReadFile(goMod)
|
||||
// findKernelPath finds the gokrazy kernel vmlinuz path for kernelPackage.
|
||||
func findKernelPath(modRoot, kernelPackage string) (string, error) {
|
||||
cmd := exec.Command("go", "list", "-m", "-f", "{{.Dir}}", kernelPackage)
|
||||
cmd.Dir = modRoot
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", fmt.Errorf("go list -m %s: %w\n%s", kernelPackage, err, out)
|
||||
}
|
||||
|
||||
goModCacheB, err := exec.Command("go", "env", "GOMODCACHE").CombinedOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
kernel := filepath.Join(strings.TrimSpace(string(out)), "vmlinuz")
|
||||
if _, err := os.Stat(kernel); err != nil {
|
||||
return "", fmt.Errorf("%s not found: %w", kernel, err)
|
||||
}
|
||||
goModCache := strings.TrimSpace(string(goModCacheB))
|
||||
|
||||
// Parse go.mod to find gokrazy-kernel version.
|
||||
for _, line := range strings.Split(string(b), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "github.com/tailscale/gokrazy-kernel") {
|
||||
parts := strings.Fields(line)
|
||||
if len(parts) >= 2 {
|
||||
return filepath.Join(goModCache, parts[0]+"@"+parts[1], "vmlinuz"), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("gokrazy-kernel not found in %s", goMod)
|
||||
return kernel, nil
|
||||
}
|
||||
|
||||
// PingRoute describes what connection type was used to transfer a Disco ping.
|
||||
|
||||
@@ -8,6 +8,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -38,6 +41,158 @@ func skipIfNotMacOSArm64(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func skipIfBuggyLinux70KernelMissing(t *testing.T) {
|
||||
t.Helper()
|
||||
out, err := exec.Command("go", "list", "-m", "-f", "{{.Dir}}", "github.com/tailscale/gokrazy-kernel-buggy-linux-7_0").CombinedOutput()
|
||||
if err != nil {
|
||||
t.Skipf("buggy Linux 7.0 gokrazy kernel module is not available: %v\n%s", err, out)
|
||||
}
|
||||
kernel := filepath.Join(strings.TrimSpace(string(out)), "vmlinuz")
|
||||
if _, err := os.Stat(kernel); err != nil {
|
||||
t.Skipf("buggy Linux 7.0 gokrazy kernel missing at %s: %v", kernel, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGokrazyBuggyLinux70IGBOffloadDiagnostics(t *testing.T) {
|
||||
skipIfBuggyLinux70KernelMissing(t)
|
||||
env := vmtest.New(t)
|
||||
|
||||
wan := env.AddNetwork("2.1.1.1", "192.168.1.1/24", vnet.EasyNAT)
|
||||
n := env.AddNode("buggy", wan,
|
||||
vmtest.OS(vmtest.GokrazyBuggyLinux70),
|
||||
vmtest.DontJoinTailnet())
|
||||
|
||||
env.Start()
|
||||
|
||||
features := env.NetdevFeatures(n)
|
||||
t.Logf("netdev features: %+v", features)
|
||||
for _, iface := range features {
|
||||
if iface.Driver != "igb" {
|
||||
continue
|
||||
}
|
||||
if !iface.Features["tx-udp-segmentation"] {
|
||||
t.Fatalf("igb interface %s does not advertise tx-udp-segmentation; features=%v", iface.Name, iface.Features)
|
||||
}
|
||||
if !iface.Features["tx-gso-partial"] {
|
||||
t.Fatalf("igb interface %s does not advertise tx-gso-partial; features=%v", iface.Name, iface.Features)
|
||||
}
|
||||
return
|
||||
}
|
||||
t.Fatalf("no igb interface found in netdev feature report: %+v", features)
|
||||
}
|
||||
|
||||
func TestGokrazyBuggyLinux70NeverGSOEqualTailMitigation(t *testing.T) {
|
||||
skipIfBuggyLinux70KernelMissing(t)
|
||||
env := vmtest.New(t)
|
||||
|
||||
buggyNet := env.AddNetwork("1.0.0.1", "192.168.1.1/24", vnet.EasyNAT)
|
||||
regularNet := env.AddNetwork("2.0.0.1", "192.168.2.1/24", vnet.EasyNAT)
|
||||
|
||||
buggy := env.AddNode("buggy", buggyNet, vmtest.OS(vmtest.GokrazyBuggyLinux70))
|
||||
regular := env.AddNode("regular", regularNet, vmtest.OS(vmtest.Gokrazy))
|
||||
|
||||
directStep := env.AddStep("Establish direct path")
|
||||
featureStep := env.AddStep("Verify buggy igb offload features")
|
||||
echoStep := env.AddStep("Start TCP sink on regular node")
|
||||
bugStep := env.AddStep("TCP bulk send without mitigation fails")
|
||||
mitigateStep := env.AddStep("Enable never-gso-equal-tail")
|
||||
fixedStep := env.AddStep("TCP bulk send with mitigation succeeds")
|
||||
|
||||
env.Start()
|
||||
|
||||
directStep.Begin()
|
||||
if err := env.PingExpect(buggy, regular, vmtest.PingRouteDirect, 30*time.Second); err != nil {
|
||||
directStep.End(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
directStep.End(nil)
|
||||
|
||||
featureStep.Begin()
|
||||
if err := requireIGBUDPPartialGSO(env, buggy); err != nil {
|
||||
featureStep.End(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
featureStep.End(nil)
|
||||
|
||||
const sinkPort = 41999
|
||||
echoStep.Begin()
|
||||
env.StartTCPSink(regular, sinkPort)
|
||||
regularIP := env.Status(regular).Self.TailscaleIPs[0]
|
||||
target := netip.AddrPortFrom(regularIP, sinkPort)
|
||||
echoStep.End(nil)
|
||||
|
||||
const (
|
||||
probeBytes = 1 << 20
|
||||
probeChunk = 64 << 10
|
||||
probeTimeout = 8 * time.Second
|
||||
)
|
||||
|
||||
bugStep.Begin()
|
||||
_, err := env.TCPSend(buggy, target, probeBytes, probeChunk, probeTimeout)
|
||||
if err == nil {
|
||||
err = fmt.Errorf("TCP bulk send unexpectedly succeeded without %s", tailcfg.NodeAttrNeverGSOEqualTail)
|
||||
bugStep.End(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("TCP bulk send failed without mitigation, as expected: %v", err)
|
||||
bugStep.End(nil)
|
||||
|
||||
mitigateStep.Begin()
|
||||
enableNodeCap(t, env, buggy, tailcfg.NodeAttrNeverGSOEqualTail)
|
||||
mitigateStep.End(nil)
|
||||
|
||||
fixedStep.Begin()
|
||||
if _, err := env.TCPSend(buggy, target, probeBytes, probeChunk, probeTimeout); err != nil {
|
||||
fixedStep.End(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
fixedStep.End(nil)
|
||||
}
|
||||
|
||||
func requireIGBUDPPartialGSO(env *vmtest.Env, n *vmtest.Node) error {
|
||||
features := env.NetdevFeatures(n)
|
||||
for _, iface := range features {
|
||||
if iface.Driver != "igb" {
|
||||
continue
|
||||
}
|
||||
if !iface.Features["tx-udp-segmentation"] {
|
||||
return fmt.Errorf("igb interface %s does not advertise tx-udp-segmentation; features=%v", iface.Name, iface.Features)
|
||||
}
|
||||
if !iface.Features["tx-gso-partial"] {
|
||||
return fmt.Errorf("igb interface %s does not advertise tx-gso-partial; features=%v", iface.Name, iface.Features)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("no igb interface found in netdev feature report: %+v", features)
|
||||
}
|
||||
|
||||
func enableNodeCap(t *testing.T, env *vmtest.Env, n *vmtest.Node, cap tailcfg.NodeCapability) {
|
||||
t.Helper()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
st, err := n.Agent().Status(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("status for %s: %v", n.Name(), err)
|
||||
}
|
||||
cm := tailcfg.NodeCapMap{cap: nil}
|
||||
env.ControlServer().SetNodeCapMap(st.Self.PublicKey, cm)
|
||||
if err := tstest.WaitFor(15*time.Second, func() error {
|
||||
st, err := n.Agent().Status(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if st.Self == nil {
|
||||
return fmt.Errorf("self is nil")
|
||||
}
|
||||
if !st.Self.HasCap(cap) {
|
||||
return fmt.Errorf("cap %v not yet received", cap)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
t.Fatalf("%s did not receive cap %s: %v", n.Name(), cap, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMacOSAndLinuxCanPing(t *testing.T) {
|
||||
skipIfNotMacOSArm64(t)
|
||||
env := vmtest.New(t)
|
||||
|
||||
Reference in new issue
Block a user