From 4a85fdb364cdd5ecb1195a680bbab65778932c72 Mon Sep 17 00:00:00 2001 From: Jaroslav Škarvada Date: Jul 03 2017 15:36:57 +0000 Subject: Rebuilt for new liburcu Compilation fix --- diff --git a/netsniff-ng-0.6.3-dont-redefine-memcpyset.patch b/netsniff-ng-0.6.3-dont-redefine-memcpyset.patch new file mode 100644 index 0000000..6267378 --- /dev/null +++ b/netsniff-ng-0.6.3-dont-redefine-memcpyset.patch @@ -0,0 +1,65 @@ +From f232545c215022de5be5e0b37e0c7130962cc5d0 Mon Sep 17 00:00:00 2001 +From: Tobias Klauser +Date: Fri, 12 May 2017 18:13:31 +0200 +Subject: [PATCH] built_in: don't redefine memcpy/memset + +Redefining memset/memcpy causes problems when building with fortified +headers on Alpine Linux. Instead of uncoditionally defining these, +explicitely use fmemcpy/fmemset in performance critical paths and +otherwise let the compiler decide about optimizations. + +Fixes #173 +Signed-off-by: Tobias Klauser +--- + built_in.h | 6 ------ + csum.h | 6 +++--- + link.c | 1 + + 3 files changed, 4 insertions(+), 9 deletions(-) + +diff --git a/built_in.h b/built_in.h +index bb247461..da04dbd3 100644 +--- a/built_in.h ++++ b/built_in.h +@@ -322,12 +322,6 @@ static inline u64 cpu_to_le64(u64 val) + #define be32_to_cpu cpu_to_be32 + #define be16_to_cpu cpu_to_be16 + +-#undef memset +-#undef memcpy +- +-#define memset fmemset +-#define memcpy fmemcpy +- + #if defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || \ + defined(_M_X64) || defined(__amd64) + # define CO_IN_CACHE_SHIFT 7 +diff --git a/csum.h b/csum.h +index de76755e..96211c5e 100644 +--- a/csum.h ++++ b/csum.h +@@ -182,10 +182,10 @@ static inline uint16_t p6_csum(const struct ip6_hdr *ip6, const uint8_t *data, + uint8_t proto; + } __packed ph; + +- memcpy(&ph.src, ip6->ip6_src.s6_addr, sizeof(ph.src)); +- memcpy(&ph.dst, ip6->ip6_dst.s6_addr, sizeof(ph.dst)); ++ fmemcpy(&ph.src, ip6->ip6_src.s6_addr, sizeof(ph.src)); ++ fmemcpy(&ph.dst, ip6->ip6_dst.s6_addr, sizeof(ph.dst)); + ph.len = htons(len); +- memset(&ph.mbz, 0, sizeof(ph.mbz)); ++ fmemset(&ph.mbz, 0, sizeof(ph.mbz)); + ph.proto = next_proto; + + vec[0].ptr = (const uint8_t *) (void *) &ph; +diff --git a/link.c b/link.c +index 56b839b4..72f513f7 100644 +--- a/link.c ++++ b/link.c +@@ -1,6 +1,7 @@ + #include + #include + #include ++#include + #include + #include + diff --git a/netsniff-ng.spec b/netsniff-ng.spec index 86d6c97..d73d3b9 100644 --- a/netsniff-ng.spec +++ b/netsniff-ng.spec @@ -6,6 +6,9 @@ Group: Applications/Internet License: GPLv2 URL: http://netsniff-ng.org/ Source0: http://www.netsniff-ng.org/pub/netsniff-ng/netsniff-ng-%{version}.tar.xz +# Patch was taken from upstream: +# https://github.com/netsniff-ng/netsniff-ng/commit/f232545c215022de5be5e0b37e0c7130962cc5d0 +Patch0: netsniff-ng-0.6.3-dont-redefine-memcpyset.patch BuildRequires: ncurses-devel GeoIP-devel libnetfilter_conntrack-devel BuildRequires: userspace-rcu-devel libnl3-devel libcli-devel flex bison BuildRequires: perl-podlators zlib-devel libpcap-devel libnet-devel @@ -32,6 +35,7 @@ netsniff-ng toolkit currently consists of the following utilities: %prep %setup -q +%patch0 -p1 -b .dont-redefine-memcpyset %build export NACL_INC_DIR=$(pkg-config --variable=includedir libsodium )/sodium @@ -56,6 +60,7 @@ make install PREFIX=%{_prefix} ETCDIR=%{_sysconfdir} DESTDIR="%{buildroot}" %changelog * Mon Jul 3 2017 Jaroslav Škarvada - 0.6.3-2 - Rebuilt for new liburcu +- Compilation fix * Wed Apr 12 2017 Jaroslav Škarvada - 0.6.3-1 - New version