diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-11-03 00:26:17 +0200 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-11-03 00:26:17 +0200 |
| commit | 323a98362b1488f68de8878ad3fd3e58eab398fb (patch) | |
| tree | a3beb475080f2e856f610962ae496c27c63ef0bc | |
| parent | d80cdc61e82f7beb578f6c8232644f508ec95bb5 (diff) | |
| download | accel-ppp-323a98362b1488f68de8878ad3fd3e58eab398fb.tar.gz accel-ppp-323a98362b1488f68de8878ad3fd3e58eab398fb.zip | |
ipoe: probe netdevice.h for netns_local/netns_immutable
Stable kernels backport the netns_local -> netns_immutable rename
(6.12.114+, e.g. Debian 13's 6.12.115), so LINUX_VERSION_CODE can no
longer tell which member the headers provide and the module fails to
build with "'struct net_device' has no member named 'netns_local'".
Grep the kernel's include/linux/netdevice.h from the Kbuild Makefile
and pass -DHAVE_NETNS_IMMUTABLE or -DHAVE_NETNS_LOCAL accordingly. The
version checks stay only as a fallback if the probe finds neither.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
| -rw-r--r-- | drivers/ipoe/Makefile | 10 | ||||
| -rw-r--r-- | drivers/ipoe/ipoe.c | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/ipoe/Makefile b/drivers/ipoe/Makefile index 22ea273d..059a5612 100644 --- a/drivers/ipoe/Makefile +++ b/drivers/ipoe/Makefile @@ -1,4 +1,14 @@ obj-m += ipoe.o +# The netns_local bit (6.12) was renamed to netns_immutable (6.15), and +# stable kernels backport the rename (6.12.114+), so LINUX_VERSION_CODE +# alone cannot tell which one the headers provide. Probe the header. +IPOE_NETDEVICE_H := $(srctree)/include/linux/netdevice.h +ifneq ($(shell grep -q 'netns_immutable:1' $(IPOE_NETDEVICE_H) 2>/dev/null && echo y),) +ccflags-y += -DHAVE_NETNS_IMMUTABLE +else ifneq ($(shell grep -q 'netns_local:1' $(IPOE_NETDEVICE_H) 2>/dev/null && echo y),) +ccflags-y += -DHAVE_NETNS_LOCAL +endif + default: make -C $(KDIR) M=$(PWD) modules diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c index 251fec96..6a4ab978 100644 --- a/drivers/ipoe/ipoe.c +++ b/drivers/ipoe/ipoe.c @@ -1215,9 +1215,11 @@ static void ipoe_netdev_setup(struct net_device *dev) dev->iflink = 0; #endif dev->addr_len = ETH_ALEN; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) + /* HAVE_NETNS_* come from the Makefile header probe; the version + * checks are only a fallback when the probe could not run. */ +#if defined(HAVE_NETNS_IMMUTABLE) || LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) dev->netns_immutable = true; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0) +#elif defined(HAVE_NETNS_LOCAL) || LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0) dev->netns_local = true; #else dev->features |= NETIF_F_NETNS_LOCAL; |
