tcpick: cleanup, closing #215

This commit is contained in:
Anton Bolshakov 2014-01-21 00:34:32 +00:00
parent 39e2a7793b
commit 3fdfdc9fc8
4 changed files with 1 additions and 295 deletions

View file

@ -3,8 +3,6 @@ AUX tcpick-0.2.1-cpu-loop.patch 1391 SHA256 58a278d4d58d8141eeecc731d7b17c99ae93
AUX tcpick-0.2.1-pointers.patch 2931 SHA256 3ef191d93dc688c9a243f30ca0777f75c0fd6016eb9a7142373974b11eb0d762 SHA512 c2d8198ac20b2199a8eb6a3f818bbb08b64113f3e77218c2c80b2df635da4eeea733e7af190503aef44f2c5c4c296b3a6a5e882c78d66156e6eb9a0027f7a290 WHIRLPOOL ad717d32800bec6532e6aef547e275368ac5e152a75daf196672ef06af1485006add065d65b9a53c14705b16e9abc6578da3907bdb5c01114685c4562a6cec08
AUX tcpick-0.2.1-ppc.patch 614 SHA256 047040d0eafce1b19611fddae2de6923bb0d4992904e676dc28484bf36278557 SHA512 e487c1fe15a59a06df50cd28f2c67dac43ff783f577aaa9117ddcdc0427a3d9fa511210677388d22fbdaa882aeda67af3e038749198cdd9d939f5426acb216da WHIRLPOOL 6357fbd3f8460102ccb65a671261776abe918844bdb88d3b7c0214623d539e89237a9cafcdc23b3b8c131f2c405a22e0ca502a033b0a9adec247092111fa4bd1
AUX tcpick-0.2.1-timezone.patch 607 SHA256 c8ca49999d3d4142f2c450fa725d67f40c38a2af8a05d458b4d971fbd3a96eaa SHA512 f40aed8ce7966c1cedca96c7e4ebb91cfa814d0daeb2e52657a324fe594dac00f90d4f19018de3a789d789fc2dcac93a994cb358f3f2072129cd73db5ada6a89 WHIRLPOOL 7f311db416704001ce32f3827ef2cbd523b0dfbbf5064fe8a8b15795372a1da6bc74babb557c001d5c73317212c7135e2e5b766339bfd864c4af07d51dfcee06
AUX tcpick_0.2.1-amd.patch 7050 SHA256 6e6046048c7a57e2d10d2859af61eb8bbd19c7b53356cc169d1a58ffce45d9e9 SHA512 07afd8ae4142273847b8899d3d89e3294b87940462f320a14b059c6affcf7a34a503ab2a13a48d9541f2aa2ec33d57174255a8eaa707570f731a3f56c2dfc7a0 WHIRLPOOL 4d885e4abab1bc6a6bb235527ce08dcb98ec1bef18f9432bb027fd02514847bbe034c4c4fa6c8af0f6c595eba62254b4d31a35e19c8fee275f850d52fb62b416
AUX tcpick_0.2.1-shortpkts.patch 3094 SHA256 362fb4409bf915ff2711d90261c4384b01a623488a6eace97304cbcd19a7f064 SHA512 7baedad24d82d3514c82b802de0063a56890db3850bf565f85ba1baf5a2a89ebf62f2bf871d43a1eb445dd7d46f7fda8d4075d0c959e65d1a5c1b945b4b4a8a7 WHIRLPOOL 5edb2accf7da28e15643552786e5c7477da498126f27f78fbc601b9c8fe2765266ebf7600a835b2e915d5f166ec39065d376494621f8a91a4b4531fad5dc7736
DIST tcpick-0.2.1.tar.gz 175871 SHA256 cf3c3814518f5565df3884d07e1e3015d88ac1dbfe3885635dd6e67d6ce46dd2 SHA512 2dd3f2e54c6c86b4d1d320113b96977a6ffab2b0ea2b4e2b39585b18a28a314f9fd92d9e874d0350cee3fa54a99b48959c6b0db830a59d3c896c4561beb863b0 WHIRLPOOL 8332029098ecc9f5068c22ee78e1e3a38699d1e0fe176c5e378d5cd0b48578aea754cf6b393a1978d00bc5a01ca35d6bdf9bf1f3120eabeca8c3751ce4be5e3a
EBUILD tcpick-0.2.1-r1.ebuild 898 SHA256 94f6d4fe428041690537e4feda662e23dbb94ba8aa425c939f3c111b3f541c73 SHA512 d767dab9b011c274012c50e9e2b3824a5cb8d5f68a0d16c59e3eea844c25dfcaa0f6bc53005e3e8e214c81b23fa34f0ae187c897665fa92878b5af2d76f8afb0 WHIRLPOOL ce69925edbd1f3195782ae6f349e51211b7b117c0b178aea772151543020ad54993c4709bc4c3bf9ed421d11da282aabbad33853c31feec264545a868242cb06
EBUILD tcpick-0.2.1.ebuild 443 SHA256 dcf5c27fad13e5b375102e2feb5341b815835dfc6860d89ded61d41ae8ac38b4 SHA512 73f1030c8be83215237e71c4d134ebd5886b713ab4e22a6d8999e1a78dd1a0b95c2b9a12d1f3ea09f2f0f488e0b48f08f3a94db4e901d7d3ec244e55755e278d WHIRLPOOL 9a78ebfc3134cb2039375f465e8aafd26c510e23be139faeb6ef328dc9c6388e726fba767cdfcb3864d931b7218d4d72e8939d5a76802d17c2f89cf2608eaf8d
EBUILD tcpick-0.2.1-r1.ebuild 789 SHA256 ff44cc521122cdf504355b06de21d6a50315b91d4efe3172a73fa28597abb031 SHA512 8bce23683e948a634965bd792b7bf587c7e0905e8bbdb6ae5bb8a15f0c138462769b0ffd0db703fc1221a0e18b7e66a5fbe9a652905ddc5bef5548d244b253c0 WHIRLPOOL 85ea3483d2ca3340406858995d9b1f51d1a40e2c9d2b997751b937100395826bcb789e60cd46c2e8109cb7de43f3825e1099abd15966bf4513944d5b9d105250

