Files
tailscale/kernel/linux/Makefile
T
Brad Fitzpatrick ff6f9e8409 kernel/linux/{src/compat,scripts}: add feature-probe compat layer for 6.8 and 7.0
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
2026-11-06 21:01:41 +00:00

28 lines
774 B
Makefile

# SPDX-License-Identifier: GPL-2.0
#
# Build tswg.ko out of tree.
#
# make # against the running kernel
# make KDIR=/path/to/build # against another kernel's build dir
# make TSWG_DEBUG=y # enable DEBUG and the built-in selftests
KDIR ?= /lib/modules/$(shell uname -r)/build
SRC := $(CURDIR)/src
AUTOCONF := $(SRC)/compat/generated/autoconf.h
all: module
# The probes are cheap, so always rerun them; probe.sh leaves the header
# untouched (and so doesn't trigger a rebuild) when the results don't change.
probe:
scripts/probe.sh $(KDIR) $(AUTOCONF)
module: probe
$(MAKE) -C $(KDIR) M=$(SRC) TSWG_DEBUG=$(TSWG_DEBUG) modules
clean:
$(MAKE) -C $(KDIR) M=$(SRC) clean
rm -rf $(SRC)/compat/generated
.PHONY: all probe module clean