Record the decision to test primarily on natlab's gokrazy image, which
boots a recent upstream kernel and has no userspace tools, as in the end
state where tailscaled drives the kernel entirely. Describe how its
module build tree is recreated and how the test agent loads and
configures tswg. Keep Ubuntu 24.04 as a secondary guest for distro and
DKMS-style coverage.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I89714b58c944be4f373f23471e3aeef11942b1f6
The natlab gokrazy image runs a recent upstream kernel (7.2.8 today) that
gokrazy rebuilds and tailscale.com bumps regularly, which makes it a
better primary test target than a distro kernel: it keeps us honest
against new kernel APIs, and gokrazy has no userspace tools, as in the
end state where tailscaled drives the kernel entirely.
gokrazy kernels are kernel.org releases plus the patches in
_build/series, built with an embedded config and without MODVERSIONS or
module signing. gokrazy-kdir.sh downloads the release, applies the
patches, installs the config pulled out of vmlinuz with the kernel's
extract-ikconfig (vendored), and runs modules_prepare, caching the
result by release and config hash. It takes about 20 seconds the first
time. The only config differences after olddefconfig with the host's gcc
13 (gokrazy uses Debian 12's gcc 12) are toolchain capability bits.
Factor the generic part of build-for-ubuntu.sh into build.sh, which now
copies only sources (not objects from an in-place build in src/), and
sets KBUILD_MODPOST_WARN=1 for trees without a Module.symvers. Add
build-for-gokrazy.sh.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Id28d9c013bdfaa7cec28aeff846f7f6087e25518
Document the feature-probe compat framework, that the Go netlink client
and tswgctl live in tailscale.com on the bradfitz/tswg branch, and how
the natlab vmtests build, install and exercise tswg.ko. Update the TODO
list: TestTSWGManualTunnel now passes against Ubuntu 24.04's stock
6.8.0-106-generic kernel.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ie279a07e251d1ee81cdc91478f3eec9d0dd46afb
build-for-ubuntu.sh builds tswg.ko for a given Ubuntu kernel release in a
private copy of src/, so test builds for different guest kernels don't
share object files with each other or with a developer's in-place build.
The Makefile's SRC is now overridable to allow that.
vmtest.sh runs the tswg natlab vmtests, which live in a tailscale.com
checkout (on the bradfitz/tswg branch) because they use its natlab
framework and the Go tswg netlink client there.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I00eb5cbf8df5a203d6d39d541779060db74da9a1
The fork tracks the newest upstream WireGuard (7.4-rc1), but has to build
on distro kernels. Our first target is the natlab Ubuntu 24.04 guest
(6.8.0-106-generic) and the dev host is on 7.0.
Rather than LINUX_VERSION_CODE checks, which lie on heavily backported
kernels such as RHEL's, scripts/probe.sh compile-tests each
src/compat/probes/HAVE_*.c against the target kernel's build directory
(in parallel, about one second in total) and writes
src/compat/generated/autoconf.h. Kbuild force-includes src/compat/compat.h,
which shims whatever is missing: udp_get_len_short, the struct sock
udp_tunnel APIs, the ipcb_flags xmit arguments, the blake2s_ctx API,
WQ_PERCPU, netif_threaded_enable, rtnl_newlink_params, sockaddr_inet, the
kmalloc_obj family and timer_container_of.
Three spots in device.c can't be shimmed from a header (the lltx bit, the
old rtnl newlink signature, and pernet exit_rtnl) and get small #ifdefs
marked TSWG_COMPAT. device.c also always sets ndo_get_stats64 to
dev_get_tstats64, since older kernels don't fold tstats in
dev_get_stats(). That is equivalent on new kernels.
tswg.ko now builds against both 6.8.0-106-generic and 7.0.0-1009-aws.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I0ed279318b4f623688d1f178a9b8fbcc0b585219
Copy upstream/drivers/net/wireguard into src and rename only the
user-visible identifiers: the module (and thus the rtnl link kind and
device type, which come from KBUILD_MODNAME) is now tswg, and the
genetlink family is "tswg". The uapi header moves to
src/include/uapi/linux/tswg.h so it can't collide with the kernel's.
Internal wg_ symbols keep their names to keep upstream merges easy; they
aren't exported, so tswg.ko can coexist with wireguard.ko.
Add an out-of-tree Kbuild and top-level Makefile, plus
scripts/ubuntu-headers.sh, which fetches and unpacks an Ubuntu kernel's
headers so we can build for the natlab Ubuntu guest without installing
anything.
This still only builds against 7.4-era kernels; compat shims follow.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ia36ef82a53efbbcdb301ed069785162372efda55
Record the decisions made so far: an out-of-tree C fork of in-tree
WireGuard (no Rust, no upstreaming), a shared UDP socket passed in from
tailscaled, explicit endpoints with auto-roaming disabled, DERP via
127.0.0.0/8 loopback endpoints, and userspace spray. Also describe the
natlab vmtest testbed and the TODO list.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ie18d356974a0a0d8fce19674b590861144be8cea
The tswg kernel module, under kernel/linux, is derived from Linux's WireGuard,
and so is GPL-2.0, unlike the rest of this repository.
Updates #426
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I8cab6152232f771364a06d79ecd8b406f3ef01dc