Download raw body.
[update] net/tcpslice to 1.7
On 2024/06/06 00:26, Kirill A. Korinsky wrote:
> Greetings,
>
> Here an update of net/tcpslice from 10 years old snapshot to the last
> release from January which requires to increase epoch.
>
> All pathces do not required anymore.
Are you sure about that? OpenBSD's pcap is non-standard and uses
bpf_timeval which is _not_ the same as timeval. (Other OS use timeval
when dealing with packet headers, but use a different struct when
writing timevals to disk).
> Tested on -current/amd64.
>
> diff --git net/tcpslice/Makefile net/tcpslice/Makefile
> index 1ada4b809be..bddf9a126e0 100644
> --- net/tcpslice/Makefile
> +++ net/tcpslice/Makefile
> @@ -1,11 +1,12 @@
> COMMENT= tool for extracting and gluing pcap (tcpdump) files
>
> +V= 1.7
> GH_ACCOUNT= the-tcpdump-group
> GH_PROJECT= tcpslice
> -GH_COMMIT= 2837b722f0a6150971b327a252a59c64b24b9640
> +GH_COMMIT= tcpslice-${V}
>
> -DISTNAME= tcpslice-20140501
> -REVISION= 1
> +DISTNAME= tcpslice-${V}
> +EPOCH= 0
> CATEGORIES= net
>
> HOME_PAGE= https://github.com/the-tcpdump-group/tcpslice
> @@ -17,7 +18,11 @@ PERMIT_PACKAGE= Yes
> WANTLIB= c pcap
>
> SEPARATE_BUILD= Yes
> -CONFIGURE_STYLE=gnu
> +
> +AUTOCONF_VERSION=2.71
> +AUTOMAKE_VERSION=1.16
> +
> +CONFIGURE_STYLE=autoreconf
>
> NO_TEST= Yes
>
> @@ -25,6 +30,6 @@ post-install:
> ${INSTALL_MAN} ${WRKSRC}/tcpslice.1 ${PREFIX}/man/man1/tcpslice.1
> ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/tcpslice
> ${INSTALL_DATA} ${WRKSRC}/CHANGES ${PREFIX}/share/doc/tcpslice
> - ${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/tcpslice
> + ${INSTALL_DATA} ${WRKSRC}/README.md ${PREFIX}/share/doc/tcpslice
>
> .include <bsd.port.mk>
> diff --git net/tcpslice/distinfo net/tcpslice/distinfo
> index e9800ad5628..8569162b9b6 100644
> --- net/tcpslice/distinfo
> +++ net/tcpslice/distinfo
> @@ -1,2 +1,2 @@
> -SHA256 (tcpslice-20140501-2837b722.tar.gz) = 0hHzerRN18LrsVNN/MzXx+bFLykx9AfajfN5xNMZ5tc=
> -SIZE (tcpslice-20140501-2837b722.tar.gz) = 112218
> +SHA256 (tcpslice-1.7-tcpslice.tar.gz) = m/ai/QBXLy2THJvC6gmdVb2I+iRodvoyk9V+lBDhwAc=
> +SIZE (tcpslice-1.7-tcpslice.tar.gz) = 97296
> diff --git net/tcpslice/patches/patch-Makefile_in net/tcpslice/patches/patch-Makefile_in
> deleted file mode 100644
> index 63fdf8735a9..00000000000
> --- net/tcpslice/patches/patch-Makefile_in
> +++ /dev/null
> @@ -1,26 +0,0 @@
> ---- Makefile.in.orig Mon Apr 7 14:09:35 2014
> -+++ Makefile.in Fri Oct 10 13:15:24 2014
> -@@ -39,8 +39,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@ @CPPFLAGS@ @V_DEFS@
> -
> - # Standard CFLAGS
> -@@ -59,9 +59,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.
> --.c.o:
> -- @rm -f $@
> -- $(CC) $(CFLAGS) -c $(srcdir)/$*.c
> -+#.c.o:
> -+# @rm -f $@
> -+# $(CC) $(CFLAGS) -c $(srcdir)/$*.c
> -
> - CSRC = tcpslice.c gmt2local.c gwtm2secs.c machdep.c search.c sessions.c util.c
> - GENSRC = version.c
> diff --git net/tcpslice/patches/patch-search_c net/tcpslice/patches/patch-search_c
> deleted file mode 100644
> index 34a3ef1f2be..00000000000
> --- net/tcpslice/patches/patch-search_c
> +++ /dev/null
> @@ -1,79 +0,0 @@
> ---- search.c.orig Mon Apr 7 14:09:35 2014
> -+++ search.c Fri Oct 10 13:15:24 2014
> -@@ -302,8 +302,8 @@ find_header( pcap_t *p, u_char *buf, int buf_len,
> - * present in the dump file.
> - */
> - int
> --sf_find_end( pcap_t *p, struct timeval *first_timestamp,
> -- struct timeval *last_timestamp )
> -+sf_find_end( pcap_t *p, struct bpf_timeval *first_timestamp,
> -+ struct bpf_timeval *last_timestamp )
> - {
> - time_t first_time = first_timestamp->tv_sec;
> - off_t len_file;
> -@@ -406,7 +406,7 @@ sf_find_end( pcap_t *p, struct timeval *first_timestam
> - /* Takes two timeval's and returns the difference, tv2 - tv1, as a double. */
> -
> - static double
> --timeval_diff( struct timeval *tv1, struct timeval *tv2 )
> -+timeval_diff( struct bpf_timeval *tv1, struct bpf_timeval *tv2 )
> - {
> - double result = (tv2->tv_sec - tv1->tv_sec);
> - result += (tv2->tv_usec - tv1->tv_usec) / 1000000.0;
> -@@ -418,7 +418,7 @@ timeval_diff( struct timeval *tv1, struct timeval *tv2
> - /* Returns true if timestamp t1 is chronologically less than timestamp t2. */
> -
> - int
> --sf_timestamp_less_than( struct timeval *t1, struct timeval *t2 )
> -+sf_timestamp_less_than( struct bpf_timeval *t1, struct bpf_timeval *t2 )
> - {
> - return t1->tv_sec < t2->tv_sec ||
> - (t1->tv_sec == t2->tv_sec &&
> -@@ -432,9 +432,9 @@ sf_timestamp_less_than( struct timeval *t1, struct tim
> - */
> -
> - static off_t
> --interpolated_position( struct timeval *min_time, off_t min_pos,
> -- struct timeval *max_time, off_t max_pos,
> -- struct timeval *desired_time )
> -+interpolated_position( struct bpf_timeval *min_time, off_t min_pos,
> -+ struct bpf_timeval *max_time, off_t max_pos,
> -+ struct bpf_timeval *desired_time )
> - {
> - double full_span = timeval_diff( max_time, min_time );
> - double desired_span = timeval_diff( desired_time, min_time );
> -@@ -455,7 +455,7 @@ interpolated_position( struct timeval *min_time, off_t
> - */
> -
> - static int
> --read_up_to( pcap_t *p, struct timeval *desired_time )
> -+read_up_to( pcap_t *p, struct bpf_timeval *desired_time )
> - {
> - struct pcap_pkthdr hdr;
> - const u_char *buf;
> -@@ -464,7 +464,7 @@ read_up_to( pcap_t *p, struct timeval *desired_time )
> -
> - for ( ; ; )
> - {
> -- struct timeval *timestamp;
> -+ struct bpf_timeval *timestamp;
> -
> - pos = FTELL( pcap_file( p ) );
> - buf = pcap_next( p, &hdr );
> -@@ -512,12 +512,12 @@ read_up_to( pcap_t *p, struct timeval *desired_time )
> -
> - int
> - sf_find_packet( pcap_t *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 status = 1;
> -- struct timeval min_time_copy, max_time_copy;
> -+ struct bpf_timeval min_time_copy, max_time_copy;
> - u_int num_bytes = MAX_BYTES_FOR_DEFINITE_HEADER;
> - int num_bytes_read;
> - off_t desired_pos, present_pos;
> diff --git net/tcpslice/patches/patch-tcpslice_c net/tcpslice/patches/patch-tcpslice_c
> deleted file mode 100644
> index 1e77f9b6472..00000000000
> --- net/tcpslice/patches/patch-tcpslice_c
> +++ /dev/null
> @@ -1,112 +0,0 @@
> ---- tcpslice.c.orig Mon Apr 7 14:09:35 2014
> -+++ tcpslice.c Fri Oct 10 13:15:24 2014
> -@@ -99,7 +99,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 */
> - last_pkt_time; /* time of most recently read pkt */
> -@@ -123,18 +123,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);
> --struct timeval lowest_start_time(struct state *states, int numfiles);
> --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);
> - 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,
> -- struct timeval *base_time);
> --char *timestamp_to_string(struct timeval *timestamp);
> -+ struct bpf_timeval *base_time);
> -+char *timestamp_to_string(struct bpf_timeval *timestamp);
> - void dump_times(struct state *states, int numfiles);
> - __dead void usage(void)__attribute__((volatile));
> -
> -@@ -159,7 +159,7 @@ main(int argc, char **argv)
> - char *start_time_string = 0;
> - char *stop_time_string = 0;
> - 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;
> - char ebuf[PCAP_ERRBUF_SIZE];
> - struct state *states;
> -
> -@@ -304,12 +304,12 @@ int is_timestamp( char *str )
> - * containing the specified time.
> - */
> -
> --struct timeval
> --parse_time(char *time_string, struct timeval base_time)
> -+struct bpf_timeval
> -+parse_time(char *time_string, struct bpf_timeval base_time)
> - {
> - struct tm *bt = localtime((time_t *) &base_time.tv_sec);
> - struct tm t;
> -- struct timeval result;
> -+ struct bpf_timeval result;
> - time_t usecs = 0;
> - int is_delta = (time_string[0] == '+');
> -
> -@@ -483,10 +483,10 @@ fill_tm(char *time_string, int is_delta, struct tm *t,
> -
> -
> - /* Of all the files, what is the lowest start time. */
> --struct timeval
> -+struct bpf_timeval
> - lowest_start_time(struct state *states, int numfiles)
> - {
> -- struct timeval min_time = states->file_start_time;
> -+ struct bpf_timeval min_time = states->file_start_time;
> -
> - while (numfiles--) {
> - if (sf_timestamp_less_than(&states->file_start_time, &min_time)) {
> -@@ -498,10 +498,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)) {
> -@@ -597,12 +597,12 @@ open_files(char *filenames[], int numfiles)
> -
> - 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,
> -- struct timeval *base_time)
> -+ struct bpf_timeval *base_time)
> - {
> - struct state *s, *min_state;
> -- 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 */
> -@@ -772,7 +772,7 @@ extract_slice(struct state *states, int numfiles, cons
> - */
> -
> - char *
> --timestamp_to_string(struct timeval *timestamp)
> -+timestamp_to_string(struct bpf_timeval *timestamp)
> - {
> - struct tm *t;
> - #define NUM_BUFFERS 2
> diff --git net/tcpslice/patches/patch-tcpslice_h net/tcpslice/patches/patch-tcpslice_h
> deleted file mode 100644
> index b4872e87f69..00000000000
> --- net/tcpslice/patches/patch-tcpslice_h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> ---- 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 );
> -
> --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, ...);
> -
> diff --git net/tcpslice/pkg/PLIST net/tcpslice/pkg/PLIST
> index 601b90e950d..3a5a80d43ac 100644
> --- net/tcpslice/pkg/PLIST
> +++ net/tcpslice/pkg/PLIST
> @@ -1,5 +1,5 @@
> +@bin bin/tcpslice
> @man man/man1/tcpslice.1
> -@bin sbin/tcpslice
> share/doc/tcpslice/
> @comment share/doc/tcpslice/CHANGES
> -share/doc/tcpslice/README
> +share/doc/tcpslice/README.md
>
>
> --
> wbr, Kirill
>
[update] net/tcpslice to 1.7