File: 0001-Fix-compile-for-stable-kernels-by-not-using-ref_modu.patch

package info (click to toggle)
iptables-netflow 2.6-7.2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,632 kB
  • sloc: ansic: 6,831; sh: 896; ruby: 619; makefile: 239
file content (67 lines) | stat: -rw-r--r-- 2,024 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 352cdb28eecbb57de3509b18dfc37dcce0455c01 Mon Sep 17 00:00:00 2001
From: ABC <abc@openwall.com>
Date: Tue, 22 Jun 2021 19:07:02 +0300
Subject: [PATCH 01/17] Fix compile for stable kernels by not using
 'ref_module'

`ref_module' unexport in 7ef5264de7732 ("modules: mark ref_module
static") is back-ported into stable kernels making old `#if
LINUX_VERSION_CODE' checks irrelevant or too complicated to update.

Do not use `ref_module' API at all since `try_module_get' is ancient
enough to use always.

Reported-by: https://github.com/xtaran
Fixes: https://github.com/aabc/ipt-netflow/issues/177
---
 compat.h      | 4 ----
 ipt_NETFLOW.c | 7 +------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/compat.h b/compat.h
index 99edf91..30f1d8f 100644
--- a/compat.h
+++ b/compat.h
@@ -170,10 +170,6 @@ static int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cm
 # define CHECK_OK	0
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
-# define use_module	ref_module
-#endif
-
 #ifndef NF_IP_LOCAL_IN /* 2.6.25 */
 # define NF_IP_PRE_ROUTING	NF_INET_PRE_ROUTING
 # define NF_IP_LOCAL_IN		NF_INET_LOCAL_IN
diff --git a/ipt_NETFLOW.c b/ipt_NETFLOW.c
index d3d3901..c4c049d 100644
--- a/ipt_NETFLOW.c
+++ b/ipt_NETFLOW.c
@@ -5494,12 +5494,8 @@ static void register_ct_events(void)
 	}
 	/* Reference netlink module to prevent it's unsafe unload before us. */
 	if (!netlink_m && (netlink_m = find_module(NETLINK_M))) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
-		use_module(THIS_MODULE, netlink_m);
-#else
 		if (!try_module_get(netlink_m))
 			netlink_m = NULL;
-#endif
 	}
 
 	/* Register ct events callback. */
@@ -5527,10 +5523,9 @@ static void unregister_ct_events(void)
 #else /* < v3.2 */
 	unset_notifier_cb();
 #endif /* v3.2 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
 	module_put(netlink_m);
 	netlink_m = NULL;
-#endif
+
 	rcu_assign_pointer(saved_event_cb, NULL);
 #else /* < v2.6.31 */
 	nf_conntrack_unregister_notifier(&ctnl_notifier);
-- 
2.39.5