1 |
commit: e67466e42c6fc3c2775258cad58e1803b352e3bf |
2 |
Author: Jeroen Roovers <jer <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Feb 10 11:21:57 2018 +0000 |
4 |
Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 10 11:22:08 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e67466e4 |
7 |
|
8 |
net-firewall/ipt_netflow: Fix kernel 4.15 compatibility (bug #646798). |
9 |
|
10 |
Package-Manager: Portage-2.3.24, Repoman-2.3.6 |
11 |
|
12 |
.../files/ipt_netflow-2.2-linux-4.15.patch | 26 ++++++ |
13 |
net-firewall/ipt_netflow/ipt_netflow-2.2-r3.ebuild | 102 +++++++++++++++++++++ |
14 |
2 files changed, 128 insertions(+) |
15 |
|
16 |
diff --git a/net-firewall/ipt_netflow/files/ipt_netflow-2.2-linux-4.15.patch b/net-firewall/ipt_netflow/files/ipt_netflow-2.2-linux-4.15.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..aa5feef3279 |
19 |
--- /dev/null |
20 |
+++ b/net-firewall/ipt_netflow/files/ipt_netflow-2.2-linux-4.15.patch |
21 |
@@ -0,0 +1,26 @@ |
22 |
+--- a/ipt_NETFLOW.c |
23 |
++++ b/ipt_NETFLOW.c |
24 |
+@@ -4357,7 +4357,11 @@ |
25 |
+ #define CALC_RATE(ewma, cur, minutes) ewma += _A(cur - ewma, minutes) |
26 |
+ |
27 |
+ // calculate EWMA throughput rate for whole module |
28 |
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) |
29 |
++static void rate_timer_calc(struct timer_list *t) |
30 |
++#else |
31 |
+ static void rate_timer_calc(unsigned long dummy) |
32 |
++#endif |
33 |
+ { |
34 |
+ static u64 old_pkt_total = 0; |
35 |
+ static u64 old_traf_total = 0; |
36 |
+@@ -5525,7 +5525,11 @@ |
37 |
+ |
38 |
+ netflow_switch_version(protocol); |
39 |
+ _schedule_scan_worker(0); |
40 |
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) |
41 |
++ timer_setup(&rate_timer, rate_timer_calc, 0); |
42 |
++#else |
43 |
+ setup_timer(&rate_timer, rate_timer_calc, 0); |
44 |
++#endif |
45 |
+ mod_timer(&rate_timer, jiffies + (HZ * SAMPLERATE)); |
46 |
+ |
47 |
+ peakflows_at = jiffies; |
48 |
|
49 |
diff --git a/net-firewall/ipt_netflow/ipt_netflow-2.2-r3.ebuild b/net-firewall/ipt_netflow/ipt_netflow-2.2-r3.ebuild |
50 |
new file mode 100644 |
51 |
index 00000000000..b2bda0e5889 |
52 |
--- /dev/null |
53 |
+++ b/net-firewall/ipt_netflow/ipt_netflow-2.2-r3.ebuild |
54 |
@@ -0,0 +1,102 @@ |
55 |
+# Copyright 1999-2018 Gentoo Foundation |
56 |
+# Distributed under the terms of the GNU General Public License v2 |
57 |
+ |
58 |
+EAPI=6 |
59 |
+MY_PN="${PN/_/-}" |
60 |
+MY_P="${MY_PN}-${PV}" |
61 |
+inherit linux-info linux-mod toolchain-funcs |
62 |
+ |
63 |
+DESCRIPTION="Netflow iptables module" |
64 |
+HOMEPAGE="https://sourceforge.net/projects/ipt-netflow" |
65 |
+SRC_URI="mirror://sourceforge/${MY_PN}/${MY_P}.tgz" |
66 |
+ |
67 |
+LICENSE="GPL-2" |
68 |
+SLOT="0" |
69 |
+KEYWORDS="~amd64 ~x86" |
70 |
+ |
71 |
+IUSE="debug natevents snmp" |
72 |
+ |
73 |
+RDEPEND=" |
74 |
+ net-firewall/iptables |
75 |
+ snmp? ( net-analyzer/net-snmp ) |
76 |
+" |
77 |
+DEPEND="${RDEPEND} |
78 |
+ virtual/linux-sources |
79 |
+ virtual/pkgconfig |
80 |
+" |
81 |
+ |
82 |
+# set S before MODULE_NAMES |
83 |
+S="${WORKDIR}/${MY_P}" |
84 |
+PATCHES=( |
85 |
+ # bug #455984 |
86 |
+ "${FILESDIR}/${PN}-2.0-configure.patch" |
87 |
+ # Compatibility with kernel 4.6 |
88 |
+ "${FILESDIR}/${P}-linux-4.6.patch" |
89 |
+ # Compatibility with kernel 4.10, bug #617484 |
90 |
+ "${FILESDIR}/${P}-linux-4.10.patch" |
91 |
+ # Compatibility with kernel 4.13, bug #630446 |
92 |
+ "${FILESDIR}/${P}-linux-4.13.patch" |
93 |
+ # Compatibility with kernel 4.15, bug #646798 |
94 |
+ "${FILESDIR}/${P}-linux-4.15.patch" |
95 |
+) |
96 |
+ |
97 |
+pkg_setup() { |
98 |
+ BUILD_TARGETS="all" |
99 |
+ MODULE_NAMES="ipt_NETFLOW(ipt_netflow:${S})" |
100 |
+ IPT_LIB="/usr/$(get_libdir)/xtables" |
101 |
+ local CONFIG_CHECK="~IP_NF_IPTABLES" |
102 |
+ use debug && CONFIG_CHECK+=" ~DEBUG_FS" |
103 |
+ use natevents && CONFIG_CHECK+=" NF_CONNTRACK_EVENTS NF_NAT_NEEDED" |
104 |
+ linux-mod_pkg_setup |
105 |
+} |
106 |
+ |
107 |
+src_prepare() { |
108 |
+ sed -i \ |
109 |
+ -e 's:make -C:$(MAKE) -C:g' \ |
110 |
+ -e 's:gcc -O2:$(CC) $(CFLAGS) $(LDFLAGS):' \ |
111 |
+ -e 's:gcc:$(CC) $(CFLAGS) $(LDFLAGS):' \ |
112 |
+ Makefile.in || die |
113 |
+ |
114 |
+ # Checking for directory is enough |
115 |
+ sed -i -e 's:-s /etc/snmp/snmpd.conf:-d /etc/snmp:' configure || die |
116 |
+ |
117 |
+ default |
118 |
+} |
119 |
+ |
120 |
+do_conf() { |
121 |
+ echo ./configure $* |
122 |
+ ./configure $* ${EXTRA_ECONF} || die 'configure failed' |
123 |
+} |
124 |
+ |
125 |
+src_configure() { |
126 |
+ local IPT_VERSION="$($(tc-getPKG_CONFIG) --modversion xtables)" |
127 |
+ # this configure script is not based on autotools |
128 |
+ # ipt-src need to be defined, see bug #455984 |
129 |
+ do_conf \ |
130 |
+ --disable-dkms \ |
131 |
+ --enable-aggregation \ |
132 |
+ --enable-direction \ |
133 |
+ --enable-macaddress \ |
134 |
+ --enable-vlan \ |
135 |
+ --ipt-lib="${IPT_LIB}" \ |
136 |
+ --ipt-src="/usr/" \ |
137 |
+ --ipt-ver="${IPT_VERSION}" \ |
138 |
+ --kdir="${KV_DIR}" \ |
139 |
+ --kver="${KV_FULL}" \ |
140 |
+ $(use debug && echo '--enable-debugfs') \ |
141 |
+ $(use natevents && echo '--enable-natevents') \ |
142 |
+ $(use snmp && echo '--enable-snmp-rules' || echo '--disable-snmp-agent') |
143 |
+} |
144 |
+ |
145 |
+src_compile() { |
146 |
+ emake ARCH="$(tc-arch-kernel)" CC="$(tc-getCC)" all |
147 |
+} |
148 |
+ |
149 |
+src_install() { |
150 |
+ linux-mod_src_install |
151 |
+ exeinto "${IPT_LIB}" |
152 |
+ doexe libipt_NETFLOW.so |
153 |
+ use snmp && emake DESTDIR="${D}" SNMPTGSO="/usr/$(get_libdir)/snmp/dlmod/snmp_NETFLOW.so" sinstall |
154 |
+ doheader ipt_NETFLOW.h |
155 |
+ dodoc README* |
156 |
+} |