Blame SOURCES/0004-tcpslice-update-tcpslice-patch-to-1.2a3.patch

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