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

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