Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/hping/, net-analyzer/hping/files/
Date: Tue, 18 Sep 2018 15:21:39
Message-Id: 1537284088.e58ff204c08822e0690cd02df7c11bfdb15cad28.jer@gentoo
1 commit: e58ff204c08822e0690cd02df7c11bfdb15cad28
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 18 15:21:05 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 18 15:21:28 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e58ff204
7
8 net-analyzer/hping: Version 3_pre20141226.
9
10 Package-Manager: Portage-2.3.49, Repoman-2.3.10
11
12 net-analyzer/hping/Manifest | 1 +
13 .../files/hping-3_pre20141226-cross-compile.patch | 12 ++++
14 .../hping/files/hping-3_pre20141226-indent.patch | 13 ++++
15 .../hping/files/hping-3_pre20141226-ldflags.patch | 11 +++
16 .../hping/files/hping-3_pre20141226-pcap-bpf.patch | 24 +++++++
17 .../files/hping-3_pre20141226-scan-overflow.patch | 11 +++
18 .../files/hping-3_pre20141226-unused-but-set.patch | 45 ++++++++++++
19 net-analyzer/hping/hping-3_pre20141226.ebuild | 81 ++++++++++++++++++++++
20 8 files changed, 198 insertions(+)
21
22 diff --git a/net-analyzer/hping/Manifest b/net-analyzer/hping/Manifest
23 index b9eb3693689..0c59b8f10d7 100644
24 --- a/net-analyzer/hping/Manifest
25 +++ b/net-analyzer/hping/Manifest
26 @@ -1 +1,2 @@
27 +DIST hping-3_pre20141226.zip 648502 BLAKE2B 4c75bdb886a37180a4561a8179e00ea5bb6534e32b6fa749cd53824e36dfbeaa38b1a772b58f61d68056f510a294f6c3363f56705adb75f42fec11f4f4cd8fa1 SHA512 33ca573d66d7f6285f69a060f56a95e7307bc24d6c81b5e1752c72b8487ab9c85ac6e4499f9c4897e2656a67e12d608a0a149ca5502bdcf18cf97c88d4a2309b
28 DIST hping3-20051105.tar.gz 584001 BLAKE2B b99b7d2310e1706926ec5c649cd03a8889e3cff36f2a8e1f899799ddb1f4e6e432ab2b83c82b741ab827f715dbf8649a94831e75ef22793c7730e80d49c576c1 SHA512 3b3faa836e70054c8f9f004d876b7eb5f668b64826a6aaf8ca3685619111d9df4eb494a7d38b83cea6cb5f0bd164956461039bf4f73f7c7e90d80cede639b2b3
29
30 diff --git a/net-analyzer/hping/files/hping-3_pre20141226-cross-compile.patch b/net-analyzer/hping/files/hping-3_pre20141226-cross-compile.patch
31 new file mode 100644
32 index 00000000000..94dbfed9709
33 --- /dev/null
34 +++ b/net-analyzer/hping/files/hping-3_pre20141226-cross-compile.patch
35 @@ -0,0 +1,12 @@
36 +--- a/Makefile.in
37 ++++ b/Makefile.in
38 +@@ -52,9 +52,6 @@
39 + hping3: byteorder.h $(OBJ)
40 + $(CC) -o hping3 $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@
41 + @echo
42 +- ./hping3 -v
43 +- @echo "use \`make strip' to strip hping3 binary"
44 +- @echo "use \`make install' to install hping3"
45 +
46 + hping3-static: byteorder.h $(OBJ)
47 + $(CC) -static -o hping3-static $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@ -ldl
48
49 diff --git a/net-analyzer/hping/files/hping-3_pre20141226-indent.patch b/net-analyzer/hping/files/hping-3_pre20141226-indent.patch
50 new file mode 100644
51 index 00000000000..1f8952d1b3b
52 --- /dev/null
53 +++ b/net-analyzer/hping/files/hping-3_pre20141226-indent.patch
54 @@ -0,0 +1,13 @@
55 +--- a/rtt.c
56 ++++ b/rtt.c
57 +@@ -45,8 +45,8 @@
58 + tablepos = i;
59 + break;
60 + }
61 +- if (i != TABLESIZE)
62 +- *seqp = delaytable[i].seq;
63 ++ if (i != TABLESIZE)
64 ++ *seqp = delaytable[i].seq;
65 + }
66 +
67 + if (tablepos != -1)
68
69 diff --git a/net-analyzer/hping/files/hping-3_pre20141226-ldflags.patch b/net-analyzer/hping/files/hping-3_pre20141226-ldflags.patch
70 new file mode 100644
71 index 00000000000..c8874fb71d1
72 --- /dev/null
73 +++ b/net-analyzer/hping/files/hping-3_pre20141226-ldflags.patch
74 @@ -0,0 +1,11 @@
75 +--- a/Makefile.in
76 ++++ b/Makefile.in
77 +@@ -50,7 +50,7 @@
78 + $(RANLIB) $@
79 +
80 + hping3: byteorder.h $(OBJ)
81 +- $(CC) -o hping3 $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@
82 ++ $(CC) -o hping3 $(CCOPT) $(LDFLAGS) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) @SOLARISLIB@ @TCL_LIB@
83 + @echo
84 +
85 + hping3-static: byteorder.h $(OBJ)
86
87 diff --git a/net-analyzer/hping/files/hping-3_pre20141226-pcap-bpf.patch b/net-analyzer/hping/files/hping-3_pre20141226-pcap-bpf.patch
88 new file mode 100644
89 index 00000000000..698e404f79e
90 --- /dev/null
91 +++ b/net-analyzer/hping/files/hping-3_pre20141226-pcap-bpf.patch
92 @@ -0,0 +1,24 @@
93 +--- a/libpcap_stuff.c
94 ++++ b/libpcap_stuff.c
95 +@@ -16,8 +16,8 @@
96 + #include <string.h>
97 + #include <stdlib.h>
98 + #include <sys/ioctl.h>
99 +-#include <net/bpf.h>
100 + #include <pcap.h>
101 ++#include <pcap-bpf.h>
102 +
103 + #include "globals.h"
104 +
105 +--- a/script.c
106 ++++ b/script.c
107 +@@ -23,8 +23,8 @@
108 + #include <sched.h>
109 +
110 + #include <sys/ioctl.h>
111 +-#include <net/bpf.h>
112 + #include <pcap.h>
113 ++#include <pcap-bpf.h>
114 +
115 + #include "release.h"
116 + #include "hping2.h"
117
118 diff --git a/net-analyzer/hping/files/hping-3_pre20141226-scan-overflow.patch b/net-analyzer/hping/files/hping-3_pre20141226-scan-overflow.patch
119 new file mode 100644
120 index 00000000000..ae3df1e5443
121 --- /dev/null
122 +++ b/net-analyzer/hping/files/hping-3_pre20141226-scan-overflow.patch
123 @@ -0,0 +1,11 @@
124 +--- a/scan.c
125 ++++ b/scan.c
126 +@@ -456,7 +456,7 @@
127 + continue;
128 + /* time to copy headers in a safe place */
129 + p = (unsigned char*) packet+linkhdr_size+iphdrlen;
130 +- memcpy(&icmp, p, sizeof(subtcp));
131 ++ memcpy(&icmp, p, sizeof(icmp));
132 + p += sizeof(icmp);
133 + memcpy(&subip, p, sizeof(ip));
134 + p += sizeof(ip);
135
136 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
137 new file mode 100644
138 index 00000000000..887b90efad9
139 --- /dev/null
140 +++ b/net-analyzer/hping/files/hping-3_pre20141226-unused-but-set.patch
141 @@ -0,0 +1,45 @@
142 +--- a/apd.c
143 ++++ b/apd.c
144 +@@ -893,6 +893,7 @@
145 + return -ARS_ERROR;
146 + err = ars_push_data(pkt, layer, binary, blen);
147 + free(binary);
148 ++ return err;
149 + } else if (strcasecmp(f, "uint32") == 0) {
150 + int err;
151 + __u32 t, nt;
152 +--- a/ars.c
153 ++++ b/ars.c
154 +@@ -906,15 +906,17 @@
155 + * system isn't FreeBSD or NetBSD. */
156 + int ars_bsd_fix(struct ars_packet *pkt, unsigned char *packet, size_t size)
157 + {
158 ++#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
159 + struct ars_iphdr *ip;
160 ++#endif
161 +
162 + if (pkt->p_layer[0].l_type != ARS_TYPE_IP ||
163 + size < sizeof(struct ars_iphdr)) {
164 + ars_set_error(pkt, "BSD fix requested, but layer 0 not IP");
165 + return -ARS_INVALID;
166 + }
167 +- ip = (struct ars_iphdr*) packet;
168 + #if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
169 ++ ip = (struct ars_iphdr*) packet;
170 + ip->tot_len = ntohs(ip->tot_len);
171 + ip->frag_off = ntohs(ip->frag_off);
172 + #endif
173 +--- a/libpcap_stuff.c
174 ++++ b/libpcap_stuff.c
175 +@@ -23,9 +23,11 @@
176 +
177 + int open_pcap()
178 + {
179 ++#if (!defined OSTYPE_LINUX) && (!defined __sun__)
180 + int on;
181 +
182 + on = 1; /* no warning if BIOCIMMEDIATE will not be compiled */
183 ++#endif
184 + if (opt_debug)
185 + printf("DEBUG: pcap_open_live(%s, 99999, 0, 1, %p)\n",
186 + ifname, errbuf);
187
188 diff --git a/net-analyzer/hping/hping-3_pre20141226.ebuild b/net-analyzer/hping/hping-3_pre20141226.ebuild
189 new file mode 100644
190 index 00000000000..4c3eecd65c6
191 --- /dev/null
192 +++ b/net-analyzer/hping/hping-3_pre20141226.ebuild
193 @@ -0,0 +1,81 @@
194 +# Copyright 1999-2018 Gentoo Foundation
195 +# Distributed under the terms of the GNU General Public License v2
196 +
197 +EAPI=6
198 +inherit eutils multilib toolchain-funcs
199 +
200 +DESCRIPTION="A ping-like TCP/IP packet assembler/analyzer"
201 +HOMEPAGE="http://www.hping.org"
202 +HPING_COMMIT="3547c7691742c6eaa31f8402e0ccbb81387c1b99"
203 +SRC_URI="https://github.com/antirez/${PN}/archive/${HPING_COMMIT}.zip -> ${P}.zip"
204 +
205 +LICENSE="GPL-2"
206 +SLOT="0"
207 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
208 +IUSE="tcl"
209 +
210 +S=${WORKDIR}/${PN}-${HPING_COMMIT}
211 +
212 +DEPEND="
213 + net-libs/libpcap
214 + tcl? ( dev-lang/tcl:0= )
215 +"
216 +RDEPEND="
217 + ${DEPEND}
218 +"
219 +PATCHES=(
220 + "${FILESDIR}"/${PN}-3_pre20051105-libtcl.patch
221 + "${FILESDIR}"/${PN}-3_pre20051105-tcl.patch
222 + "${FILESDIR}"/${PN}-3_pre20051105-tclsh-proper-escaping.patch
223 + "${FILESDIR}"/${PN}-3_pre20141226-cross-compile.patch
224 + "${FILESDIR}"/${PN}-3_pre20141226-indent.patch
225 + "${FILESDIR}"/${PN}-3_pre20141226-ldflags.patch
226 + "${FILESDIR}"/${PN}-3_pre20141226-pcap-bpf.patch
227 + "${FILESDIR}"/${PN}-3_pre20141226-scan-overflow.patch
228 + "${FILESDIR}"/${PN}-3_pre20141226-unused-but-set.patch
229 +)
230 +
231 +src_prepare() {
232 + default
233 +
234 + # Correct hard coded values
235 + sed -i Makefile.in \
236 + -e '/^CC=/d' \
237 + -e '/^AR=/d' \
238 + -e '/^RANLIB=/d' \
239 + -e 's:/usr/local/lib:/usr/$(LIBDIR):g' \
240 + -e 's:-O2:$(CFLAGS):' \
241 + || die
242 +
243 + # Change name from hping2 to hping3
244 + sed -i docs/hping3.8 \
245 + -e 's|HPING2|HPING|g' \
246 + -e 's|hping2|hping|g' \
247 + || die
248 +}
249 +
250 +src_configure() {
251 + tc-export CC
252 +
253 + # Not an autotools type configure:
254 + sh configure $(usex tcl '' --no-tcl) || die
255 +}
256 +
257 +src_compile() {
258 + emake \
259 + DEBUG="" \
260 + "CFLAGS=${CFLAGS}" \
261 + "AR=$(tc-getAR)" \
262 + "RANLIB=$(tc-getRANLIB)" \
263 + "LIBDIR=$(get_libdir)"
264 +}
265 +
266 +src_install () {
267 + dosbin hping3
268 + dosym hping3 /usr/sbin/hping
269 + dosym hping3 /usr/sbin/hping2
270 +
271 + newman docs/hping3.8 hping.8
272 +
273 + dodoc AUTHORS BUGS CHANGES INSTALL NEWS README TODO
274 +}