Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/ip-sentinel/, net-misc/ip-sentinel/files/
Date: Sun, 31 May 2020 08:44:36
Message-Id: 1590914661.fd39764e29352cda5c48f49c4f1aaa7046e274d9.jer@gentoo
1 commit: fd39764e29352cda5c48f49c4f1aaa7046e274d9
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 31 08:39:43 2020 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sun May 31 08:44:21 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd39764e
7
8 net-misc/ip-sentinel: Fix compile error when non-dietlibc is used
9
10 (Add upstream patch)
11
12 Also:
13 - EAPI=7
14 - Shorten DESCRIPTION
15 - Use HTTPS in HOMEPAGE
16 - Fix bashism in init.d script (echo -n => printf)
17 - Disable failing src/testsuite/prioqueue-check.sh based tests
18
19 Package-Manager: Portage-2.3.100, Repoman-2.3.22
20 Closes: https://bugs.gentoo.org/725176
21 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
22
23 ...sentinel-0.12-fixed-dietlibc-compat-stuff.patch | 100 +++++++++++++++++++++
24 net-misc/ip-sentinel/files/ip-sentinel.init | 4 +-
25 net-misc/ip-sentinel/ip-sentinel-0.12-r1.ebuild | 77 ++++++++++++++++
26 3 files changed, 179 insertions(+), 2 deletions(-)
27
28 diff --git a/net-misc/ip-sentinel/files/ip-sentinel-0.12-fixed-dietlibc-compat-stuff.patch b/net-misc/ip-sentinel/files/ip-sentinel-0.12-fixed-dietlibc-compat-stuff.patch
29 new file mode 100644
30 index 00000000000..051956366fe
31 --- /dev/null
32 +++ b/net-misc/ip-sentinel/files/ip-sentinel-0.12-fixed-dietlibc-compat-stuff.patch
33 @@ -0,0 +1,100 @@
34 +From ecf89e635de8778ebbf901279f7672e2c15e4ecb Mon Sep 17 00:00:00 2001
35 +From: Enrico Scholz <enrico.scholz@××××××××××××××××××××××.de>
36 +Date: Fri, 1 Aug 2008 09:20:46 +0200
37 +Subject: fixed dietlibc compatibility stuff
38 +
39 +removed lot of compatibility stuff which was needed for ancient
40 +dietlibc version.
41 +---
42 + src/compat.h | 31 ++-----------------------------
43 + src/util.h | 2 +-
44 + src/wrappers.h | 1 +
45 + 3 files changed, 4 insertions(+), 30 deletions(-)
46 +
47 +diff --git a/src/compat.h b/src/compat.h
48 +index c180185..c6fb409 100644
49 +--- a/src/compat.h
50 ++++ b/src/compat.h
51 +@@ -19,22 +19,8 @@
52 + #ifndef H_ENSC_IPSENTINEL_SRC_COMPAT_H
53 + #define H_ENSC_IPSENTINEL_SRC_COMPAT_H
54 +
55 +-#if defined(__dietlibc__) && !defined(ENSC_DIETLIBC_C99) && defined(__STRICT_ANSI__) && defined(__STDC_VERSION__)
56 +- // fixed in 0.25+
57 +-# include <sys/cdefs.h>
58 +-# undef inline
59 +-
60 +-# undef __STRICT_ANSI__
61 +-# include <stdint.h>
62 +-# define __STRICT_ANSI__
63 +-#endif
64 +-
65 + #ifdef __dietlibc__
66 +- // fixed in 0.27+
67 +-# define ethhdr ethhdrX
68 +-# include <net/ethernet.h>
69 +-# undef ethhdr
70 +-
71 ++struct ether_addr;
72 + # ifndef HAVE_DIET_ETHER_NTOA
73 + char * ether_ntoa(struct ether_addr const *addr);
74 + # endif
75 +@@ -44,22 +30,9 @@ struct ether_addr * ether_aton_r(const char *asc, struct ether_addr *addr);
76 + # endif
77 + #endif
78 +
79 +-
80 +-#ifndef __dietlibc__
81 +-# include <stropts.h>
82 +-#else
83 +-# include <sys/ioctl.h>
84 +-#endif
85 +-
86 +-#ifdef __dietlibc__
87 +-# define sin XsinX
88 +-#endif
89 +-#include <netinet/in.h>
90 +-#undef sin
91 +-
92 +-
93 + #ifdef __dietlibc__
94 + #include <net/if_arp.h>
95 ++#include <net/ethernet.h>
96 + #include <stdint.h>
97 +
98 + struct ether_arp {
99 +diff --git a/src/util.h b/src/util.h
100 +index 20381e3..adfe3a6 100644
101 +--- a/src/util.h
102 ++++ b/src/util.h
103 +@@ -25,7 +25,6 @@
104 + #include <unistd.h>
105 + #include <net/ethernet.h>
106 +
107 +-
108 + /*@-namechecks@*/
109 + #ifndef __cplusplus
110 + # define cAsT_(X) (X))
111 +@@ -77,6 +76,7 @@ xstrcat(char **dst, size_t *cnt, char const *src)
112 + xstrcatn(dst, cnt, src, strlen(src));
113 + }
114 +
115 ++struct in_addr;
116 + void writeUInt(int fd, unsigned int nr);
117 + void writeMsgTimestamp(int fd);
118 + void writeIP(int fd, struct in_addr);
119 +diff --git a/src/wrappers.h b/src/wrappers.h
120 +index e1be0ad..5548702 100644
121 +--- a/src/wrappers.h
122 ++++ b/src/wrappers.h
123 +@@ -24,6 +24,7 @@
124 + #include <sys/types.h>
125 + #include <sys/socket.h>
126 + #include <sys/stat.h>
127 ++#include <sys/ioctl.h>
128 + #include <fcntl.h>
129 + #include <pwd.h>
130 + #include <errno.h>
131 +--
132 +cgit v1.2.1
133 +
134
135 diff --git a/net-misc/ip-sentinel/files/ip-sentinel.init b/net-misc/ip-sentinel/files/ip-sentinel.init
136 index 923cedeac13..c839ca61d69 100644
137 --- a/net-misc/ip-sentinel/files/ip-sentinel.init
138 +++ b/net-misc/ip-sentinel/files/ip-sentinel.init
139 @@ -1,5 +1,5 @@
140 #!/sbin/openrc-run
141 -# Copyright 1999-2006 Gentoo Foundation
142 +# Copyright 1999-2020 Gentoo Authors
143 # Distributed under the terms of the GNU General Public License v2
144
145 CFG_FILE="/etc/ip-sentinel.cfg"
146 @@ -40,7 +40,7 @@ restart () {
147 echo "Please, wait while child process quit..."
148 while `ps aux | grep -v 'init.d' | grep [i]p-sentinel >/dev/null`
149 do
150 - echo -n ". "
151 + printf ". "
152 sleep 1
153 done
154 echo "[Done]"
155
156 diff --git a/net-misc/ip-sentinel/ip-sentinel-0.12-r1.ebuild b/net-misc/ip-sentinel/ip-sentinel-0.12-r1.ebuild
157 new file mode 100644
158 index 00000000000..76e2d1db7e7
159 --- /dev/null
160 +++ b/net-misc/ip-sentinel/ip-sentinel-0.12-r1.ebuild
161 @@ -0,0 +1,77 @@
162 +# Copyright 1999-2020 Gentoo Authors
163 +# Distributed under the terms of the GNU General Public License v2
164 +
165 +EAPI=7
166 +inherit user
167 +
168 +DESCRIPTION="Prevent unauthorized usage of IP addresses"
169 +HOMEPAGE="https://www.nongnu.org/ip-sentinel/"
170 +LICENSE="GPL-2"
171 +SRC_URI="https://savannah.nongnu.org/download/ip-sentinel/${P}.tar.bz2"
172 +SLOT="0"
173 +KEYWORDS="~x86"
174 +
175 +DOCS=( AUTHORS ChangeLog NEWS README THANKS )
176 +PATCHES=(
177 + "${FILESDIR}"/${P}-fixed-dietlibc-compat-stuff.patch
178 +)
179 +
180 +pkg_setup() {
181 + enewgroup ipsentinel
182 + enewuser ipsentinel -1 -1 -1 ipsentinel
183 +}
184 +
185 +src_prepare() {
186 + default
187 +
188 + # disable failing tests
189 + echo true > src/testsuite/prioqueue-check.sh
190 +}
191 +
192 +src_install() {
193 + default
194 +
195 + newinitd "${FILESDIR}"/ip-sentinel.init ip-sentinel
196 + newconfd "${FILESDIR}"/ip-sentinel.conf.d ip-sentinel
197 +
198 + insinto /etc
199 + newins "${FILESDIR}"/ip-sentinel.cfg ip-sentinel.cfg
200 +}
201 +
202 +pkg_config() {
203 + CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/ip-sentinel 2>/dev/null`
204 +
205 + if [ ! -d "${CHROOT:=/chroot/ip-sentinel}" ] ; then
206 + ebegin "Setting up the chroot directory"
207 + mkdir -m 0755 -p "${CHROOT}/etc"
208 + cp -R /etc/ip-sentinel.cfg "${CHROOT}/etc"
209 + eend
210 +
211 + if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/ip-sentinel`" ] ; then
212 + sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \
213 + -i /etc/conf.d/ip-sentinel
214 + fi
215 + else
216 + eerror
217 + eerror "${CHROOT} already exists. Quitting."
218 + eerror
219 + fi
220 +}
221 +
222 +pkg_postinst() {
223 + elog "You can edit /etc/conf.d/ip-sentinel to customize startup daemon"
224 + elog "settings."
225 + elog
226 + elog "Default ip-sentinel config is in /etc/ip-sentinel.cfg"
227 + elog
228 + elog "The ip-sentinel ebuild has chroot support."
229 + elog "If you like to run ip-sentinel in chroot AND this is a new install OR"
230 + elog "your ip-sentinel doesn't already run in chroot, simply run:"
231 + elog "emerge --config =${CATEGORY}/${PF}"
232 + elog "Before running the above command you might want to change the chroot"
233 + elog "dir in /etc/conf.d/ip-sentinel, otherwise /chroot/ip-sentinel will be used."
234 + echo
235 + ewarn "And please! DO NOT START THIS DAEMON thoughtlessly."
236 + ewarn "If you DO this will BLOCK ALL communication inside your ethernet"
237 + ewarn "segment!!! If you have any doubts do not start ip-sentinel."
238 +}