update tcpslice to 20070709

help and ok aanriot@
This commit is contained in:
rui 2007-07-13 08:16:16 +00:00
parent 6f2030af78
commit fae310b187
7 changed files with 77 additions and 108 deletions

View File

@ -1,11 +1,12 @@
# $OpenBSD: Makefile,v 1.6 2006/04/02 14:45:10 sturm Exp $
# $OpenBSD: Makefile,v 1.7 2007/07/13 08:16:16 rui Exp $
COMMENT= "tool for extracting and gluing pcap (tcpdump) files"
COMMENT= tool for extracting and gluing pcap (tcpdump) files
DISTNAME= tcpslice-1.2a3
DISTNAME= tcpslice-2007.07.09
PKGNAME= ${DISTNAME:S/.//g}
CATEGORIES= net
MASTER_SITES= ftp://ftp.ee.lbl.gov/
MASTER_SITES= http://www.tcpdump.org/weekly/
MAINTAINER= Rui Reis <rui@rui.cx>
@ -17,7 +18,7 @@ PERMIT_DISTFILES_FTP= Yes
WANTLIB= c pcap
SEPARATE_BUILD= concurrent
CONFIGURE_STYLE= gnu
CONFIGURE_STYLE=gnu
NO_REGRESS= Yes

View File

@ -1,5 +1,5 @@
MD5 (tcpslice-1.2a3.tar.gz) = 4ynL635YnxMtksNEfEdxkA==
RMD160 (tcpslice-1.2a3.tar.gz) = l/jry7uSmMDirUZw1EKofBoqRzg=
SHA1 (tcpslice-1.2a3.tar.gz) = mHkDAcsb9DmalRU7xi1Js/WAiZQ=
SHA256 (tcpslice-1.2a3.tar.gz) = QJbo3ryJjPqha1MG8cQvjRixnjDmDajU3reByPaEyEA=
SIZE (tcpslice-1.2a3.tar.gz) = 76879
MD5 (tcpslice-2007.07.09.tar.gz) = E2vQfTWGnwyU0vYTDwmq+w==
RMD160 (tcpslice-2007.07.09.tar.gz) = uYtHlMpxxA8Ao6+YZUEtjYm6lgk=
SHA1 (tcpslice-2007.07.09.tar.gz) = oS4+6RMnHNy1vk2H7etCo0Rc5/I=
SHA256 (tcpslice-2007.07.09.tar.gz) = vhXXKDB/5/okwAwsqFoA1oBkmNoVa+ni38F+dQ6yKVs=
SIZE (tcpslice-2007.07.09.tar.gz) = 113468

View File

@ -1,18 +1,18 @@
$OpenBSD: patch-Makefile_in,v 1.2 2006/04/02 14:45:10 sturm Exp $
--- Makefile.in.orig Sun Sep 10 10:54:27 2000
+++ Makefile.in Sun Apr 2 13:24:32 2006
$OpenBSD: patch-Makefile_in,v 1.3 2007/07/13 08:16:16 rui Exp $
--- Makefile.in.orig Thu May 31 19:51:14 2007
+++ Makefile.in Thu May 31 19:52:49 2007
@@ -41,8 +41,8 @@ VPATH = @srcdir@
CC = @CC@
PROG = tcpslice
-CCOPT = @V_CCOPT@
-INCLS = -I. @V_INCLS@
+CCOPT = @CFLAGS@
+INCLS = -I. -I$(srcdir) -I$(srcdir)/lbl
DEFS = @DEFS@
+CCOPT = @CFLAGS@
+INCLS = -I. -I$(srcdir) -I$(srcdir)/lbl
DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
# Standard CFLAGS
@@ -59,9 +59,9 @@ INSTALL = @INSTALL@
@@ -61,9 +61,9 @@ INSTALL_DATA = @INSTALL_DATA@
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
@ -23,14 +23,5 @@ $OpenBSD: patch-Makefile_in,v 1.2 2006/04/02 14:45:10 sturm Exp $
+# @rm -f $@
+# $(CC) $(CFLAGS) -c $(srcdir)/$*.c
CSRC = tcpslice.c gmt2local.c gwtm2secs.c machdep.c search.c util.c
CSRC = tcpslice.c gmt2local.c gwtm2secs.c machdep.c search.c sessions.c util.c
GENSRC = version.c
@@ -97,7 +97,7 @@ version.c: $(srcdir)/VERSION
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
install: force
- $(INSTALL) -m 555 -o bin -g bin tcpslice $(DESTDIR)$(BINDEST)
+ $(INSTALL) -s -m 555 -o root -g bin tcpslice $(DESTDIR)$(BINDEST)
install-man: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/$(PROG).1 \

View File

@ -1,32 +1,30 @@
$OpenBSD: patch-tcpslice_c,v 1.2 2006/04/02 14:45:10 sturm Exp $
--- tcpslice.c.orig Tue Oct 25 00:06:26 2005
+++ tcpslice.c Sun Apr 2 13:24:33 2006
@@ -84,7 +84,7 @@ static const char rcsid[] =
$OpenBSD: patch-tcpslice_c,v 1.3 2007/07/13 08:16:16 rui Exp $
--- tcpslice.c.orig Thu May 31 19:18:59 2007
+++ tcpslice.c Thu May 31 19:20:16 2007
@@ -101,7 +101,7 @@ extern size_t strlcpy(char *, const char *, size_t);
struct state {
off_t start_pos, /* seek position corresponding to start time */
stop_pos; /* seek position corresponding to stop time */
- struct timeval
+ struct bpf_timeval
file_start_time, /* time of first pkt in file */
file_stop_time; /* time of last pkt in file */
pcap_t *p;
@@ -107,19 +107,19 @@ enum stamp_styles timestamp_style = TIME
file_stop_time, /* time of last pkt in file */
last_pkt_time; /* time of most recently read pkt */
@@ -125,18 +125,18 @@ enum stamp_styles timestamp_style = TIMESTAMP_RAW;
int is_timestamp( char *str );
-struct timeval parse_time(char *time_string, struct timeval base_time);
+struct bpf_timeval parse_time(char *time_string, struct bpf_timeval base_time);
void fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr);
void get_file_range( char filename[], pcap_t **p,
- struct timeval *first_time, struct timeval *last_time );
-struct timeval first_packet_time(char filename[], pcap_t **p_addr);
-struct timeval lowest_start_time(struct state *states, int numfiles);
+ struct bpf_timeval *first_time, struct bpf_timeval *last_time );
+struct bpf_timeval first_packet_time(char filename[], pcap_t **p_addr);
-struct timeval latest_end_time(struct state *states, int numfiles);
+struct bpf_timeval lowest_start_time(struct state *states, int numfiles);
+struct bpf_timeval latest_end_time(struct state *states, int numfiles);
void get_next_packet(struct state *s);
struct state *open_files(char *filenames[], int numfiles);
void extract_slice(struct state *states, int numfiles, char *write_file_name,
static void extract_slice(struct state *states, int numfiles,
const char *write_file_name,
- struct timeval *start_time, struct timeval *stop_time,
+ struct bpf_timeval *start_time, struct bpf_timeval *stop_time,
int keep_dups, int relative_time_merge,
@ -34,19 +32,19 @@ $OpenBSD: patch-tcpslice_c,v 1.2 2006/04/02 14:45:10 sturm Exp $
-char *timestamp_to_string(struct timeval *timestamp);
+ struct bpf_timeval *base_time);
+char *timestamp_to_string(struct bpf_timeval *timestamp);
void dump_times(pcap_t **p, char filename[]);
void dump_times(struct state *states, int numfiles);
__dead void usage(void)__attribute__((volatile));
@@ -144,7 +144,7 @@ main(int argc, char **argv)
@@ -161,7 +161,7 @@ main(int argc, char **argv)
char *start_time_string = 0;
char *stop_time_string = 0;
char *write_file_name = "-"; /* default is stdout */
const char *write_file_name = "-"; /* default is stdout */
- struct timeval first_time, start_time, stop_time;
+ struct bpf_timeval first_time, start_time, stop_time;
pcap_t *pcap;
char ebuf[PCAP_ERRBUF_SIZE];
struct state *states;
@@ -280,15 +280,19 @@ int is_timestamp( char *str )
@@ -306,12 +306,12 @@ int is_timestamp( char *str )
* containing the specified time.
*/
@ -59,35 +57,10 @@ $OpenBSD: patch-tcpslice_c,v 1.2 2006/04/02 14:45:10 sturm Exp $
struct tm t;
- struct timeval result;
+ struct bpf_timeval result;
+ time_t secs;
time_t usecs = 0;
int is_delta = (time_string[0] == '+');
+ secs = base_time.tv_sec;
+ bt = localtime(&secs);
+
if ( is_delta )
++time_string; /* skip over '+' sign */
@@ -472,7 +476,7 @@ fill_tm(char *time_string, int is_delta,
*/
void
get_file_range( char filename[], pcap_t **p,
- struct timeval *first_time, struct timeval *last_time )
+ struct bpf_timeval *first_time, struct bpf_timeval *last_time )
{
*first_time = first_packet_time( filename, p );
@@ -485,7 +489,7 @@ get_file_range( char filename[], pcap_t
* reading.
*/
-struct timeval
+struct bpf_timeval
first_packet_time(char filename[], pcap_t **p_addr)
{
struct pcap_pkthdr hdr;
@@ -504,10 +508,10 @@ first_packet_time(char filename[], pcap_
@@ -485,10 +485,10 @@ fill_tm(char *time_string, int is_delta, struct tm *t,
/* Of all the files, what is the lowest start time. */
@ -100,10 +73,23 @@ $OpenBSD: patch-tcpslice_c,v 1.2 2006/04/02 14:45:10 sturm Exp $
while (numfiles--) {
if (sf_timestamp_less_than(&states->file_start_time, &min_time)) {
@@ -590,13 +594,13 @@ open_files(char *filenames[], int numfil
@@ -500,10 +500,10 @@ lowest_start_time(struct state *states, int numfiles)
}
/* Of all the files, what is the latest end time. */
-struct timeval
+struct bpf_timeval
latest_end_time(struct state *states, int numfiles)
{
- struct timeval max_time = states->file_start_time;
+ struct bpf_timeval max_time = states->file_start_time;
while (numfiles--) {
if (sf_timestamp_less_than(&max_time, &states->file_stop_time)) {
@@ -599,12 +599,12 @@ open_files(char *filenames[], int numfiles)
void
extract_slice(struct state *states, int numfiles, char *write_file_name,
extract_slice(struct state *states, int numfiles, const char *write_file_name,
- struct timeval *start_time, struct timeval *stop_time,
+ struct bpf_timeval *start_time, struct bpf_timeval *stop_time,
int keep_dups, int relative_time_merge,
@ -111,13 +97,12 @@ $OpenBSD: patch-tcpslice_c,v 1.2 2006/04/02 14:45:10 sturm Exp $
+ struct bpf_timeval *base_time)
{
struct state *s, *min_state;
pcap_dumper_t *dumper;
- struct timeval temp1, temp2, relative_start, relative_stop;
+ struct bpf_timeval temp1, temp2, relative_start, relative_stop;
int i;
struct state *last_state; /* remember the last packet */
@@ -747,7 +751,7 @@ extract_slice(struct state *states, int
@@ -774,7 +774,7 @@ extract_slice(struct state *states, int numfiles, cons
*/
char *
@ -126,12 +111,3 @@ $OpenBSD: patch-tcpslice_c,v 1.2 2006/04/02 14:45:10 sturm Exp $
{
struct tm *t;
#define NUM_BUFFERS 2
@@ -793,7 +797,7 @@ timestamp_to_string(struct timeval *time
void
dump_times(pcap_t **p, char filename[])
{
- struct timeval first_time, last_time;
+ struct bpf_timeval first_time, last_time;
get_file_range( filename, p, &first_time, &last_time );

View File

@ -1,22 +1,23 @@
$OpenBSD: patch-tcpslice_h,v 1.1 2001/10/18 15:12:40 naddy Exp $
--- tcpslice.h.orig Fri Oct 12 18:23:11 2001
+++ tcpslice.h Fri Oct 12 18:24:17 2001
@@ -22,12 +22,12 @@
$OpenBSD: patch-tcpslice_h,v 1.2 2007/07/13 08:16:16 rui Exp $
--- tcpslice.h.orig Thu May 31 19:20:29 2007
+++ tcpslice.h Thu May 31 19:20:54 2007
@@ -25,13 +25,13 @@
time_t gwtm2secs( struct tm *tm );
time_t gwtm2secs( struct tm *tm );
-int sf_find_end( struct pcap *p, struct timeval *first_timestamp,
- struct timeval *last_timestamp );
-int sf_timestamp_less_than( struct timeval *t1, struct timeval *t2 );
+int sf_find_end( struct pcap *p, struct bpf_timeval *first_timestamp,
+ struct bpf_timeval *last_timestamp );
+int sf_timestamp_less_than( struct bpf_timeval *t1, struct bpf_timeval *t2 );
int sf_find_packet( struct pcap *p,
- struct timeval *min_time, off_t min_pos,
- struct timeval *max_time, off_t max_pos,
- struct timeval *desired_time );
+ struct bpf_timeval *min_time, off_t min_pos,
+ struct bpf_timeval *max_time, off_t max_pos,
+ struct bpf_timeval *desired_time );
-int sf_find_end( struct pcap *p, struct timeval *first_timestamp,
- struct timeval *last_timestamp );
-int sf_timestamp_less_than( struct timeval *t1, struct timeval *t2 );
+int sf_find_end( struct pcap *p, struct bpf_timeval *first_timestamp,
+ struct bpf_timeval *last_timestamp );
+int sf_timestamp_less_than( struct bpf_timeval *t1, struct bpf_timeval *t2 );
int sf_find_packet( struct pcap *p,
- struct timeval *min_time, off_t min_pos,
- struct timeval *max_time, off_t max_pos,
- struct timeval *desired_time );
+ struct bpf_timeval *min_time, off_t min_pos,
+ struct bpf_timeval *max_time, off_t max_pos,
+ struct bpf_timeval *desired_time );
void error(const char *fmt, ...);
void error(const char *fmt, ...);

View File

@ -1,3 +1,3 @@
Tcpslice is a program for extracting portions of packettrace
files generated using tcpdump's -w flag. It can also be used
to glue together several such files.
tcpslice is a program for extracting portions of packettrace
files generated using tcpdump's -w flag. It can also be used
to glue together several such files.

View File

@ -1,6 +1,6 @@
@comment $OpenBSD: PLIST,v 1.3 2004/09/15 18:17:46 espie Exp $
@comment $OpenBSD: PLIST,v 1.4 2007/07/13 08:16:16 rui Exp $
@man man/man1/tcpslice.1
sbin/tcpslice
share/doc/tcpslice/
share/doc/tcpslice/CHANGES
@comment share/doc/tcpslice/CHANGES
share/doc/tcpslice/README