net-analyzer/hping: Version 3_pre20141226.
authorJeroen Roovers <jer@gentoo.org>
Tue, 18 Sep 2018 15:21:05 +0000 (17:21 +0200)
committerJeroen Roovers <jer@gentoo.org>
Tue, 18 Sep 2018 15:21:28 +0000 (17:21 +0200)
Package-Manager: Portage-2.3.49, Repoman-2.3.10

net-analyzer/hping/Manifest
net-analyzer/hping/files/hping-3_pre20141226-cross-compile.patch [new file with mode: 0644]
net-analyzer/hping/files/hping-3_pre20141226-indent.patch [new file with mode: 0644]
net-analyzer/hping/files/hping-3_pre20141226-ldflags.patch [new file with mode: 0644]
net-analyzer/hping/files/hping-3_pre20141226-pcap-bpf.patch [new file with mode: 0644]
net-analyzer/hping/files/hping-3_pre20141226-scan-overflow.patch [new file with mode: 0644]
net-analyzer/hping/files/hping-3_pre20141226-unused-but-set.patch [new file with mode: 0644]
net-analyzer/hping/hping-3_pre20141226.ebuild [new file with mode: 0644]

index b9eb36936896e7c379bae2779b17526a70108048..0c59b8f10d76df3e304c73ac7585b5e89732dbe9 100644 (file)
@@ -1 +1,2 @@
+DIST hping-3_pre20141226.zip 648502 BLAKE2B 4c75bdb886a37180a4561a8179e00ea5bb6534e32b6fa749cd53824e36dfbeaa38b1a772b58f61d68056f510a294f6c3363f56705adb75f42fec11f4f4cd8fa1 SHA512 33ca573d66d7f6285f69a060f56a95e7307bc24d6c81b5e1752c72b8487ab9c85ac6e4499f9c4897e2656a67e12d608a0a149ca5502bdcf18cf97c88d4a2309b
 DIST hping3-20051105.tar.gz 584001 BLAKE2B b99b7d2310e1706926ec5c649cd03a8889e3cff36f2a8e1f899799ddb1f4e6e432ab2b83c82b741ab827f715dbf8649a94831e75ef22793c7730e80d49c576c1 SHA512 3b3faa836e70054c8f9f004d876b7eb5f668b64826a6aaf8ca3685619111d9df4eb494a7d38b83cea6cb5f0bd164956461039bf4f73f7c7e90d80cede639b2b3
