net-analyzer/fragroute: Fix pcap_open clash
authorJeroen Roovers <jer@gentoo.org>
Sun, 17 Feb 2019 14:15:34 +0000 (15:15 +0100)
committerJeroen Roovers <jer@gentoo.org>
Sun, 17 Feb 2019 14:17:54 +0000 (15:17 +0100)
Package-Manager: Portage-2.3.60, Repoman-2.3.12
Fixes: https://bugs.gentoo.org/662474
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
net-analyzer/fragroute/files/fragroute-1.2.6-pcap_open.patch [new file with mode: 0644]
net-analyzer/fragroute/fragroute-1.2.6-r1.ebuild [new file with mode: 0644]

diff --git a/net-analyzer/fragroute/files/fragroute-1.2.6-pcap_open.patch b/net-analyzer/fragroute/files/fragroute-1.2.6-pcap_open.patch
new file mode 100644 (file)
index 0000000..6dedb53
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/fragtest.c
++++ b/fragtest.c
+@@ -458,7 +458,7 @@
+       if ((ctx.ip = ip_open()) == NULL)
+               err(1, "couldn't open raw IP interface");
+-      if ((ctx.pcap = pcap_open(ifent.intf_name)) == NULL)
++      if ((ctx.pcap = fragroute_pcap_open(ifent.intf_name)) == NULL)
+               err(1, "couldn't open %s for sniffing", ifent.intf_name);
+       
+       if ((ctx.dloff = pcap_dloff(ctx.pcap)) < 0)
+--- a/tun-loop.c
++++ b/tun-loop.c
+@@ -331,7 +331,7 @@
+               return (tun_close(tun));
+       
+       /* Set up to sniff on loopback. */
+-      if ((tun->pcap = pcap_open(tun->ifent->intf_name)) == NULL)
++      if ((tun->pcap = fragroute_pcap_open(tun->ifent->intf_name)) == NULL)
+               return (tun_close(tun));
+       
+       if (pcap_filter(tun->pcap, "ip dst %s", addr_ntoa(dst)) < 0)
+--- a/pcaputil.c
++++ b/pcaputil.c
+@@ -27,7 +27,7 @@
+ #include "pcaputil.h"
+ pcap_t *
+-pcap_open(char *device)
++fragroute_pcap_open(char *device)
+ {
+       char ebuf[PCAP_ERRBUF_SIZE];
+       pcap_t *pcap;
+--- a/pcaputil.h
++++ b/pcaputil.h
+@@ -9,7 +9,7 @@
+ #ifndef PCAPUTIL_H
+ #define PCAPUTIL_H
+-pcap_t *pcap_open(char *device);
++pcap_t *fragroute_pcap_open(char *device);
+ int   pcap_dloff(pcap_t *pcap);
+ int   pcap_filter(pcap_t *pcap, const char *fmt, ...);
diff --git a/net-analyzer/fragroute/fragroute-1.2.6-r1.ebuild b/net-analyzer/fragroute/fragroute-1.2.6-r1.ebuild
new file mode 100644 (file)
index 0000000..d432afe
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+MY_P="${P}-ipv6"
+
+inherit autotools
+
+DESCRIPTION="Testing of network intrusion detection systems, firewalls and TCP/IP stacks"
+HOMEPAGE="https://github.com/stsi/fragroute-ipv6"
+SRC_URI="https://fragroute-ipv6.googlecode.com/files/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+
+RDEPEND="
+       dev-libs/libevent
+       net-libs/libpcap
+       >=dev-libs/libdnet-1.12[ipv6]
+"
+DEPEND="
+       ${RDEPEND}
+       virtual/awk
+"
+DOCS=( INSTALL README TODO )
+PATCHES=(
+       "${FILESDIR}"/${P}-pcap_open.patch
+)
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+       default
+       # Remove broken and old files, autotools will regen needed files
+       rm *.m4 acconfig.h missing Makefile.in || die
+       # Add missing includes
+       sed -i -e "/#define IPUTIL_H/a#include <stdio.h>\n#include <stdint.h>" iputil.h || die
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               --with-libdnet="${EPREFIX}"/usr \
+               --with-libevent="${EPREFIX}"/usr \
+               --with-libpcap="${EPREFIX}"/usr
+}