From a1abd12f351cfb625c5ac9bca243d0bc46dbdbfd Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 13 Apr 2024 10:45:55 -0700 Subject: [PATCH] cmd/tailscaled, net/tstun: build for aix/ppc64 At least in userspace-networking mode. Fixes #11361 Change-Id: I78d33f0f7e05fe9e9ee95b97c99b593f8fe498f2 Signed-off-by: Brad Fitzpatrick --- .github/workflows/test.yml | 44 +++++++++++++++++++-- cmd/tailscaled/tailscaled.go | 2 +- go.mod | 2 +- go.sum | 4 +- net/tstun/{tstun_plan9.go => tstun_stub.go} | 2 + net/tstun/tun.go | 2 +- posture/serialnumber_stub.go | 2 +- 7 files changed, 49 insertions(+), 9 deletions(-) rename net/tstun/{tstun_plan9.go => tstun_stub.go} (93%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e11ea68be..e2525d0a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -254,9 +254,6 @@ jobs: goarch: amd64 - goos: openbsd goarch: amd64 - # Plan9 (disabled until 3p dependencies are fixed) - # - goos: plan9 - # goarch: amd64 runs-on: ubuntu-22.04 steps: @@ -305,6 +302,47 @@ jobs: GOOS: ios GOARCH: arm64 + crossmin: # cross-compile for platforms where we only check cmd/tailscale{,d} + strategy: + fail-fast: false # don't abort the entire matrix if one element fails + matrix: + include: + # Plan9 + - goos: plan9 + goarch: amd64 + # AIX + - goos: aix + goarch: ppc64 + + runs-on: ubuntu-22.04 + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Restore Cache + uses: actions/cache@v3 + with: + # Note: unlike the other setups, this is only grabbing the mod download + # cache, rather than the whole mod directory, as the download cache + # contains zips that can be unpacked in parallel faster than they can be + # fetched and extracted by tar + path: | + ~/.cache/go-build + ~/go/pkg/mod/cache + ~\AppData\Local\go-build + # The -2- here should be incremented when the scheme of data to be + # cached changes (e.g. path above changes). + key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}-${{ github.run_id }} + restore-keys: | + ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }} + ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2- + - name: build core + run: ./tool/go build ./cmd/tailscale ./cmd/tailscaled + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOARM: ${{ matrix.goarm }} + CGO_ENABLED: "0" + android: # similar to cross above, but android fails to build a few pieces of the # repo. We should fix those pieces, they're small, but as a stepping stone, diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled.go index f93538ad5..a32a84e6f 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled.go @@ -79,7 +79,7 @@ func defaultTunName() string { // "utun" is recognized by wireguard-go/tun/tun_darwin.go // as a magic value that uses/creates any free number. return "utun" - case "plan9": + case "plan9", "aix": return "userspace-networking" case "linux": switch distro.Get() { diff --git a/go.mod b/go.mod index 275c9381c..843e52836 100644 --- a/go.mod +++ b/go.mod @@ -77,7 +77,7 @@ require ( github.com/tailscale/peercred v0.0.0-20240214030740-b535050b2aa4 github.com/tailscale/web-client-prebuilt v0.0.0-20240226180453-5db17b287bf1 github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6 - github.com/tailscale/wireguard-go v0.0.0-20231121184858-cc193a0b3272 + github.com/tailscale/wireguard-go v0.0.0-20240413175505-64040e66467d github.com/tailscale/xnet v0.0.0-20240117122442-62b9a7c569f9 github.com/tc-hib/winres v0.2.1 github.com/tcnksm/go-httpstat v0.2.0 diff --git a/go.sum b/go.sum index d4aaf5314..5818e12a1 100644 --- a/go.sum +++ b/go.sum @@ -889,8 +889,8 @@ github.com/tailscale/web-client-prebuilt v0.0.0-20240226180453-5db17b287bf1 h1:t github.com/tailscale/web-client-prebuilt v0.0.0-20240226180453-5db17b287bf1/go.mod h1:agQPE6y6ldqCOui2gkIh7ZMztTkIQKH049tv8siLuNQ= github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6 h1:l10Gi6w9jxvinoiq15g8OToDdASBni4CyJOdHY1Hr8M= github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6/go.mod h1:ZXRML051h7o4OcI0d3AaILDIad/Xw0IkXaHM17dic1Y= -github.com/tailscale/wireguard-go v0.0.0-20231121184858-cc193a0b3272 h1:zwsem4CaamMdC3tFoTpzrsUSMDPV0K6rhnQdF7kXekQ= -github.com/tailscale/wireguard-go v0.0.0-20231121184858-cc193a0b3272/go.mod h1:BOm5fXUBFM+m9woLNBoxI9TaBXXhGNP50LX/TGIvGb4= +github.com/tailscale/wireguard-go v0.0.0-20240413175505-64040e66467d h1:IREg0cn4nDyMjnqTgPacjgl66qDYmoOnt1k/vb96ius= +github.com/tailscale/wireguard-go v0.0.0-20240413175505-64040e66467d/go.mod h1:BOm5fXUBFM+m9woLNBoxI9TaBXXhGNP50LX/TGIvGb4= github.com/tailscale/xnet v0.0.0-20240117122442-62b9a7c569f9 h1:81P7rjnikHKTJ75EkjppvbwUfKHDHYk6LJpO5PZy8pA= github.com/tailscale/xnet v0.0.0-20240117122442-62b9a7c569f9/go.mod h1:orPd6JZXXRyuDusYilywte7k094d7dycXXU5YnWsrwg= github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA= diff --git a/net/tstun/tstun_plan9.go b/net/tstun/tstun_stub.go similarity index 93% rename from net/tstun/tstun_plan9.go rename to net/tstun/tstun_stub.go index 4472a7a5d..7a4f71a09 100644 --- a/net/tstun/tstun_plan9.go +++ b/net/tstun/tstun_stub.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build plan9 || aix + package tstun import ( diff --git a/net/tstun/tun.go b/net/tstun/tun.go index 531383f17..66e209d1a 100644 --- a/net/tstun/tun.go +++ b/net/tstun/tun.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !wasm && !plan9 && !tamago +//go:build !wasm && !plan9 && !tamago && !aix // Package tun creates a tuntap device, working around OS-specific // quirks if necessary. diff --git a/posture/serialnumber_stub.go b/posture/serialnumber_stub.go index 1389177fe..f1f6d4694 100644 --- a/posture/serialnumber_stub.go +++ b/posture/serialnumber_stub.go @@ -8,7 +8,7 @@ // solaris: currently unsupported by go-smbios: // https://github.com/digitalocean/go-smbios/pull/21 -//go:build ios || android || solaris || plan9 || js || wasm || (darwin && !cgo) || tamago +//go:build ios || android || solaris || plan9 || js || wasm || (darwin && !cgo) || tamago || aix package posture