Skip to contentSkip to conversation

Add Linux 6.2 Support

PATCH In review Jeremy Sowden 2 participants 5 messages Dec 29, 2022 – Dec 30, 2022 netfilter

lore
Share & tools
lore
#0 lore raw

cover Add Linux 6.2 Support

The main purpose of the patch-set is to add support for 6.2, which removes prandom_u32_max, by replacing it with the function that supersedes it. We also introduce the LT_INIT into configure.ac.

Jeremy Sowden (3):
build: replace obsolete AC_PROG_LIBTOOL macro with LT_INIT
build: replace AC_DISABLE_STATIC macro with an argument to LT_INIT
build: support for Linux 6.2

 configure.ac                | 5 ++---
 extensions/compat_xtables.h | 4 ++++
 extensions/xt_TARPIT.c      | 6 +++---
 3 files changed, 9 insertions(+), 6 deletions(-)
Signature · 1 line
2.39.0
#1 lore raw

PATCH 1/3 build: replace obsolete `AC_PROG_LIBTOOL` macro with `LT_INIT`

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index 549425742340..5d07a1026a20 100644
@@ -8,7 +8,7 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_ARG_WITH([kbuild],
 	AS_HELP_STRING([--with-kbuild=PATH],
Signature · 1 line
2.39.0
#2 lore raw

PATCH 2/3 build: replace `AC_DISABLE_STATIC` macro with an argument to `LT_INIT`

In reply to Jeremy Sowden
---
 configure.ac | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
configure.ac +1 -2
index 5d07a1026a20..d582ca8e92d0 100644
@@ -7,8 +7,7 @@ AM_INIT_AUTOMAKE([1.10b -Wall foreign subdir-objects])
 AC_PROG_CC
 AM_PROG_CC_C_O
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-AC_DISABLE_STATIC
-LT_INIT
+LT_INIT([disable-static])
 
 AC_ARG_WITH([kbuild],
 	AS_HELP_STRING([--with-kbuild=PATH],
Signature · 1 line
2.39.0
#3 lore raw

PATCH 3/3 build: support for Linux 6.2

In reply to Jeremy Sowden

prandom_u32_max was deprecated in favour of get_random_u32_below, and removed in 6.2-rc1. Replace the three occurrences of it in the TARPIT extension, and ad compat support for earlier kernels.

---
 configure.ac                | 2 +-
 extensions/compat_xtables.h | 4 ++++
 extensions/xt_TARPIT.c      | 6 +++---
 3 files changed, 8 insertions(+), 4 deletions(-)
configure.ac +1 -1
index d582ca8e92d0..a13988ff4a4b 100644
@@ -58,7 +58,7 @@ AS_IF([test -n "$kbuilddir"], [
 		yoff
 	], [
 		echo "$kmajor.$kminor.$kmicro.$kstable in $kbuilddir";
-		if test "$kmajor" -gt 6 -o "$kmajor" -eq 6 -a "$kminor" -gt 1; then
+		if test "$kmajor" -gt 6 -o "$kmajor" -eq 6 -a "$kminor" -gt 2; then
 			yon
 			echo "WARNING: That kernel version is not officially supported yet. Continue at own luck.";
 			yoff
extensions/compat_xtables.h +4 -0
index 1feea880057d..848d3bff50d8 100644
@@ -48,4 +48,8 @@ static inline struct net *par_net(const struct xt_action_param *par)
 #	define proc_release release
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
+#	define get_random_u32_below prandom_u32_max
+#endif
+
 extern void *HX_memmem(const void *, size_t, const void *, size_t);
extensions/xt_TARPIT.c +3 -3
index 22e61255f5ca..c3875bc0f47f 100644
@@ -107,8 +107,8 @@ static bool xttarpit_honeypot(struct tcphdr *tcph, const struct tcphdr *oth,
 		tcph->syn     = true;
 		tcph->ack     = true;
 		tcph->window  = oth->window &
-			(prandom_u32_max(0x20) - 0xf);
-		tcph->seq     = htonl(prandom_u32_max(~oth->seq + 1));
+			(get_random_u32_below(0x20) - 0xf);
+		tcph->seq     = htonl(get_random_u32_below(~oth->seq + 1));
 		tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn);
 	}
 
@@ -117,7 +117,7 @@ static bool xttarpit_honeypot(struct tcphdr *tcph, const struct tcphdr *oth,
 		tcph->syn     = false;
 		tcph->ack     = true;
 		tcph->window  = oth->window &
-			(prandom_u32_max(0x20) - 0xf);
+			(get_random_u32_below(0x20) - 0xf);
 		tcph->ack_seq = payload > 100 ?
 			htonl(ntohl(oth->seq) + payload) :
 			oth->seq;
Signature · 1 line
2.39.0
#4 lore raw
In reply to Jeremy Sowden
Quoted 3 lines · Jeremy Sowden

The main purpose of the patch-set is to add support for 6.2, which removes prandom_u32_max, by replacing it with the function that supersedes it. We also introduce the LT_INIT into configure.ac.

added.