net-misc/ip-sentinel: Fix compile error when non-dietlibc is used

(Add upstream patch)

Also:
- EAPI=7
- Shorten DESCRIPTION
- Use HTTPS in HOMEPAGE
- Fix bashism in init.d script (echo -n => printf)
- Disable failing src/testsuite/prioqueue-check.sh based tests

Package-Manager: Portage-2.3.100, Repoman-2.3.22
Closes: https://bugs.gentoo.org/725176
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
This commit is contained in:
Jeroen Roovers
2020-05-31 10:39:43 +02:00
parent e67b3f7711
commit fd39764e29
3 changed files with 179 additions and 2 deletions

View File

@@ -0,0 +1,100 @@
From ecf89e635de8778ebbf901279f7672e2c15e4ecb Mon Sep 17 00:00:00 2001
From: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Date: Fri, 1 Aug 2008 09:20:46 +0200
Subject: fixed dietlibc compatibility stuff
removed lot of compatibility stuff which was needed for ancient
dietlibc version.
---
src/compat.h | 31 ++-----------------------------
src/util.h | 2 +-
src/wrappers.h | 1 +
3 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/src/compat.h b/src/compat.h
index c180185..c6fb409 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -19,22 +19,8 @@
#ifndef H_ENSC_IPSENTINEL_SRC_COMPAT_H
#define H_ENSC_IPSENTINEL_SRC_COMPAT_H
-#if defined(__dietlibc__) && !defined(ENSC_DIETLIBC_C99) && defined(__STRICT_ANSI__) && defined(__STDC_VERSION__)
- // fixed in 0.25+
-# include <sys/cdefs.h>
-# undef inline
-
-# undef __STRICT_ANSI__
-# include <stdint.h>
-# define __STRICT_ANSI__
-#endif
-
#ifdef __dietlibc__
- // fixed in 0.27+
-# define ethhdr ethhdrX
-# include <net/ethernet.h>
-# undef ethhdr
-
+struct ether_addr;
# ifndef HAVE_DIET_ETHER_NTOA
char * ether_ntoa(struct ether_addr const *addr);
# endif
@@ -44,22 +30,9 @@ struct ether_addr * ether_aton_r(const char *asc, struct ether_addr *addr);
# endif
#endif
-
-#ifndef __dietlibc__
-# include <stropts.h>
-#else
-# include <sys/ioctl.h>
-#endif
-
-#ifdef __dietlibc__
-# define sin XsinX
-#endif
-#include <netinet/in.h>
-#undef sin
-
-
#ifdef __dietlibc__
#include <net/if_arp.h>
+#include <net/ethernet.h>
#include <stdint.h>
struct ether_arp {
diff --git a/src/util.h b/src/util.h
index 20381e3..adfe3a6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -25,7 +25,6 @@
#include <unistd.h>
#include <net/ethernet.h>
-
/*@-namechecks@*/
#ifndef __cplusplus
# define cAsT_(X) (X))
@@ -77,6 +76,7 @@ xstrcat(char **dst, size_t *cnt, char const *src)
xstrcatn(dst, cnt, src, strlen(src));
}
+struct in_addr;
void writeUInt(int fd, unsigned int nr);
void writeMsgTimestamp(int fd);
void writeIP(int fd, struct in_addr);
diff --git a/src/wrappers.h b/src/wrappers.h
index e1be0ad..5548702 100644
--- a/src/wrappers.h
+++ b/src/wrappers.h
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <fcntl.h>
#include <pwd.h>
#include <errno.h>
--
cgit v1.2.1

View File

@@ -1,5 +1,5 @@
#!/sbin/openrc-run
# Copyright 1999-2006 Gentoo Foundation
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
CFG_FILE="/etc/ip-sentinel.cfg"
@@ -40,7 +40,7 @@ restart () {
echo "Please, wait while child process quit..."
while `ps aux | grep -v 'init.d' | grep [i]p-sentinel >/dev/null`
do
echo -n ". "
printf ". "
sleep 1
done
echo "[Done]"

View File

@@ -0,0 +1,77 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit user
DESCRIPTION="Prevent unauthorized usage of IP addresses"
HOMEPAGE="https://www.nongnu.org/ip-sentinel/"
LICENSE="GPL-2"
SRC_URI="https://savannah.nongnu.org/download/ip-sentinel/${P}.tar.bz2"
SLOT="0"
KEYWORDS="~x86"
DOCS=( AUTHORS ChangeLog NEWS README THANKS )
PATCHES=(
"${FILESDIR}"/${P}-fixed-dietlibc-compat-stuff.patch
)
pkg_setup() {
enewgroup ipsentinel
enewuser ipsentinel -1 -1 -1 ipsentinel
}
src_prepare() {
default
# disable failing tests
echo true > src/testsuite/prioqueue-check.sh
}
src_install() {
default
newinitd "${FILESDIR}"/ip-sentinel.init ip-sentinel
newconfd "${FILESDIR}"/ip-sentinel.conf.d ip-sentinel
insinto /etc
newins "${FILESDIR}"/ip-sentinel.cfg ip-sentinel.cfg
}
pkg_config() {
CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/ip-sentinel 2>/dev/null`
if [ ! -d "${CHROOT:=/chroot/ip-sentinel}" ] ; then
ebegin "Setting up the chroot directory"
mkdir -m 0755 -p "${CHROOT}/etc"
cp -R /etc/ip-sentinel.cfg "${CHROOT}/etc"
eend
if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/ip-sentinel`" ] ; then
sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \
-i /etc/conf.d/ip-sentinel
fi
else
eerror
eerror "${CHROOT} already exists. Quitting."
eerror
fi
}
pkg_postinst() {
elog "You can edit /etc/conf.d/ip-sentinel to customize startup daemon"
elog "settings."
elog
elog "Default ip-sentinel config is in /etc/ip-sentinel.cfg"
elog
elog "The ip-sentinel ebuild has chroot support."
elog "If you like to run ip-sentinel in chroot AND this is a new install OR"
elog "your ip-sentinel doesn't already run in chroot, simply run:"
elog "emerge --config =${CATEGORY}/${PF}"
elog "Before running the above command you might want to change the chroot"
elog "dir in /etc/conf.d/ip-sentinel, otherwise /chroot/ip-sentinel will be used."
echo
ewarn "And please! DO NOT START THIS DAEMON thoughtlessly."
ewarn "If you DO this will BLOCK ALL communication inside your ethernet"
ewarn "segment!!! If you have any doubts do not start ip-sentinel."
}