diff --git a/net-analyzer/hping/files/hping-3_pre20141226-cross-compile.patch b/net-analyzer/hping/files/hping-3_pre20141226-cross-compile.patch
new file mode 100644 (file)
index 0000000..94dbfed
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -52,9 +52,6 @@
+ hping3: byteorder.h $(OBJ)
+       $(CC) -o hping3 $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@
+       @echo
+-      ./hping3 -v
+-      @echo "use \`make strip' to strip hping3 binary"
+-      @echo "use \`make install' to install hping3"
+ hping3-static: byteorder.h $(OBJ)
+       $(CC) -static -o hping3-static $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@ -ldl
diff --git a/net-analyzer/hping/files/hping-3_pre20141226-indent.patch b/net-analyzer/hping/files/hping-3_pre20141226-indent.patch
new file mode 100644 (file)
index 0000000..1f8952d
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/rtt.c
++++ b/rtt.c
+@@ -45,8 +45,8 @@
+                               tablepos = i;
+                               break;
+                       }
+-                      if (i != TABLESIZE)
+-                              *seqp = delaytable[i].seq;
++              if (i != TABLESIZE)
++                      *seqp = delaytable[i].seq;
+       }
+       if (tablepos != -1)
diff --git a/net-analyzer/hping/files/hping-3_pre20141226-ldflags.patch b/net-analyzer/hping/files/hping-3_pre20141226-ldflags.patch
new file mode 100644 (file)
index 0000000..c8874fb
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -50,7 +50,7 @@
+       $(RANLIB) $@
+ hping3: byteorder.h $(OBJ)
+-      $(CC) -o hping3 $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@
++      $(CC) -o hping3 $(CCOPT) $(LDFLAGS) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@
+       @echo
+ hping3-static: byteorder.h $(OBJ)
diff --git a/net-analyzer/hping/files/hping-3_pre20141226-pcap-bpf.patch b/net-analyzer/hping/files/hping-3_pre20141226-pcap-bpf.patch
new file mode 100644 (file)
index 0000000..698e404
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/libpcap_stuff.c
++++ b/libpcap_stuff.c
+@@ -16,8 +16,8 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+-#include <net/bpf.h>
+ #include <pcap.h>
++#include <pcap-bpf.h>
+ #include "globals.h"
+--- a/script.c
++++ b/script.c
+@@ -23,8 +23,8 @@
+ #include <sched.h>
+ #include <sys/ioctl.h>
+-#include <net/bpf.h>
+ #include <pcap.h>
++#include <pcap-bpf.h>
+ #include "release.h"
+ #include "hping2.h"
diff --git a/net-analyzer/hping/files/hping-3_pre20141226-scan-overflow.patch b/net-analyzer/hping/files/hping-3_pre20141226-scan-overflow.patch
new file mode 100644 (file)
index 0000000..ae3df1e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/scan.c
++++ b/scan.c
+@@ -456,7 +456,7 @@
+                               continue;
+                       /* time to copy headers in a safe place */
+                       p = (unsigned char*) packet+linkhdr_size+iphdrlen;
+-                      memcpy(&icmp, p, sizeof(subtcp));
++                      memcpy(&icmp, p, sizeof(icmp));
+                       p += sizeof(icmp);
+                       memcpy(&subip, p, sizeof(ip));
+                       p += sizeof(ip);
diff --git a/net-analyzer/hping/files/hping-3_pre20141226-unused-but-set.patch b/net-analyzer/hping/files/hping-3_pre20141226-unused-but-set.patch
new file mode 100644 (file)
index 0000000..887b90e
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/apd.c
++++ b/apd.c
+@@ -893,6 +893,7 @@
+                       return -ARS_ERROR;
+               err = ars_push_data(pkt, layer, binary, blen);
+               free(binary);
++              return err;
+       } else if (strcasecmp(f, "uint32") == 0) {
+               int err;
+               __u32 t, nt;
+--- a/ars.c
++++ b/ars.c
+@@ -906,15 +906,17 @@
+  * system isn't FreeBSD or NetBSD. */
+ int ars_bsd_fix(struct ars_packet *pkt, unsigned char *packet, size_t size)
+ {
++#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
+       struct ars_iphdr *ip;
++#endif
+       if (pkt->p_layer[0].l_type != ARS_TYPE_IP ||
+           size < sizeof(struct ars_iphdr)) {
+               ars_set_error(pkt, "BSD fix requested, but layer 0 not IP");
+               return -ARS_INVALID;
+       }
+-      ip = (struct ars_iphdr*) packet;
+ #if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
++      ip = (struct ars_iphdr*) packet;
+       ip->tot_len = ntohs(ip->tot_len);
+       ip->frag_off = ntohs(ip->frag_off);
+ #endif
+--- a/libpcap_stuff.c
++++ b/libpcap_stuff.c
+@@ -23,9 +23,11 @@
+ int open_pcap()
+ {
++#if (!defined OSTYPE_LINUX) && (!defined __sun__)
+       int on;
+       on = 1; /* no warning if BIOCIMMEDIATE will not be compiled */
++#endif
+       if (opt_debug)
+               printf("DEBUG: pcap_open_live(%s, 99999, 0, 1, %p)\n",
+                       ifname, errbuf);
diff --git a/net-analyzer/hping/hping-3_pre20141226.ebuild b/net-analyzer/hping/hping-3_pre20141226.ebuild
new file mode 100644 (file)
index 0000000..4c3eecd
--- /dev/null
@@ -0,0 +1,81 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A ping-like TCP/IP packet assembler/analyzer"
+HOMEPAGE="http://www.hping.org"
+HPING_COMMIT="3547c7691742c6eaa31f8402e0ccbb81387c1b99"
+SRC_URI="https://github.com/antirez/${PN}/archive/${HPING_COMMIT}.zip -> ${P}.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
+IUSE="tcl"
+
+S=${WORKDIR}/${PN}-${HPING_COMMIT}
+
+DEPEND="
+       net-libs/libpcap
+       tcl? ( dev-lang/tcl:0= )
+"
+RDEPEND="
+       ${DEPEND}
+"
+PATCHES=(
+       "${FILESDIR}"/${PN}-3_pre20051105-libtcl.patch
+       "${FILESDIR}"/${PN}-3_pre20051105-tcl.patch
+       "${FILESDIR}"/${PN}-3_pre20051105-tclsh-proper-escaping.patch
+       "${FILESDIR}"/${PN}-3_pre20141226-cross-compile.patch
+       "${FILESDIR}"/${PN}-3_pre20141226-indent.patch
+       "${FILESDIR}"/${PN}-3_pre20141226-ldflags.patch
+       "${FILESDIR}"/${PN}-3_pre20141226-pcap-bpf.patch
+       "${FILESDIR}"/${PN}-3_pre20141226-scan-overflow.patch
+       "${FILESDIR}"/${PN}-3_pre20141226-unused-but-set.patch
+)
+
+src_prepare() {
+       default
+
+       # Correct hard coded values
+       sed -i Makefile.in \
+               -e '/^CC=/d' \
+               -e '/^AR=/d' \
+               -e '/^RANLIB=/d' \
+               -e 's:/usr/local/lib:/usr/$(LIBDIR):g' \
+               -e 's:-O2:$(CFLAGS):' \
+               || die
+
+       # Change name from hping2 to hping3
+       sed -i docs/hping3.8 \
+               -e 's|HPING2|HPING|g' \
+               -e 's|hping2|hping|g' \
+               || die
+}
+
+src_configure() {
+       tc-export CC
+
+       # Not an autotools type configure:
+       sh configure $(usex tcl '' --no-tcl) || die
+}
+
+src_compile() {
+       emake \
+               DEBUG="" \
+               "CFLAGS=${CFLAGS}" \
+               "AR=$(tc-getAR)" \
+               "RANLIB=$(tc-getRANLIB)" \
+               "LIBDIR=$(get_libdir)"
+}
+
+src_install () {
+       dosbin hping3
+       dosym hping3 /usr/sbin/hping
+       dosym hping3 /usr/sbin/hping2
+
+       newman docs/hping3.8 hping.8
+
+       dodoc AUTHORS BUGS CHANGES INSTALL NEWS README TODO
+}