View file

@ -1,268 +0,0 @@
diff -urN tcpick-0.2.1.org/src/args.c tcpick-0.2.1/src/args.c
--- tcpick-0.2.1.org/src/args.c 2005-01-16 16:19:35.000000000 +0100
+++ tcpick-0.2.1/src/args.c 2014-01-12 13:36:15.991301604 +0100
@@ -149,7 +149,7 @@
void
parse_args(int argc, char ** argv)
{
- char opt;
+ int opt;
#ifdef HAVE_GETOPT_LONG
static struct option long_options[]=
diff -urN tcpick-0.2.1.org/src/datalink.c tcpick-0.2.1/src/datalink.c
--- tcpick-0.2.1.org/src/datalink.c 2004-12-31 14:53:30.000000000 +0100
+++ tcpick-0.2.1/src/datalink.c 2014-01-12 13:57:01.697926978 +0100
@@ -28,6 +28,8 @@
#include "tcpick.h"
#include "extern.h"
+#include "datalink.h"
+
char *datalink2str(int dl_id)
{
diff -urN tcpick-0.2.1.org/src/datalink.h tcpick-0.2.1/src/datalink.h
--- tcpick-0.2.1.org/src/datalink.h 1970-01-01 01:00:00.000000000 +0100
+++ tcpick-0.2.1/src/datalink.h 2014-01-12 13:55:20.521263666 +0100
@@ -0,0 +1,39 @@
+/*
+ * datalink.h -- header for calculating datalink offsets
+ * Part of the tcpick project
+ *
+ * Author: Francesco Stablum <duskdruid @ despammed.com>
+ * Jochen Schlick <josch09 at gmail.com>
+ *
+ * Copyright (C) 2003, 2004 Francesco Stablum
+ * Copyright (C) 2014 Jochen Schlick
+ *
+ * Licensed under the GPL
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at you option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
+ * USA.
+ */
+
+#ifndef _DATALINK_H
+#define _DATALINK_H
+
+
+char *datalink2str(int dl_id);
+
+
+#endif
diff -urN tcpick-0.2.1.org/src/debug.c tcpick-0.2.1/src/debug.c
--- tcpick-0.2.1.org/src/debug.c 2004-12-31 14:53:30.000000000 +0100
+++ tcpick-0.2.1/src/debug.c 2014-01-12 14:39:16.244509624 +0100
@@ -32,7 +32,7 @@
print_conn_chain (struct CONN * f)
{
while (f) {
- printf ("%x->",f);
+ printf ("%p->",f);
if (f == f->next) {
printf ("inf\n");
@@ -48,7 +48,7 @@
print_fragment_chain(struct FRAGMENT * f)
{
while (f) {
- printf ("%x(%i,%i)->",f,f->off,f->len);
+ printf ("%p(%i,%i)->",f,f->off,f->len);
if (f == f->next) {
printf ("inf\n");
diff -urN tcpick-0.2.1.org/src/display.c tcpick-0.2.1/src/display.c
--- tcpick-0.2.1.org/src/display.c 2004-12-31 14:53:30.000000000 +0100
+++ tcpick-0.2.1/src/display.c 2014-01-12 13:29:48.747981116 +0100
@@ -29,6 +29,8 @@
#include "tcpick.h"
#include "extern.h"
+#include "lookup.h"
+
char *
status2str( enum STATUS status )
diff -urN tcpick-0.2.1.org/src/lookup.h tcpick-0.2.1/src/lookup.h
--- tcpick-0.2.1.org/src/lookup.h 2004-12-31 14:53:30.000000000 +0100
+++ tcpick-0.2.1/src/lookup.h 2014-01-12 13:27:07.537986460 +0100
@@ -26,6 +26,11 @@
* USA.
*/
+#ifndef _LOOKUP_H
+#define _LOOKUP_H
+
+
+
struct _l_node /* the node/leaf of the tree */
{
@@ -40,3 +45,20 @@
char * name;
struct in_addr ip;
};
+
+
+char *
+lookup(struct in_addr ia);
+
+char *
+getportname(u_int16_t port);
+
+struct _l_node *
+_l_alloc(struct in_addr, char *);
+
+char *
+_l_get(struct in_addr);
+
+
+
+#endif
diff -urN tcpick-0.2.1.org/src/tcpick.c tcpick-0.2.1/src/tcpick.c
--- tcpick-0.2.1.org/src/tcpick.c 2005-01-18 13:25:36.000000000 +0100
+++ tcpick-0.2.1/src/tcpick.c 2014-01-12 16:16:58.684002152 +0100
@@ -49,6 +49,7 @@
#include "tcpick.h"
#include "globals.h"
+#include "datalink.h"
char *errbuf[PCAP_ERRBUF_SIZE];
struct bpf_program filter_compiled;
@@ -180,7 +181,8 @@
}
} else if( readfile != NULL ) {
- setuid(getuid());
+ int dummy;
+ dummy = setuid(getuid());
msg( 1, c_INTERFACE,
"%s: reading from %s",
TCPICK_NAME, readfile );
@@ -232,13 +234,19 @@
/* compiling the filter */
if( filter != NULL ) {
+ bpf_u_int32 nm;
msg(1, c_SETTING, "setting filter: \"%s\"",filter);
+ if ( net == NULL) {
+ nm = PCAP_NETMASK_UNKNOWN;
+ } else {
+ nm = (int) inet_addr(net);
+ }
if( ( pcap_compile( descr,
&filter_compiled,
filter,
0,
- (int)net
+ nm
) == -1) )
err("error compiling filter \"%s\"",filter);
diff -urN tcpick-0.2.1.org/src/time.c tcpick-0.2.1/src/time.c
--- tcpick-0.2.1.org/src/time.c 2005-01-09 01:21:44.000000000 +0100
+++ tcpick-0.2.1/src/time.c 2014-01-12 14:47:38.897826291 +0100
@@ -42,7 +42,7 @@
tzp = (struct timezone * ) S_malloc( sizeof(struct timezone) );
memset(tp, 0, sizeof(struct timeval));
- memset(tzp, 0, sizeof(struct timeval));
+ memset(tzp, 0, sizeof(struct timezone));
if(gettimeofday(tp, tzp)) {
@@ -54,18 +54,18 @@
switch (flags.displaytime) {
case ONLYTIME:
- sprintf(ret,"%2.2d:%2.2d:%2.2d.%6.6d",
+ sprintf(ret,"%2.2d:%2.2d:%2.2d.%6.6ld",
brokentime->tm_hour,
brokentime->tm_min,
brokentime->tm_sec,
- tp->tv_usec
+ (long)tp->tv_usec
);
break;
case TIMEDATE:
sprintf(ret,
"%2.2d-%2.2d-%2.2d " /* date */
- "%2.2d:%2.2d:%2.2d.%6.6d", /* time */
+ "%2.2d:%2.2d:%2.2d.%6.6ld", /* time */
/* date */
brokentime->tm_mday,
@@ -79,7 +79,7 @@
brokentime->tm_hour,
brokentime->tm_min,
brokentime->tm_sec,
- tp->tv_usec
+ (long)tp->tv_usec
);
break;
diff -urN tcpick-0.2.1.org/src/tracker.c tcpick-0.2.1/src/tracker.c
--- tcpick-0.2.1.org/src/tracker.c 2004-12-31 14:53:30.000000000 +0100
+++ tcpick-0.2.1/src/tracker.c 2014-01-12 13:42:03.844623406 +0100
@@ -99,7 +99,12 @@
if( curr->next == NULL )
last_conn = prev_ring;
- free_desc( &(curr->client) );
+ free_desc( &(curr->client), 1 );
+ if( flags.writer.type == UNIQUE ) {
+ free_desc( &(curr->server), 0 );
+ } else {
+ free_desc( &(curr->client), 1 );
+ }
free_desc( &(curr->server) );
S_free( curr );
@@ -124,7 +129,7 @@
count_opened--;
}
-int free_desc( struct HOST_DESC * desc )
+int free_desc( struct HOST_DESC * desc, int free_filename_too )
/* frees the host descriptor and closes the file */
{
struct FRAGMENT * tmp;
@@ -134,7 +139,7 @@
if (flags.writer.type == UNIQUE)
desc->oth->file = NULL;
}
- if( desc->filename ) {
+ if( desc->filename && free_filename_too ) {
S_free( desc->filename );
desc->filename = NULL;
}
diff -urN tcpick-0.2.1.org/src/write.c tcpick-0.2.1/src/write.c
--- tcpick-0.2.1.org/src/write.c 2005-01-09 00:54:47.000000000 +0100
+++ tcpick-0.2.1/src/write.c 2014-01-12 13:30:17.171313500 +0100
@@ -27,6 +27,8 @@
#include "tcpick.h"
#include "extern.h"
+#include "lookup.h"
+
__inline__ char *
avail_filename(struct CONN * conn_ptr,

View file

@ -24,11 +24,7 @@ src_prepare() {
epatch "${FILESDIR}"/tcpick-0.2.1-cpu-loop.patch
epatch "${FILESDIR}"/tcpick-0.2.1-timezone.patch
epatch "${FILESDIR}"/tcpick-0.2.1-pointers.patch
epatch "${FILESDIR}"/tcpick_0.2.1-shortpkts.patch
#issue https://code.google.com/p/pentoo/issues/detail?id=215
# epatch "${FILESDIR}"/tcpick_0.2.1-amd.patch
}
src_install () {

View file

@ -1,20 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
DESCRIPTION="A tcp stream sniffer, tracker and capturer."
HOMEPAGE="http://tcpick.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""
DEPEND="net-libs/libpcap"
RDEPEND="${DEPEND}"
src_install () {
dobin src/tcpick
dodoc EXAMPLES OPTIONS README
}