net-analyzer/fragroute: Fix pcap_open clash

Package-Manager: Portage-2.3.60, Repoman-2.3.12
Fixes: https://bugs.gentoo.org/662474
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
This commit is contained in:
Jeroen Roovers
2019-02-17 15:17:54 +01:00
parent 3727f0f9d8
commit e2c5f5be51
2 changed files with 91 additions and 0 deletions
@@ -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, ...);
@@ -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
}