I put together a patch, this is my first debian bug submission, so I am
sorry if I messed anything up.

Thomas S. Hatch
From 08b0a5d20231f7a7580f87b753570c879655fd28 Mon Sep 17 00:00:00 2001
From: Thomas S Hatch <[email protected]>
Date: Mon, 12 Oct 2026 17:16:05 -0600
Subject: [PATCH] stats: fix v7.2 loss of snmp_fold_field()

Since b056e7326724 ("ipv4: remove obsolete EXPORT_SYMBOL() and
EXPORT_SYMBOL_GPL()") snmp_fold_field() is no longer exported by the
kernel, so building the jool_common module on kernel >= 7.2 fails with:

  ERROR: modpost: "snmp_fold_field" [jool_common.ko] undefined!

The body of snmp_fold_field() has been unchanged since kernel 4.3 and
snmp_get_cpu_field() is a static inline in net/ip.h, so we inline the
fold directly in jstat_query(). This works on all supported kernels
and removes the dependency on the exported symbol.

This mirrors upstream commits 47a8c7426f08 ("stats: fix v7.2 loss of
snmp_fold_field()") and fc5f37d8aab1 ("Remove snmp_fold_field()
preprocessor conditional"), which fix the same issue in upstream Jool.

Signed-off-by: Thomas S Hatch <[email protected]>
---
 src/mod/common/stats.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mod/common/stats.c b/src/mod/common/stats.c
index 3144475..31190a0 100644
--- a/src/mod/common/stats.c
+++ b/src/mod/common/stats.c
@@ -4,6 +4,7 @@
 #include <net/ip.h>
 #include <net/snmp.h>
 #include "mod/common/wkmalloc.h"
+#include "mod/common/linux_version.h"
 
 struct jool_mib {
 	unsigned long mibs[JSTAT_COUNT];
@@ -79,8 +80,11 @@ __u64 *jstat_query(struct jool_stats *stats)
 	if (!result)
 		return NULL;
 
-	for (i = 0; i < JSTAT_COUNT; i++)
-		result[i] = snmp_fold_field(stats->mib, i);
+	for (i = 0; i < JSTAT_COUNT; i++) {
+		int cpu;
+		for_each_possible_cpu(cpu)
+			result[i] += snmp_get_cpu_field(stats->mib, cpu, i);
+	}
 
 	return result;
 }
-- 
2.53.0

--- debian/changelog	2026-01-26 14:14:24.000000000 -0700
+++ /home/thatch/dev/jool/work/jool-4.1.15/debian/changelog	2026-10-12 17:17:10.714155901 -0600
@@ -1,3 +1,16 @@
+jool (4.1.15-2) unstable; urgency=medium
+
+  * Fix DKMS build failure on kernel >= 7.2: since upstream kernel commit
+    b056e7326724 ("ipv4: remove obsolete EXPORT_SYMBOL() and
+    EXPORT_SYMBOL_GPL()"), snmp_fold_field() is no longer exported by the
+    kernel, so building the jool_common module fails with:
+    "modpost: snmp_fold_field [jool_common.ko] undefined!".
+    Inline the fold in jstat_query() using snmp_get_cpu_field(), which is
+    a static inline in net/ip.h and works on all supported kernels. The
+    patch mirrors upstream Jool commits 47a8c7426f08 and fc5f37d8aab1.
+
+ -- Thomas S Hatch <[email protected]>  Mon, 12 Oct 2026 17:20:00 -0600
+
 jool (4.1.15-1) unstable; urgency=medium
 
   * New upstream release

--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
0001-stats-fix-v7.2-loss-of-snmp_fold_field.patch

Reply via email to