Gentoo Archives: gentoo-commits

From: Sergey Popov <pinkbyte@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-firewall/ipt_netflow/files/, net-firewall/ipt_netflow/
Date: Mon, 05 Jul 2021 14:21:18
Message-Id: 1625494870.205596a0f676638bc1fa3a4f6b552b984c98a5d4.pinkbyte@gentoo
1 commit: 205596a0f676638bc1fa3a4f6b552b984c98a5d4
2 Author: Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 5 14:20:50 2021 +0000
4 Commit: Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 5 14:21:10 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=205596a0
7
8 net-firewall/ipt_netflow: backport fix regarding obsolete ref_module call
9
10 Closes: https://bugs.gentoo.org/781014
11 Package-Manager: Portage-3.0.18, Repoman-3.0.2
12 Signed-off-by: Sergey Popov <pinkbyte <AT> gentoo.org>
13
14 .../files/ipt_netflow-2.6-ref_module_fix.patch | 60 ++++++++++++++++++++++
15 net-firewall/ipt_netflow/ipt_netflow-2.6.ebuild | 1 +
16 2 files changed, 61 insertions(+)
17
18 diff --git a/net-firewall/ipt_netflow/files/ipt_netflow-2.6-ref_module_fix.patch b/net-firewall/ipt_netflow/files/ipt_netflow-2.6-ref_module_fix.patch
19 new file mode 100644
20 index 00000000000..21d64719070
21 --- /dev/null
22 +++ b/net-firewall/ipt_netflow/files/ipt_netflow-2.6-ref_module_fix.patch
23 @@ -0,0 +1,60 @@
24 +commit 352cdb28eecbb57de3509b18dfc37dcce0455c01
25 +Author: ABC <abc@××××××××.com>
26 +Date: Tue Jun 22 19:07:02 2021 +0300
27 +
28 + Fix compile for stable kernels by not using 'ref_module'
29 +
30 + `ref_module' unexport in 7ef5264de7732 ("modules: mark ref_module
31 + static") is back-ported into stable kernels making old `#if
32 + LINUX_VERSION_CODE' checks irrelevant or too complicated to update.
33 +
34 + Do not use `ref_module' API at all since `try_module_get' is ancient
35 + enough to use always.
36 +
37 + Reported-by: https://github.com/xtaran
38 + Fixes: https://github.com/aabc/ipt-netflow/issues/177
39 +
40 +diff --git a/compat.h b/compat.h
41 +index 99edf91..30f1d8f 100644
42 +--- a/compat.h
43 ++++ b/compat.h
44 +@@ -170,10 +170,6 @@ static int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cm
45 + # define CHECK_OK 0
46 + #endif
47 +
48 +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
49 +-# define use_module ref_module
50 +-#endif
51 +-
52 + #ifndef NF_IP_LOCAL_IN /* 2.6.25 */
53 + # define NF_IP_PRE_ROUTING NF_INET_PRE_ROUTING
54 + # define NF_IP_LOCAL_IN NF_INET_LOCAL_IN
55 +diff --git a/ipt_NETFLOW.c b/ipt_NETFLOW.c
56 +index d3d3901..c4c049d 100644
57 +--- a/ipt_NETFLOW.c
58 ++++ b/ipt_NETFLOW.c
59 +@@ -5494,12 +5494,8 @@ static void register_ct_events(void)
60 + }
61 + /* Reference netlink module to prevent it's unsafe unload before us. */
62 + if (!netlink_m && (netlink_m = find_module(NETLINK_M))) {
63 +-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
64 +- use_module(THIS_MODULE, netlink_m);
65 +-#else
66 + if (!try_module_get(netlink_m))
67 + netlink_m = NULL;
68 +-#endif
69 + }
70 +
71 + /* Register ct events callback. */
72 +@@ -5527,10 +5523,9 @@ static void unregister_ct_events(void)
73 + #else /* < v3.2 */
74 + unset_notifier_cb();
75 + #endif /* v3.2 */
76 +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
77 + module_put(netlink_m);
78 + netlink_m = NULL;
79 +-#endif
80 ++
81 + rcu_assign_pointer(saved_event_cb, NULL);
82 + #else /* < v2.6.31 */
83 + nf_conntrack_unregister_notifier(&ctnl_notifier);
84
85 diff --git a/net-firewall/ipt_netflow/ipt_netflow-2.6.ebuild b/net-firewall/ipt_netflow/ipt_netflow-2.6.ebuild
86 index 29ed265510f..35009fb8ac1 100644
87 --- a/net-firewall/ipt_netflow/ipt_netflow-2.6.ebuild
88 +++ b/net-firewall/ipt_netflow/ipt_netflow-2.6.ebuild
89 @@ -31,6 +31,7 @@ BDEPEND="
90 PATCHES=(
91 "${FILESDIR}/${PN}-2.0-configure.patch" # bug #455984
92 "${FILESDIR}/${PN}-2.6-gentoo.patch"
93 + "${FILESDIR}/${P}-ref_module_fix.patch" # bug #781014
94 )
95
96 pkg_setup() {