Skip to contentSkip to conversation

ipset: Modify pernet_operations check

PATCH In review Mike Pagano 2 participants 2 messages May 23, 2025 – May 24, 2025 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipset: Modify pernet_operations check

Check for 'int \*id' in the pernet_operations struct fails for some later versions of kernels as the declaration is now 'int * const id'.

Kernel Commit 768e4bb6a75e3c6a034df7c67edac20bd222857e changed the variable declaration that ipset uses to ensure presence of the pernet ops id.

Modify the pattern match to include both the newer change while still supporting the original declaration.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index b8e9433..faf570b 100644
@@ -401,7 +401,7 @@ fi
 
 AC_MSG_CHECKING([kernel source for id in struct pernet_operations])
 if test -f $ksourcedir/include/net/net_namespace.h && \
-   $AWK '/^struct pernet_operations /,/^}/' $ksourcedir/include/net/net_namespace.h | $GREP -q 'int \*id;'; then
+   $AWK '/^struct pernet_operations /,/^}/' $ksourcedir/include/net/net_namespace.h | $GREP -qE 'int \*id;|int \* const id'; then
 	AC_MSG_RESULT(yes)
 	AC_SUBST(HAVE_NET_OPS_ID, define)
 else
Signature · 1 line
2.49.0
#1 lore raw
Quoted 21 lines · Mike Pagano

Check for 'int \*id' in the pernet_operations struct fails for some later versions of kernels as the declaration is now 'int * const id'.

Kernel Commit 768e4bb6a75e3c6a034df7c67edac20bd222857e changed the variable declaration that ipset uses to ensure presence of the pernet ops id.

Modify the pattern match to include both the newer change while still supporting the original declaration.

---
configure.ac | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +0 -0
index b8e9433..faf570b 100644

configure.ac fi · line 404

Quoted 5 lines
configure.ac +1 -1
@@ -401,7 +401,7 @@ fi
 
 AC_MSG_CHECKING([kernel source for id in struct pernet_operations])
 if test -f $ksourcedir/include/net/net_namespace.h && \
-   $AWK '/^struct pernet_operations /,/^}/' $ksourcedir/include/net/net_namespace.h | $GREP -q 'int \*id;'; then
+   $AWK '/^struct pernet_operations /,/^}/' $ksourcedir/include/net/net_namespace.h | $GREP -qE 'int \*id;|int \* const id'; then

Or:

$AWK '/^struct pernet_operations /,/^}/' $ksourcedir/include/net/net_namespace.h | $GREP -qE 'int \*( const )?id;'; then

Quoted 7 lines
configure.ac +0 -0
 	AC_MSG_RESULT(yes)
 	AC_SUBST(HAVE_NET_OPS_ID, define)

else

Signature · 1 line
2.49.0

J.