summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey V. Lobanov <svlobanov@users.noreply.github.com>2026-11-05 13:34:29 +0300
committerGitHub <noreply@github.com>2026-11-05 13:34:29 +0300
commitdb64fd559adce94ad10b121649d87e250dbbf030 (patch)
treed5bb8a4b8b7cc4dbe63d5789094a79c3d213810b
parentd80cdc61e82f7beb578f6c8232644f508ec95bb5 (diff)
parentb139b3b85f130b3f07eae278f3b34dee2a464a1b (diff)
downloadaccel-ppp-db64fd559adce94ad10b121649d87e250dbbf030.tar.gz
accel-ppp-db64fd559adce94ad10b121649d87e250dbbf030.zip
Merge pull request #380 from accel-ppp/fix-ipoe-netns-immutableHEADmaster
ipoe: probe netdevice.h for netns_local/netns_immutable
-rw-r--r--drivers/ipoe/Makefile10
-rw-r--r--drivers/ipoe/ipoe.c8
2 files changed, 15 insertions, 3 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..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)
@@ -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;