New version of tcpslice-1.3

This commit is contained in:
Michal Ruprich 2021-03-12 14:05:04 +01:00
parent bf0237e32c
commit 7e75ca498f
7 changed files with 8 additions and 178 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ tcpdump-4.1.1.tar.gz
/tcpdump-4.9.3.tar.gz.sig
/tcpdump-4.99.0.tar.gz
/tcpdump-4.99.0.tar.gz.sig
/tcpslice-1.3.tar.gz

View File

@ -1,88 +0,0 @@
From 954c235f6db6f601d732b6fce48d2e8183c05d49 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 20 Oct 2014 14:43:04 +0200
Subject: [PATCH 4/8] tcpslice: update tcpslice patch to 1.2a3
---
tcpslice-1.2a3/search.c | 22 +++++++++++++++-------
tcpslice-1.2a3/tcpslice.h | 20 ++++++++++++++++++++
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/tcpslice-1.2a3/search.c b/tcpslice-1.2a3/search.c
index 1e2d051..23aa105 100644
--- a/tcpslice-1.2a3/search.c
+++ b/tcpslice-1.2a3/search.c
@@ -53,7 +53,7 @@ static const char rcsid[] =
/* Size of a packet header in bytes; easier than typing the sizeof() all
* the time ...
*/
-#define PACKET_HDR_LEN (sizeof( struct pcap_pkthdr ))
+#define PACKET_HDR_LEN (sizeof( struct pcap_sf_pkthdr ))
extern int snaplen;
@@ -111,16 +111,24 @@ reasonable_header( struct pcap_pkthdr *hdr, time_t first_time, time_t last_time
static void
extract_header( pcap_t *p, u_char *buf, struct pcap_pkthdr *hdr )
{
- memcpy((char *) hdr, (char *) buf, sizeof(struct pcap_pkthdr));
+ struct pcap_sf_pkthdr hdri;
+
+ memcpy((char *) &hdri, (char *) buf, sizeof(struct pcap_sf_pkthdr));
if ( pcap_is_swapped( p ) )
{
- hdr->ts.tv_sec = SWAPLONG(hdr->ts.tv_sec);
- hdr->ts.tv_usec = SWAPLONG(hdr->ts.tv_usec);
- hdr->len = SWAPLONG(hdr->len);
- hdr->caplen = SWAPLONG(hdr->caplen);
+ hdr->ts.tv_sec = SWAPLONG(hdri.ts.tv_sec);
+ hdr->ts.tv_usec = SWAPLONG(hdri.ts.tv_usec);
+ hdr->len = SWAPLONG(hdri.len);
+ hdr->caplen = SWAPLONG(hdri.caplen);
+ }
+ else
+ {
+ hdr->ts.tv_sec = hdri.ts.tv_sec;
+ hdr->ts.tv_usec = hdri.ts.tv_usec;
+ hdr->len = hdri.len;
+ hdr->caplen = hdri.caplen;
}
-
/*
* From bpf/libpcap/savefile.c:
*
diff --git a/tcpslice-1.2a3/tcpslice.h b/tcpslice-1.2a3/tcpslice.h
index de4a01c..9dcd1a1 100644
--- a/tcpslice-1.2a3/tcpslice.h
+++ b/tcpslice-1.2a3/tcpslice.h
@@ -20,6 +20,26 @@
*/
+#include <time.h>
+/* #include <net/bpf.h> */
+
+/*
+ * This is a timeval as stored in disk in a dumpfile.
+ * It has to use the same types everywhere, independent of the actual
+ * `struct timeval'
+ */
+
+struct pcap_timeval {
+ bpf_int32 tv_sec; /* seconds */
+ bpf_int32 tv_usec; /* microseconds */
+};
+
+struct pcap_sf_pkthdr {
+ struct pcap_timeval ts; /* time stamp */
+ bpf_u_int32 caplen; /* length of portion present */
+ bpf_u_int32 len; /* length this packet (off wire) */
+};
+
time_t gwtm2secs( struct tm *tm );
int sf_find_end( struct pcap *p, struct timeval *first_timestamp,
--
2.9.3

View File

@ -1,26 +0,0 @@
From d32956586bfb50b189132d5a15db8a50ef871278 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 20 Oct 2014 15:06:54 +0200
Subject: [PATCH 5/8] tcpslice: remove unneeded include
net/bpf.h doesn't exist on Linux.
---
tcpslice-1.2a3/tcpslice.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tcpslice-1.2a3/tcpslice.c b/tcpslice-1.2a3/tcpslice.c
index e73d76f..895e54f 100644
--- a/tcpslice-1.2a3/tcpslice.c
+++ b/tcpslice-1.2a3/tcpslice.c
@@ -35,8 +35,6 @@ static const char rcsid[] =
#include <sys/file.h>
#include <sys/stat.h>
-#include <net/bpf.h>
-
#include <ctype.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
--
2.9.3

View File

@ -1,27 +0,0 @@
From e159008d2f126d92112858269fb6b2fbca63ffc2 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 20 Oct 2014 15:19:44 +0200
Subject: [PATCH 6/8] tcpslice: don't test the pointer but pointee for NULL
---
tcpslice-1.2a3/tcpslice.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tcpslice-1.2a3/tcpslice.c b/tcpslice-1.2a3/tcpslice.c
index 895e54f..a91439b 100644
--- a/tcpslice-1.2a3/tcpslice.c
+++ b/tcpslice-1.2a3/tcpslice.c
@@ -402,7 +402,9 @@ fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr)
while (isdigit(*t_stop))
++t_stop;
- if (! t_stop)
+
+ if (!(*t_stop))
+ /* we've reached end of string -> bad date format */
error("bad date format %s, problem starting at %s",
time_string, t_start);
--
2.9.3

View File

@ -1,29 +0,0 @@
diff --git a/print-esp.c b/print-esp.c
index 6fabff1..5818cc8 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -242,6 +242,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
if (input_buffer == NULL) {
EVP_CIPHER_CTX_free(ctx);
(*ndo->ndo_error)(ndo, "can't allocate memory for encrypted data buffer");
+ return 0;
}
/*
* Copy the input data to the encrypted data buffer, and pad it
@@ -259,7 +260,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
EVP_CIPHER_CTX_free(ctx);
(*ndo->ndo_error)(ndo, "can't allocate memory for decryption buffer");
}
- EVP_Cipher(ctx, output_buffer, input_buffer, len);
+ EVP_Cipher(ctx, output_buffer, input_buffer, buffer_size);
EVP_CIPHER_CTX_free(ctx);
/*
@@ -815,6 +816,7 @@ esp_print(netdissect_options *ndo,
if (input_buffer == NULL) {
EVP_CIPHER_CTX_free(ctx);
(*ndo->ndo_error)(ndo, "can't allocate memory for encrypted data buffer");
+ return 0;
}
/*
* Copy the input data to the encrypted data buffer,

View File

@ -1,3 +1,3 @@
SHA512 (tcpslice-1.2a3.tar.gz) = 04e12d592807022c78eb4941580ed103995680c69af885bb8f13828a12ec570f7fe93c34c1b20a01d3d99f445d5da17a1fcfbe25b2e3b41abe28304c034654c5
SHA512 (tcpslice-1.3.tar.gz) = 6b9d7c523d22b0c2d19605b9256c99445ac097d051e3aca41dc6e12f8ff69dfb8922a74c328a6db18f42e583343294fe90d501632560bd9b567ab817ca3f9ff9
SHA512 (tcpdump-4.99.0.tar.gz) = 03a434ec41c0026f237bc1e7a928b7ce67dbc342a8d982caded93d987bd356faf706a9d884231bd94f5e2a8580499fe95a28728e37a6672e371a1501ec5d6f79
SHA512 (tcpdump-4.99.0.tar.gz.sig) = 545770f09bec2f4ab3e723ab8582f1256eb0cb774ac2f329de17a45ee8256faea49469b796e17250d10c0455b305d39283c9b1d8b3c5a06c47a0d8088c874803

View File

@ -2,7 +2,7 @@ Summary: A network traffic monitoring tool
Name: tcpdump
Epoch: 14
Version: 4.99.0
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD with advertising
URL: http://www.tcpdump.org
Requires(pre): shadow-utils
@ -10,19 +10,15 @@ BuildRequires: make
BuildRequires: automake openssl-devel libpcap-devel git-core gcc
Source0: http://www.tcpdump.org/release/tcpdump-%{version}.tar.gz
Source1: ftp://ftp.ee.lbl.gov/tcpslice-1.2a3.tar.gz
Source1: ftp://ftp.ee.lbl.gov/tcpslice-1.3.tar.gz
Source2: http://www.tcpdump.org/release/tcpdump-%{version}.tar.gz.sig
Patch0002: 0002-Use-getnameinfo-instead-of-gethostbyaddr.patch
Patch0003: 0003-Drop-root-priviledges-before-opening-first-savefile-.patch
Patch0004: 0004-tcpslice-update-tcpslice-patch-to-1.2a3.patch
Patch0005: 0005-tcpslice-remove-unneeded-include.patch
Patch0006: 0006-tcpslice-don-t-test-the-pointer-but-pointee-for-NULL.patch
Patch0007: 0007-Introduce-nn-option.patch
Patch0009: 0009-Change-n-flag-to-nn-in-TESTonce.patch
#Patch0011: 0011-Evp-cipher-buffers.patch
%define tcpslice_dir tcpslice-1.2a3
%define tcpslice_dir tcpslice-1.3
%description
Tcpdump is a command-line tool for monitoring network traffic.
@ -85,6 +81,9 @@ exit 0
%{_mandir}/man8/tcpdump.8*
%changelog
* Fri Mar 12 2021 Michal Ruprich <mruprich@redhat.com> - 14:4.99.0-2
- New version of tcpslice-1.3
* Thu Feb 11 2021 Michal Ruprich <mruprich@redhat.com> - 14:4.99.0-1
- New version 4.99.0