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