commit:     d11c3c63ed8d283c32118a3dfb7a2de67644f20d
Author:     Brahmajit Das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Fri May  3 17:42:12 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Apr  6 17:58:28 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d11c3c63

net-analyzer/hunt: Fix passing of incompatible pointer type

And update EAPI 7 -> 8

Closes: https://bugs.gentoo.org/919471
Signed-off-by: Brahmajit Das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36526
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 .../hunt/files/hunt-1.5-c99-build-fix.patch        | 59 ++++++++++++++++++++++
 net-analyzer/hunt/hunt-1.5_p6_p1-r1.ebuild         | 44 ++++++++++++++++
 2 files changed, 103 insertions(+)

diff --git a/net-analyzer/hunt/files/hunt-1.5-c99-build-fix.patch 
b/net-analyzer/hunt/files/hunt-1.5-c99-build-fix.patch
new file mode 100644
index 000000000000..ef031f45c4e9
--- /dev/null
+++ b/net-analyzer/hunt/files/hunt-1.5-c99-build-fix.patch
@@ -0,0 +1,59 @@
+Bug: https://bugs.gentoo.org/919471
+From: Brahmajit Das <[email protected]>
+Date: Fri, 3 May 2024 17:26:49 +0530
+Subject: [PATCH 1/1] Fix c99 build errors.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 14 (and above) has enabled some compiler flags by default,
+-Wincompatible-pointer-types being one of them. These results in build
+time errors such as
+
+tpserv.c:161:32: error: passing argument 2 of ‘connect’ from incompatible 
pointer type [-Wincompatible-pointer-types]
+  161 |         if (connect(fd_remote, to_addr, to_addr_len) < 0) {
+      |                                ^~~~~~~
+      |                                |
+      |                                struct sockaddr_in *
+In file included from tpserv.c:11:
+/usr/include/sys/socket.h:126:52: note: expected ‘const struct sockaddr *’ but 
argument is of type ‘struct sockaddr_in *’
+
+TODO: Find better ways other than type casting.
+Type casting is the only way for now, as chaning the parameter type in
+function defenition would require touching many other parts of the code
+that I'm unfamiliar with.
+
+First reported on Gentoo Linux with GCC 14, please reffer
+https://bugs.gentoo.org/919471 for more details.
+
+Signed-off-by: Brahmajit Das <[email protected]>
+--- a/tpserv/tpserv.c
++++ b/tpserv/tpserv.c
+@@ -148,7 +148,8 @@ static void process_request_connect(int fd, int pid, 
struct sockaddr_in *from_ad
+ {
+       char buf[BUFSIZE];
+       struct sockaddr_in local_addr;
+-      int to_addr_len, local_addr_len;
++      int to_addr_len;
++      socklen_t local_addr_len;
+       fd_set rset;
+       int maxfd, len;
+       int fd_remote;
+@@ -158,7 +159,13 @@ static void process_request_connect(int fd, int pid, 
struct sockaddr_in *from_ad
+               exit(1);
+       }
+       to_addr_len = sizeof(*to_addr);
+-      if (connect(fd_remote, to_addr, to_addr_len) < 0) {
++      /*
++       *TODO: Find better ways other than type casting.
++       *Type casting is the only way for now, as chaning the parameter type in
++       *function defenition would require touching many other parts of the 
code
++       *that I'm unfamiliar with.
++       */
++      if (connect(fd_remote, (const struct sockaddr *)to_addr, to_addr_len) < 
0) {
+               hunt_log(LOG_ERR, pid, "failed to connect to remote addr\n");
+               exit(1);
+       }
+-- 
+2.45.0.rc1.218.g7b19149425.dirty
+

diff --git a/net-analyzer/hunt/hunt-1.5_p6_p1-r1.ebuild 
b/net-analyzer/hunt/hunt-1.5_p6_p1-r1.ebuild
new file mode 100644
index 000000000000..362ad35f6ba9
--- /dev/null
+++ b/net-analyzer/hunt/hunt-1.5_p6_p1-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Tool for checking well known weaknesses in the TCP/IP protocol"
+HOMEPAGE="http://lin.fsid.cvut.cz/~kra/index.html";
+SRC_URI="
+       mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV/_p*}.orig.tar.gz
+       mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV/_p*}-$(ver_cut 
4).$(ver_cut 6).diff.gz"
+S="${WORKDIR}/${P/_p*}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+PATCHES=(
+       "${WORKDIR}"/${PN}_1.5-6.1.diff
+       "${FILESDIR}"/${P/_p*}-exit.patch
+       "${FILESDIR}"/${P/_p*}-gentoo.patch
+       "${FILESDIR}"/${P/_p*}-log2.patch
+       "${FILESDIR}"/${P/_p*}-tpserv-log.patch
+       "${FILESDIR}"/${P/_p*}-c99-build-fix.patch
+)
+
+src_configure() {
+       append-cppflags -DSYNC_FAST
+}
+
+src_compile() {
+       local target
+       for target in . tpserv; do
+               emake CC="$(tc-getCC)" LDFLAGS="${CFLAGS} ${LDFLAGS}" -C 
"${target}"
+       done
+}
+
+src_install() {
+       dosbin hunt tpserv/tpserv tpsetup/transproxy
+       doman man/hunt.1
+       dodoc CHANGES README* TODO tpsetup/transproxy
+       newdoc debian/changelog debian.changelog
+}

Reply via email to