Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-firewall/nftlb/files/, net-firewall/nftlb/
Date: Tue, 31 Jan 2023 23:53:24
Message-Id: 1675209195.380e498e2f0e5177be1e0aab3693e1dd716b9a50.chutzpah@gentoo
1 commit: 380e498e2f0e5177be1e0aab3693e1dd716b9a50
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 31 23:52:55 2023 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 31 23:53:15 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=380e498e
7
8 net-firewall/nftlb: add 1.0.8
9
10 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
11
12 net-firewall/nftlb/Manifest | 1 +
13 net-firewall/nftlb/files/nftlb-1.0.8-musl.patch | 73 ++++++++++++++++++++++++
14 net-firewall/nftlb/files/nftlb-1.0.8-tests.patch | 45 +++++++++++++++
15 net-firewall/nftlb/nftlb-1.0.8.ebuild | 64 +++++++++++++++++++++
16 4 files changed, 183 insertions(+)
17
18 diff --git a/net-firewall/nftlb/Manifest b/net-firewall/nftlb/Manifest
19 index 4f11c545f7eb..3834aa2431d2 100644
20 --- a/net-firewall/nftlb/Manifest
21 +++ b/net-firewall/nftlb/Manifest
22 @@ -1,3 +1,4 @@
23 DIST nftlb-1.0.4.tar.gz 199236 BLAKE2B 457fc617af75513330b7c6730a3ee67061d5df4d1faf74a0d57ffaa7ef003e882136a9e0300fe61f1f0235ef752a5d695cfdf9a5e1cecf9b57553d4c9151bfd6 SHA512 89b0dba85029236f55289818c7b7ec6fe6e2e1f33003fc7fb9fa3ae763b96395827ba9d8134aa4ac80f8be0da6e17be132e9293b46c9264d9c49062e4db6688a
24 DIST nftlb-1.0.6.tar.gz 201767 BLAKE2B d81607ad88c88f3cf97124bf2db6ad8b210fe8f60d72661094dfbbbfc66c4b911985944f08b5483ceec420850b18cb0fe3a8fd6fa7fb76fa4da456870367cecd SHA512 63fa1e9b5fbd18e5c852adb2415dcd6e24bad899fe647641ea6e8dbca4b7c2808c939bdf5f7700a586304f3126088bb74a0fce79c72e8bc92df1e7a9c111feca
25 DIST nftlb-1.0.7.tar.gz 201988 BLAKE2B 794778523b3a60a351fd071e6ff129197203ddfb1b80823dd6b05c30cb530040da465a10d2ffbf11cad063c2a453bb9baebd6e689b9166d4fcb0fe9fd17760e8 SHA512 eb1e9847f340e57b75a5b8680774d8208b282faccdef48e316b2bd52b10349eeda70643386e0e899d0f6a2f506964cf1b7a7ec2d86279f83ca87a9afa8f047bc
26 +DIST nftlb-1.0.8.gh.tar.gz 256936 BLAKE2B 1ab9fb508c8613304ebde7185a8ad8ddabb483d17c8b872cfb7da8a0b0e5a8d40f74a74361d1d5b8304d45c00357eea1f88f2cc39e5afe537791278277462407 SHA512 f612b7065fb5011f1af34cabe0945b7b0c1479241b4673d86e2e97d06bffdfefcc5ca4ec3ad3752faa92862306ed8ad28754838236476fe9db88099bc389cf7c
27
28 diff --git a/net-firewall/nftlb/files/nftlb-1.0.8-musl.patch b/net-firewall/nftlb/files/nftlb-1.0.8-musl.patch
29 new file mode 100644
30 index 000000000000..75e84b14629b
31 --- /dev/null
32 +++ b/net-firewall/nftlb/files/nftlb-1.0.8-musl.patch
33 @@ -0,0 +1,73 @@
34 +diff --git a/configure.ac b/configure.ac
35 +index 8ec1711..1de7be7 100644
36 +--- a/configure.ac
37 ++++ b/configure.ac
38 +@@ -2,6 +2,7 @@ AC_INIT([nftlb], [1.0.8], [netfilter-devel@×××××××××××.org])
39 +
40 + AC_CONFIG_AUX_DIR([build-aux])
41 + AC_CONFIG_MACRO_DIR([m4])
42 ++AC_CONFIG_HEADERS([config.h])
43 + AM_INIT_AUTOMAKE([-Wall foreign subdir-objects
44 + tar-pax no-dist-gzip dist-bzip2 1.6])
45 +
46 +@@ -25,5 +26,7 @@ AC_CHECK_HEADER([ev.h], [EVENTINC="-include ev.h"],
47 + [EVENTINC="-include libev/ev.h"],
48 + [AC_MSG_ERROR([ev.h not found])])])
49 +
50 ++AC_CHECK_HEADERS([execinfo.h])
51 ++
52 + AC_CONFIG_FILES([Makefile src/Makefile])
53 + AC_OUTPUT
54 +diff --git a/src/main.c b/src/main.c
55 +index 2149e34..9ff3f7b 100644
56 +--- a/src/main.c
57 ++++ b/src/main.c
58 +@@ -18,6 +18,7 @@
59 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
60 + *
61 + */
62 ++#include "config.h"
63 +
64 + #include <stdio.h>
65 + #include <stdlib.h>
66 +@@ -25,6 +26,10 @@
67 + #include <errno.h>
68 + #include <unistd.h>
69 +
70 ++#ifdef HAVE_EXECINFO_H
71 ++ #include <execinfo.h>
72 ++#endif /* HAVE_EXECINFO_H */
73 ++
74 + #include "config.h"
75 + #include "objects.h"
76 + #include "server.h"
77 +@@ -88,6 +93,7 @@ static void nftlb_sighandler(int signo)
78 + exit(EXIT_SUCCESS);
79 + }
80 +
81 ++#ifdef HAVE_EXECINFO_H
82 + static void nftlb_trace() {
83 + int level;
84 +
85 +@@ -100,6 +106,7 @@ static void nftlb_trace() {
86 + if (!obj_recovery())
87 + exit(EXIT_FAILURE);
88 + }
89 ++#endif /* HAVE_EXECINFO_H */
90 +
91 + static int main_process(const char *config, int mode)
92 + {
93 +@@ -189,9 +196,13 @@ int main(int argc, char *argv[])
94 +
95 + if (signal(SIGINT, nftlb_sighandler) == SIG_ERR ||
96 + signal(SIGTERM, nftlb_sighandler) == SIG_ERR ||
97 ++#ifdef HAVE_EXECINFO_H
98 + signal(SIGPIPE, SIG_IGN) == SIG_ERR ||
99 + signal(SIGABRT, nftlb_trace) == SIG_ERR ||
100 + signal(SIGSEGV, nftlb_trace) == SIG_ERR) {
101 ++#else
102 ++ signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
103 ++#endif /* HAVE_EXECINFO_H */
104 + zcu_log_print(LOG_ERR, "Error assigning signals");
105 + return EXIT_FAILURE;
106 + }
107
108 diff --git a/net-firewall/nftlb/files/nftlb-1.0.8-tests.patch b/net-firewall/nftlb/files/nftlb-1.0.8-tests.patch
109 new file mode 100644
110 index 000000000000..2eed096cad15
111 --- /dev/null
112 +++ b/net-firewall/nftlb/files/nftlb-1.0.8-tests.patch
113 @@ -0,0 +1,45 @@
114 +diff --git a/tests/config_exec/exec_tests.sh b/tests/config_exec/exec_tests.sh
115 +index f63950e..a55b467 100755
116 +--- a/tests/config_exec/exec_tests.sh
117 ++++ b/tests/config_exec/exec_tests.sh
118 +@@ -36,6 +36,8 @@ fi
119 +
120 + echo "-- Executing configuration tests"
121 +
122 ++retval=0
123 ++
124 + for test in `ls -d ${TESTS}`; do
125 + if [[ ! ${test} =~ ^..._ ]]; then
126 + continue;
127 +@@ -58,6 +60,7 @@ for test in `ls -d ${TESTS}`; do
128 +
129 + if [ $statusexec -ne 0 ]; then
130 + echo -e "\e[31mNFT EXEC ERROR\e[0m"
131 ++ retval=1
132 + continue;
133 + fi
134 +
135 +@@ -65,6 +68,7 @@ for test in `ls -d ${TESTS}`; do
136 +
137 + if [ ! -f ${outputfile} ]; then
138 + echo "Dump file doesn't exist"
139 ++ retval=1
140 + continue;
141 + fi
142 +
143 +@@ -76,6 +80,7 @@ for test in `ls -d ${TESTS}`; do
144 + rm -f ${reportfile}
145 + else
146 + echo -e "\e[31mNFT DUMP ERROR\e[0m"
147 ++ retval=1
148 + if [ $APPLY_REPORTS -eq 1 ]; then
149 + cat ${reportfile} > ${outputfile}
150 + echo -e "APPLIED"
151 +@@ -89,4 +94,7 @@ fi
152 +
153 + if [ "`grep 'nft command error' /var/log/syslog`" != "" ]; then
154 + echo -e "\e[33m* command errors found, please check syslog\e[0m"
155 ++ retval=1
156 + fi
157 ++
158 ++exit ${retval}
159
160 diff --git a/net-firewall/nftlb/nftlb-1.0.8.ebuild b/net-firewall/nftlb/nftlb-1.0.8.ebuild
161 new file mode 100644
162 index 000000000000..d95684584df6
163 --- /dev/null
164 +++ b/net-firewall/nftlb/nftlb-1.0.8.ebuild
165 @@ -0,0 +1,64 @@
166 +# Copyright 2020-2023 Gentoo Authors
167 +# Distributed under the terms of the GNU General Public License v2
168 +
169 +EAPI=8
170 +
171 +inherit linux-info autotools
172 +
173 +DESCRIPTION="nftables load balancer"
174 +HOMEPAGE="https://github.com/zevenet/nftlb"
175 +SRC_URI="https://github.com/zevenet/${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
176 +
177 +LICENSE="AGPL-3"
178 +SLOT="0"
179 +KEYWORDS="~amd64 ~x86"
180 +
181 +DEPEND="
182 + net-firewall/nftables:=[modern-kernel]
183 + dev-libs/jansson:=
184 + dev-libs/libev:=
185 +"
186 +RDEPEND="${DEPEND}"
187 +
188 +# tests need root access
189 +RESTRICT="test"
190 +
191 +PATCHES=(
192 + "${FILESDIR}/nftlb-1.0.8-tests.patch"
193 + "${FILESDIR}/nftlb-1.0.8-musl.patch"
194 +)
195 +
196 +pkg_setup() {
197 + local CONFIG_CHECK="
198 + ~NF_TABLES
199 + ~NFT_NUMGEN
200 + ~NFT_HASH
201 + ~NF_NAT
202 + ~IP_NF_NAT
203 + "
204 +
205 + linux-info_pkg_setup
206 +
207 + if kernel_is lt 4 19; then
208 + eerror "${PN} requires kernel version 4.19 or newer"
209 + fi
210 +}
211 +
212 +src_prepare() {
213 + # there are some compiler artifacts in the tarball
214 + find "${S}" -name '*.o' -delete || die
215 +
216 + default
217 + eautoreconf
218 +}
219 +
220 +src_test() {
221 + pushd tests >/dev/null || die
222 +
223 + sed -e "s:/var/log/syslog:\"${T}/tests.log\":" \
224 + -i exec_tests.sh || die
225 +
226 + ./exec_tests.sh || die "tests failed"
227 +
228 + popd >/dev/null || die
229 +}