From 2423308cedc7db63ef8c68a1180f4574fd1c7354 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Thu, 6 Jul 2023 08:55:20 +0200 Subject: [PATCH] Fix compilation with kernel 6.4 due to register_sysctl_paths removal Fixes: aabc/ipt-netflow#220 Based on kalamlacki/ipt-netflow@2a1d250a701405b81fdf3548b4b9c12bf266a306 and kalamlacki/ipt-netflow@373b58781a0fc99fcb354ea3b5e4f3a006a71ab6 by @kalamlacki but does still support compiling with older kernel versions. Reference for the register_sysctl_paths removal: torvalds/linux@0199849acd07d07e2a8e42757653ca8b14a122f5 --- ipt_NETFLOW.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ipt_NETFLOW.c b/ipt_NETFLOW.c index b3c2c99..08453b2 100644 --- a/ipt_NETFLOW.c +++ b/ipt_NETFLOW.c @@ -1929,6 +1929,7 @@ static ctl_table netflow_net_table[] = { { } }; #else /* >= 2.6.25 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,4,0) static struct ctl_path netflow_sysctl_path[] = { { .procname = "net", @@ -1939,6 +1940,7 @@ static struct ctl_path netflow_sysctl_path[] = { { .procname = "netflow" }, { } }; +#endif /* 6.4.0 */ #endif /* 2.6.25 */ #endif /* CONFIG_SYSCTL */ @@ -5666,8 +5668,12 @@ static int __init ipt_netflow_init(void) #endif ); #else /* 2.6.25 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,4,0) netflow_sysctl_header = register_sysctl_paths(netflow_sysctl_path, netflow_sysctl_table); -#endif +#else + netflow_sysctl_header = register_sysctl("net/netflow", netflow_sysctl_table); +#endif /* 6.4.0 */ +#endif /* 2.6.25 */ if (!netflow_sysctl_header) { printk(KERN_ERR "netflow: can't register to sysctl\n"); goto err_free_proc_stat3;