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

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