summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-03-17 03:51:38 +0000
committerSam James <sam@gentoo.org>2024-03-17 03:51:38 +0000
commitf513598b3aa9b1b157d905119472eaaa0b1c9a49 (patch)
tree75a1a6c9ffc786a8f513551f0f16eda1f6c84253 /net-analyzer
parentdev-perl/Net-RawIP: fix modern C issues (diff)
downloadgentoo-f513598b3aa9b1b157d905119472eaaa0b1c9a49.tar.gz
gentoo-f513598b3aa9b1b157d905119472eaaa0b1c9a49.tar.bz2
gentoo-f513598b3aa9b1b157d905119472eaaa0b1c9a49.zip
net-analyzer/fping: fix modern C issue / musl build
Closes: https://bugs.gentoo.org/895182 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-analyzer')
-rw-r--r--net-analyzer/fping/files/fping-5.1-c99-musl.patch39
-rw-r--r--net-analyzer/fping/fping-5.1-r1.ebuild35
2 files changed, 74 insertions, 0 deletions
diff --git a/net-analyzer/fping/files/fping-5.1-c99-musl.patch b/net-analyzer/fping/files/fping-5.1-c99-musl.patch
new file mode 100644
index 000000000000..d56bb501682c
--- /dev/null
+++ b/net-analyzer/fping/files/fping-5.1-c99-musl.patch
@@ -0,0 +1,39 @@
+https://bugs.gentoo.org/895182
+https://github.com/schweikert/fping/commit/c0fbccb977c523ba671afdf0f37de40d26351f77
+
+From c0fbccb977c523ba671afdf0f37de40d26351f77 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 29 Aug 2022 15:41:51 -0700
+Subject: [PATCH] fping: Initialize msghdr struct in a portable way
+
+Initializing the structure assuming glibc layout results in
+compile errors on musl, therefore do partial intialization and then
+assigning the members individually.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/src/fping.c
++++ b/src/fping.c
+@@ -1962,15 +1962,13 @@ int receive_packet(int64_t wait_time,
+ reply_buf,
+ reply_buf_len
+ };
+- struct msghdr recv_msghdr = {
+- reply_src_addr,
+- reply_src_addr_len,
+- &msg_iov,
+- 1,
+- &msg_control,
+- sizeof(msg_control),
+- 0
+- };
++ struct msghdr recv_msghdr = {0};
++ recv_msghdr.msg_name = reply_src_addr;
++ recv_msghdr.msg_namelen = reply_src_addr_len;
++ recv_msghdr.msg_iov = &msg_iov;
++ recv_msghdr.msg_iovlen = 1;
++ recv_msghdr.msg_control = &msg_control;
++ recv_msghdr.msg_controllen = sizeof(msg_control);
+ #if HAVE_SO_TIMESTAMPNS
+ struct cmsghdr *cmsg;
+ #endif
+
diff --git a/net-analyzer/fping/fping-5.1-r1.ebuild b/net-analyzer/fping/fping-5.1-r1.ebuild
new file mode 100644
index 000000000000..ddd1e6978d3a
--- /dev/null
+++ b/net-analyzer/fping/fping-5.1-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fcaps
+
+DESCRIPTION="A utility to ping multiple hosts at once"
+HOMEPAGE="https://fping.org/ https://github.com/schweikert/fping/"
+SRC_URI="https://fping.org/dist/${P}.tar.gz"
+
+LICENSE="fping"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="suid"
+
+FILECAPS=( cap_net_raw+ep usr/sbin/fping )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.1-c99-musl.patch
+)
+
+src_configure() {
+ econf --enable-ipv6
+}
+
+src_install() {
+ default
+
+ if use suid; then
+ fperms u+s /usr/sbin/fping
+ fi
+
+ dosym fping /usr/sbin/fping6
+}