blob: 386b7f83acf4b340be0b1d1f7ab36140fe5a8c8d [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001Upstream-Status: Pending [from tcpdump-4.1.1-1.fc14.src.rpm]
2
3Signed-off-by: Roy Li <rongqing.li@windriver.com>
4
5--- tcpslice-1.2a3.orig/search.c 2000-09-10 10:52:40.000000000 +0200
6+++ tcpslice-1.2a3/search.c 2006-07-28 14:56:55.000000000 +0200
7@@ -53,7 +53,7 @@
8 /* Size of a packet header in bytes; easier than typing the sizeof() all
9 * the time ...
10 */
11-#define PACKET_HDR_LEN (sizeof( struct pcap_pkthdr ))
12+#define PACKET_HDR_LEN (sizeof( struct pcap_sf_pkthdr ))
13
14 extern int snaplen;
15
16@@ -111,16 +111,24 @@
17 static void
18 extract_header( pcap_t *p, u_char *buf, struct pcap_pkthdr *hdr )
19 {
20- memcpy((char *) hdr, (char *) buf, sizeof(struct pcap_pkthdr));
21+ struct pcap_sf_pkthdr hdri;
22+
23+ memcpy((char *) &hdri, (char *) buf, sizeof(struct pcap_sf_pkthdr));
24
25 if ( pcap_is_swapped( p ) )
26 {
27- hdr->ts.tv_sec = SWAPLONG(hdr->ts.tv_sec);
28- hdr->ts.tv_usec = SWAPLONG(hdr->ts.tv_usec);
29- hdr->len = SWAPLONG(hdr->len);
30- hdr->caplen = SWAPLONG(hdr->caplen);
31+ hdr->ts.tv_sec = SWAPLONG(hdri.ts.tv_sec);
32+ hdr->ts.tv_usec = SWAPLONG(hdri.ts.tv_usec);
33+ hdr->len = SWAPLONG(hdri.len);
34+ hdr->caplen = SWAPLONG(hdri.caplen);
35+ }
36+ else
37+ {
38+ hdr->ts.tv_sec = hdri.ts.tv_sec;
39+ hdr->ts.tv_usec = hdri.ts.tv_usec;
40+ hdr->len = hdri.len;
41+ hdr->caplen = hdri.caplen;
42 }
43-
44 /*
45 * From bpf/libpcap/savefile.c:
46 *
47--- tcpslice-1.2a3.orig/tcpslice.h 1995-11-02 00:40:53.000000000 +0100
48+++ tcpslice-1.2a3/tcpslice.h 2006-07-28 14:56:55.000000000 +0200
49@@ -20,6 +20,26 @@
50 */
51
52
53+#include <time.h>
54+/* #include <net/bpf.h> */
55+
56+/*
57+ * This is a timeval as stored in disk in a dumpfile.
58+ * It has to use the same types everywhere, independent of the actual
59+ * `struct timeval'
60+ */
61+
62+struct pcap_timeval {
63+ bpf_int32 tv_sec; /* seconds */
64+ bpf_int32 tv_usec; /* microseconds */
65+};
66+
67+struct pcap_sf_pkthdr {
68+ struct pcap_timeval ts; /* time stamp */
69+ bpf_u_int32 caplen; /* length of portion present */
70+ bpf_u_int32 len; /* length this packet (off wire) */
71+};
72+
73 time_t gwtm2secs( struct tm *tm );
74
75 int sf_find_end( struct pcap *p, struct timeval *first_timestamp,