From 323a98362b1488f68de8878ad3fd3e58eab398fb Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Tue, 3 Nov 2026 00:26:17 +0200 Subject: 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 --- drivers/ipoe/Makefile | 10 ++++++++++ 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; -- cgit v1.2.3 From b139b3b85f130b3f07eae278f3b34dee2a464a1b Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Tue, 3 Nov 2026 00:36:59 +0200 Subject: ipoe: use rtnl_newlink_params signature only from 6.15 struct rtnl_newlink_params was introduced in 6.15, but the newlink callback switched to it at 6.13, so the module failed to build on 6.13 and 6.14 kernels with an incompatible pointer type for .newlink. Signed-off-by: Denys Fedoryshchenko --- drivers/ipoe/ipoe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c index 6a4ab978..47dc6955 100644 --- a/drivers/ipoe/ipoe.c +++ b/drivers/ipoe/ipoe.c @@ -1135,7 +1135,7 @@ static int ipoe_ctrl_attached(void) /* Sessions are created through IPOE_CMD_CREATE, which also sets up the * private state. A device made by rtnetlink would have none of it, so * refuse 'ip link add ... type ipoe' explicitly. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,13,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) static int ipoe_newlink(struct net_device *dev, struct rtnl_newlink_params *params, struct netlink_ext_ack *extack) -- cgit v1.2.3