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/tcpstat/files/, net-analyzer/tcpstat/
Date: Wed, 01 Jan 2020 15:39:44
Message-Id: 1577893179.4344075efcc6c42845677630b08265e05241c05b.jer@gentoo
1 commit: 4344075efcc6c42845677630b08265e05241c05b
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 1 15:36:45 2020 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 1 15:39:39 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4344075e
7
8 net-analyzer/tcpstat: Version 1.5_p8
9
10 * Split up -db patch
11 * Apply Debian patches
12 * Fix -L-lpcap
13 * Depend on sys-libs/db:* for tcpprof(1)
14
15 Package-Manager: Portage-2.3.84, Repoman-2.3.20
16 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
17
18 net-analyzer/tcpstat/Manifest | 1 +
19 .../files/tcpstat-1.5_p8-_DEFAULT_SOURCE.patch | 11 +++
20 .../tcpstat/files/tcpstat-1.5_p8-ipv6.patch | 30 +++++++
21 .../tcpstat/files/tcpstat-1.5_p8-libpcap.patch | 11 +++
22 .../tcpstat/files/tcpstat-1.5_p8-off-by-one.patch | 50 +++++++++++
23 .../tcpstat/files/tcpstat-1.5_p8-unused.patch | 99 ++++++++++++++++++++++
24 net-analyzer/tcpstat/tcpstat-1.5_p8.ebuild | 59 +++++++++++++
25 7 files changed, 261 insertions(+)
26
27 diff --git a/net-analyzer/tcpstat/Manifest b/net-analyzer/tcpstat/Manifest
28 index 19241909fb7..1f36deb4700 100644
29 --- a/net-analyzer/tcpstat/Manifest
30 +++ b/net-analyzer/tcpstat/Manifest
31 @@ -1 +1,2 @@
32 DIST tcpstat-1.5.tar.gz 93102 BLAKE2B 39a570fe6176fda0e8a6539417ece268183a1ebed6fa956b8ec5556b8bbd2508829e7d0861ef39b551bd6070df70cfdaf3dbf694a42ad00be4ea0f3e5c757ce5 SHA512 f1399365e754e4d9e19657c455a580294a7b4002a0d02ff05791a45574dcb1d0e75dc492157ef595066502b1553702481c67b20ad24267a50d7293766c39a5ab
33 +DIST tcpstat_1.5-8.debian.tar.xz 7844 BLAKE2B d74e3fd6a274d5e4e0963741bcfe870cfa300281706f965ac1c61ab7e6eb9aa2ea06566649fb3ae8d6071464cfa4bc037e58f64bf32f71ad8b3006976a515417 SHA512 f54546a9191feddc5410c7abb6764533ce89de4bd93fdc480e1a8f7473b405ca914482e6b950ead39d78d235caf093aaa663c683df346417070b97fc3e4f5c41
34
35 diff --git a/net-analyzer/tcpstat/files/tcpstat-1.5_p8-_DEFAULT_SOURCE.patch b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-_DEFAULT_SOURCE.patch
36 new file mode 100644
37 index 00000000000..3ea38d7bac0
38 --- /dev/null
39 +++ b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-_DEFAULT_SOURCE.patch
40 @@ -0,0 +1,11 @@
41 +--- a/configure.in
42 ++++ b/configure.in
43 +@@ -68,7 +68,7 @@
44 + case $my_build_os in
45 + aix*) AC_DEFINE(AIX_STRANGENESS, 1, [ defined on AIX systems. ]) ;;
46 + osf1*) AC_DEFINE(TRU64_STRANGENESS, 1, [ defined on OSF systems. ]) ;;
47 +- linux*) AC_DEFINE(_BSD_SOURCE, 1, [ defined usually on linux systems ] ) ;;
48 ++ linux*) AC_DEFINE(_DEFAULT_SOURCE, 1, [ defined usually on linux systems ] ) ;;
49 + gnu/kfreebsd*) AC_DEFINE(_BSD_SOURCE, 1, [ defined usually on debian kfreebsd systems ] ) ;;
50 + bsd/os*) ;;
51 + freebsd*) ;;
52
53 diff --git a/net-analyzer/tcpstat/files/tcpstat-1.5_p8-ipv6.patch b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-ipv6.patch
54 new file mode 100644
55 index 00000000000..f26268f7a93
56 --- /dev/null
57 +++ b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-ipv6.patch
58 @@ -0,0 +1,30 @@
59 +--- a/configure.in
60 ++++ b/configure.in
61 +@@ -84,15 +84,26 @@
62 + dnl #######################
63 + dnl Checks for header files
64 + dnl #######################
65 + AC_HEADER_STDC
66 + AC_HEADER_SYS_WAIT
67 +-AC_CHECK_HEADERS(sys/time.h sys/stat.h unistd.h strings.h fcntl.h netinet/ip6.h)
68 ++AC_CHECK_HEADERS(sys/time.h sys/stat.h unistd.h strings.h fcntl.h)
69 +
70 + dnl BSD/OS Seems to not have a good ethernet header, so we gotta wing it
71 + AC_CHECK_HEADERS(net/if.h net/ethernet.h netinet/if_ether.h net/ppp_defs.h)
72 +
73 ++AC_ARG_ENABLE( ipv6, [ AC_HELP_STRING([--enable-ipv6], [s use IPv6?]) ], ip6=$enableval )
74 ++if test "$ip6" = "yes"
75 ++then
76 ++ AC_CHECK_HEADER(netinet/ip6.h, , [AC_MSG_ERROR([I couldn't find netinet/ip6.h though you asked for ipv6 support.])] )
77 ++elif test "$ip6" != "no"
78 ++then
79 ++ AC_CHECK_HEADER(netinet/ip6.h)
80 ++
81 ++fi
82 ++
83 ++
84 + dnl #############################################################
85 + dnl Checks for typedefs, structures, and compiler characteristics
86 + dnl #############################################################
87 + AC_C_CONST
88 + AC_TYPE_SIZE_T
89
90 diff --git a/net-analyzer/tcpstat/files/tcpstat-1.5_p8-libpcap.patch b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-libpcap.patch
91 new file mode 100644
92 index 00000000000..54554890416
93 --- /dev/null
94 +++ b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-libpcap.patch
95 @@ -0,0 +1,11 @@
96 +--- a/configure.in
97 ++++ b/configure.in
98 +@@ -47,7 +47,7 @@
99 + fi
100 + done
101 + else
102 +- LDFLAGS=" -L${with_pcap_lib} "${LDFLAGS}
103 ++ LDFLAGS="${with_pcap_lib} "${LDFLAGS}
104 + fi
105 +
106 + AC_ARG_ENABLE(fdesc,
107
108 diff --git a/net-analyzer/tcpstat/files/tcpstat-1.5_p8-off-by-one.patch b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-off-by-one.patch
109 new file mode 100644
110 index 00000000000..4029ddb7d40
111 --- /dev/null
112 +++ b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-off-by-one.patch
113 @@ -0,0 +1,50 @@
114 +--- a/src/catpcap.c
115 ++++ b/src/catpcap.c
116 +@@ -156,10 +156,10 @@
117 + return Usage(1, argv[0]);
118 + break;
119 + case 'f':
120 +- strncpy(filterexpr, optarg, BUF_SIZ);
121 ++ strncpy(filterexpr, optarg, BUF_SIZ - 1);
122 + break;
123 + case 'r':
124 +- strncpy(filename, optarg, BUF_SIZ);
125 ++ strncpy(filename, optarg, BUF_SIZ - 1);
126 + break;
127 + default:
128 + return Usage(1, argv[0]);
129 +--- a/src/dump.c
130 ++++ b/src/dump.c
131 +@@ -109,10 +109,10 @@
132 + get_tcp_flags |= GET_TCPD_COUNT_LINKSIZE;
133 + break;
134 + case 'f':
135 +- strncpy(filterexpr, optarg, BUF_SIZ);
136 ++ strncpy(filterexpr, optarg, BUF_SIZ - 1);
137 + break;
138 + case 'r':
139 +- strncpy(filename, optarg, BUF_SIZ);
140 ++ strncpy(filename, optarg, BUF_SIZ - 1);
141 + break;
142 + case 's':
143 + what_to_show |= parse_show_types(optarg);
144 +--- a/src/tcpprof.c
145 ++++ b/src/tcpprof.c
146 +@@ -126,14 +126,14 @@
147 + src_dest_split = 1;
148 + break;
149 + case 'f':
150 +- strncpy(filterexpr, optarg, BUF_SIZ);
151 ++ strncpy(filterexpr, optarg, BUF_SIZ - 1);
152 + break;
153 + case 'i':
154 +- strncpy(filename, optarg, BUF_SIZ);
155 ++ strncpy(filename, optarg, BUF_SIZ - 1);
156 + flags |= GET_TCPD_DO_LIVE;
157 + break;
158 + case 'r':
159 +- strncpy(filename, optarg, BUF_SIZ);
160 ++ strncpy(filename, optarg, BUF_SIZ - 1);
161 + flags &= ~GET_TCPD_DO_LIVE;
162 + break;
163 + case 'n':
164
165 diff --git a/net-analyzer/tcpstat/files/tcpstat-1.5_p8-unused.patch b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-unused.patch
166 new file mode 100644
167 index 00000000000..c255f52dbe8
168 --- /dev/null
169 +++ b/net-analyzer/tcpstat/files/tcpstat-1.5_p8-unused.patch
170 @@ -0,0 +1,99 @@
171 +--- a/lib/process.c
172 ++++ b/lib/process.c
173 +@@ -230,12 +230,12 @@
174 + * calls a user function pointing to the data
175 + *
176 + * XXX: filter is not used. capture_seconds also isn't, but snoop is
177 + * always read from a file.
178 + */
179 +-int get_snoop_data(char *fname, char *filter, int flags,
180 +- Double capture_seconds, void (*hook)(packet_data *, void **),
181 ++int get_snoop_data(char *fname, char *filter __attribute__((unused)), int flags,
182 ++ Double capture_seconds __attribute__((unused)), void (*hook)(packet_data *, void **),
183 + void **args) {
184 +
185 + u_char *packet;
186 + int fd, len, blen, ret = 0;
187 + struct snoop_file_header fh;
188 +--- a/lib/tcpseq.c
189 ++++ b/lib/tcpseq.c
190 +@@ -54,11 +54,10 @@
191 + u_char flags;
192 + struct tcpseq_ha test_ha;
193 + struct tcphdr *tp = NULL;
194 + struct ip *ip;
195 + #ifdef INET6
196 +- int is_ip6 = 0;
197 + struct ip6_hdr *ip6;
198 +
199 + ip6 = (struct ip6_hdr *) &pd->data.ip6.hdr;
200 + if (is_ip6_packet(pd))
201 + tp= &(pd->data.ip6.body.tcphdr);
202 +--- a/src/catpcap.c
203 ++++ b/src/catpcap.c
204 +@@ -52,13 +52,12 @@
205 + return '.';
206 + }
207 +
208 +-void proc_pcap(u_char *user, const struct pcap_pkthdr *h, const u_char *p) {
209 ++void proc_pcap(u_char *user __attribute__((unused)), const struct pcap_pkthdr *h, const u_char *p) {
210 + u_int length = h->caplen, i, j, k, step;
211 +- u_char *r, *s;
212 ++ u_char *r;
213 + char c;
214 +
215 + r = (u_char *)p;
216 +- s = (u_char *)p;
217 + step = 22;
218 + printf("%u: %lu.%.6lu, caplen %u, len %u\n",
219 + p_number++,
220 +@@ -92,7 +91,7 @@
221 + * process_file() takes the output of tcpdump, saves packets, and displays
222 + * statistics
223 + */
224 +-void process_file(char *fname, u_int unused) {
225 ++void process_file(char *fname, u_int unused __attribute__((unused))) {
226 + int run = 1, i;
227 + pcap_t *pd;
228 + char ebuf[PCAP_ERRBUF_SIZE];
229 +--- a/src/dump.c
230 ++++ b/src/dump.c
231 +@@ -37,21 +37,21 @@
232 + char filterexpr[BUF_SIZ] = "";
233 + int get_tcp_flags = 0;
234 + int what_to_show = 0;
235 + int packet_number = 0;
236 +
237 +-void my_hook(packet_data *pd, void **args) {
238 ++void my_hook(packet_data *pd) {
239 + printf("PACKET NUMBER: %d\n", ++packet_number);
240 + print_packet(pd, what_to_show);
241 + printf("-------------------\n");
242 + }
243 +
244 + /*
245 + * process_file() takes the output of tcpdump, saves packets, and displays
246 + * statistics
247 + */
248 +-void process_file(char *fname, u_int unused) {
249 ++void process_file(char *fname, u_int unused __attribute__((unused))) {
250 + get_dump_data(fname, filterexpr, get_tcp_flags,
251 + -1.0, my_hook, NULL);
252 + }
253 +
254 + int parse_show_types(char *in) {
255 +--- a/src/tcpstat.c
256 ++++ b/src/tcpstat.c
257 +@@ -421,11 +421,11 @@
258 + }
259 +
260 + /*
261 + * process_file() gets the data, and then displays the statistics
262 + */
263 +-void process_file(char *fname, u_int unused) {
264 ++void process_file(char *fname, u_int unused __attribute__((unused))) {
265 + void *argv[2];
266 + statistics stats;
267 + Double x;
268 +
269 + signal(SIGUSR1, catch_signal);
270
271 diff --git a/net-analyzer/tcpstat/tcpstat-1.5_p8.ebuild b/net-analyzer/tcpstat/tcpstat-1.5_p8.ebuild
272 new file mode 100644
273 index 00000000000..fbd6a2b9111
274 --- /dev/null
275 +++ b/net-analyzer/tcpstat/tcpstat-1.5_p8.ebuild
276 @@ -0,0 +1,59 @@
277 +# Copyright 1999-2020 Gentoo Authors
278 +# Distributed under the terms of the GNU General Public License v2
279 +
280 +EAPI=7
281 +inherit autotools flag-o-matic
282 +
283 +DESCRIPTION="Reports network interface statistics"
284 +HOMEPAGE="https://www.frenchfries.net/paul/tcpstat/"
285 +SRC_URI="
286 + ${HOMEPAGE}${P/_p*}.tar.gz
287 + mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV/_p*}-$(ver_cut 4).debian.tar.xz
288 +"
289 +
290 +LICENSE="BSD-2"
291 +SLOT="0"
292 +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
293 +IUSE="ipv6"
294 +
295 +DEPEND="
296 + net-libs/libpcap
297 + sys-libs/db:*
298 +"
299 +RDEPEND="
300 + ${DEPEND}
301 +"
302 +DOCS=( AUTHORS ChangeLog NEWS README doc/Tips_and_Tricks.txt )
303 +PATCHES=(
304 + "${FILESDIR}"/${P}-_DEFAULT_SOURCE.patch
305 + "${FILESDIR}"/${P}-ipv6.patch
306 + "${FILESDIR}"/${P}-libpcap.patch
307 + "${FILESDIR}"/${P}-off-by-one.patch
308 + "${FILESDIR}"/${P}-unused.patch
309 +)
310 +S=${WORKDIR}/${P/_p*}
311 +
312 +src_prepare() {
313 + eapply $(
314 + for patch in $(cat "${WORKDIR}"/debian/patches/series)
315 + do echo "${WORKDIR}"/debian/patches/${patch}
316 + done
317 + ) ${PATCHES[@]}
318 + eapply_user
319 +
320 + eautoreconf
321 +}
322 +
323 +src_configure() {
324 + append-cflags -Wall -Wextra
325 + econf \
326 + $(use_enable ipv6) \
327 + --with-pcap-include='' \
328 + --with-pcap-lib="$( $(tc-getPKG_CONFIG) --libs libpcap)"
329 +}
330 +
331 +src_install() {
332 + default
333 + dobin src/{catpcap,packetdump}
334 + newdoc src/README README.src
335 +}