diff options
-rw-r--r-- | lib/libpcap/pcap-int.h | 17 | ||||
-rw-r--r-- | lib/libpcap/pcap.h | 6 | ||||
-rw-r--r-- | sbin/isakmpd/log.c | 7 | ||||
-rw-r--r-- | share/man/man4/bpf.4 | 26 | ||||
-rw-r--r-- | sys/net/bpf.c | 8 | ||||
-rw-r--r-- | sys/net/bpf.h | 9 | ||||
-rw-r--r-- | usr.sbin/tcpdump/interface.h | 7 | ||||
-rw-r--r-- | usr.sbin/tcpdump/util.c | 6 |
8 files changed, 41 insertions, 45 deletions
diff --git a/lib/libpcap/pcap-int.h b/lib/libpcap/pcap-int.h index d86910de128..c8d261c736b 100644 --- a/lib/libpcap/pcap-int.h +++ b/lib/libpcap/pcap-int.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap-int.h,v 1.8 2000/04/26 21:25:53 jakob Exp $ */ +/* $OpenBSD: pcap-int.h,v 1.9 2001/10/02 18:04:35 deraadt Exp $ */ /* * Copyright (c) 1994, 1995, 1996 @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) $Header: /home/cvs/src/lib/libpcap/pcap-int.h,v 1.8 2000/04/26 21:25:53 jakob Exp $ (LBL) + * @(#) $Header: /home/cvs/src/lib/libpcap/pcap-int.h,v 1.9 2001/10/02 18:04:35 deraadt Exp $ (LBL) */ #ifndef pcap_int_h @@ -100,22 +100,11 @@ struct pcap { }; /* - * This is a timeval as stored in disk in a dumpfile. - * It has to use the same types everywhere, independent of the actual - * `struct timeval' - */ - -struct pcap_timeval { - bpf_int32 tv_sec; /* seconds */ - bpf_int32 tv_usec; /* microseconds */ -}; - -/* * How a `pcap_pkthdr' is actually stored in the dumpfile. */ struct pcap_sf_pkthdr { - struct pcap_timeval ts; /* time stamp */ + struct bpf_timeval ts; /* time stamp */ bpf_u_int32 caplen; /* length of portion present */ bpf_u_int32 len; /* length this packet (off wire) */ }; diff --git a/lib/libpcap/pcap.h b/lib/libpcap/pcap.h index 1d81843d512..1ef558d9b5f 100644 --- a/lib/libpcap/pcap.h +++ b/lib/libpcap/pcap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap.h,v 1.8 2000/04/26 21:25:53 jakob Exp $ */ +/* $OpenBSD: pcap.h,v 1.9 2001/10/02 18:04:35 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996, 1997 @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) $Header: /home/cvs/src/lib/libpcap/pcap.h,v 1.8 2000/04/26 21:25:53 jakob Exp $ (LBL) + * @(#) $Header: /home/cvs/src/lib/libpcap/pcap.h,v 1.9 2001/10/02 18:04:35 deraadt Exp $ (LBL) */ #ifndef lib_pcap_h @@ -84,7 +84,7 @@ struct pcap_file_header { * packet interfaces. */ struct pcap_pkthdr { - struct timeval ts; /* time stamp */ + struct bpf_timeval ts; /* time stamp */ bpf_u_int32 caplen; /* length of portion present */ bpf_u_int32 len; /* length this packet (off wire) */ }; diff --git a/sbin/isakmpd/log.c b/sbin/isakmpd/log.c index 5697e04545e..badacb1b7e8 100644 --- a/sbin/isakmpd/log.c +++ b/sbin/isakmpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.22 2001/08/18 20:50:02 deraadt Exp $ */ +/* $OpenBSD: log.c,v 1.23 2001/10/02 18:04:35 deraadt Exp $ */ /* $EOM: log.c,v 1.30 2000/09/29 08:19:23 niklas Exp $ */ /* @@ -467,6 +467,7 @@ log_packet_iov (struct sockaddr *src, struct sockaddr *dst, struct iovec *iov, struct packhdr hdr; struct udphdr udp; int off, datalen, hdrlen, i; + struct timeval tv; for (i = 0, datalen = 0; i < iovcnt; i++) datalen += iov[i].iov_len; @@ -540,7 +541,9 @@ log_packet_iov (struct sockaddr *src, struct sockaddr *dst, struct iovec *iov, hdrlen += sizeof hdr.sa_family; /* pcap file packet header */ - gettimeofday (&hdr.pcap.ts, 0); + gettimeofday (&tv, 0); + hdr.pcap.ts.tv_sec = tv.tv_sec; + hdr.pcap.ts.tv_usec = tv.tv_usec; hdr.pcap.caplen = datalen + hdrlen; hdr.pcap.len = datalen + hdrlen; diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4 index be296a60833..bed5f1a4d5c 100644 --- a/share/man/man4/bpf.4 +++ b/share/man/man4/bpf.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bpf.4,v 1.10 2001/06/23 07:03:52 pjanzen Exp $ +.\" $OpenBSD: bpf.4,v 1.11 2001/10/02 18:04:35 deraadt Exp $ .\" $NetBSD: bpf.4,v 1.7 1995/09/27 18:31:50 thorpej Exp $ .\" .\" Copyright (c) 1990 The Regents of the University of California. @@ -328,11 +328,12 @@ The following structure is prepended to each packet returned by .Xr read 2 : .Pp .Bd -literal -offset indent + struct bpf_hdr { - struct timeval bh_tstamp; - u_long bh_caplen; - u_long bh_datalen; - u_short bh_hdrlen; + struct bpf_timeval bh_tstamp; + u_int32_t bh_caplen; + u_int32_t bh_datalen; + u_int16_t bh_hdrlen; }; .Ed .Pp @@ -406,10 +407,10 @@ The following structure defines the instruction format: .Pp .Bd -literal -offset indent struct bpf_insn { - u_short code; - u_char jt; - u_char jf; - long k; + u_int16_t code; + u_char jt; + u_char jf; + u_int32_t k; }; .Ed .Pp @@ -910,10 +911,3 @@ packets. .Pp Data link protocols with variable length headers are not currently supported. .Pp -Under SunOS, if a -.Nm -application reads more than 2^31 bytes of data, read will fail with -.Er EINVAL . -You can either fix the bug in SunOS, or lseek to 0 when read fails for this -reason. - diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 702bf43047a..7d44697c2b3 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.29 2001/09/15 20:40:46 frantzen Exp $ */ +/* $OpenBSD: bpf.c,v 1.30 2001/10/02 18:04:35 deraadt Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -1069,6 +1069,8 @@ bpf_catchpacket(d, pkt, pktlen, snaplen, cpfn) register struct bpf_hdr *hp; register int totlen, curlen; register int hdrlen = d->bd_bif->bif_hdrlen; + struct timeval tv; + /* * Figure out how many bytes to move. If the packet is * greater or equal to the snapshot length, transfer that @@ -1113,7 +1115,9 @@ bpf_catchpacket(d, pkt, pktlen, snaplen, cpfn) * Append the bpf header. */ hp = (struct bpf_hdr *)(d->bd_sbuf + curlen); - microtime(&hp->bh_tstamp); + microtime(&tv); + hp->bh_tstamp.tv_sec = tv.tv_sec; + hp->bh_tstamp.tv_usec = tv.tv_usec; hp->bh_datalen = pktlen; hp->bh_hdrlen = hdrlen; /* diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 61df4a03483..7a8916ec2fd 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.h,v 1.16 2001/06/25 23:02:17 provos Exp $ */ +/* $OpenBSD: bpf.h,v 1.17 2001/10/02 18:04:35 deraadt Exp $ */ /* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */ /* @@ -116,11 +116,16 @@ struct bpf_version { #define BIOCGHDRCMPLT _IOR('B',116, u_int) #define BIOCSHDRCMPLT _IOW('B',117, u_int) +struct bpf_timeval { + u_int32_t tv_sec; + u_int32_t tv_usec; +}; + /* * Structure prepended to each packet. */ struct bpf_hdr { - struct timeval bh_tstamp; /* time stamp */ + struct bpf_timeval bh_tstamp; /* time stamp */ u_int32_t bh_caplen; /* length of captured portion */ u_int32_t bh_datalen; /* original length of packet */ u_int16_t bh_hdrlen; /* length of bpf header (this struct diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h index 4874e16e3b9..b6852b81951 100644 --- a/usr.sbin/tcpdump/interface.h +++ b/usr.sbin/tcpdump/interface.h @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.h,v 1.27 2001/06/25 23:05:17 provos Exp $ */ +/* $OpenBSD: interface.h,v 1.28 2001/10/02 18:04:35 deraadt Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -20,7 +20,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /home/cvs/src/usr.sbin/tcpdump/interface.h,v 1.27 2001/06/25 23:05:17 provos Exp $ (LBL) + * @(#) $Header: /home/cvs/src/usr.sbin/tcpdump/interface.h,v 1.28 2001/10/02 18:04:35 deraadt Exp $ (LBL) */ #ifndef tcpdump_interface_h @@ -138,9 +138,10 @@ extern const u_char *snapend; #ifdef __STDC__ struct timeval; +struct bpf_timeval; #endif -extern void ts_print(const struct timeval *); +extern void ts_print(const struct bpf_timeval *); extern int fn_print(const u_char *, const u_char *); extern int fn_printn(const u_char *, u_int, const u_char *); diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c index 667be93a72d..417e2fc183a 100644 --- a/usr.sbin/tcpdump/util.c +++ b/usr.sbin/tcpdump/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.12 2001/09/03 13:25:53 jakob Exp $ */ +/* $OpenBSD: util.c,v 1.13 2001/10/02 18:04:36 deraadt Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/util.c,v 1.12 2001/09/03 13:25:53 jakob Exp $ (LBL)"; + "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/util.c,v 1.13 2001/10/02 18:04:36 deraadt Exp $ (LBL)"; #endif #include <sys/types.h> @@ -121,7 +121,7 @@ fn_printn(register const u_char *s, register u_int n, * Print the timestamp */ void -ts_print(register const struct timeval *tvp) +ts_print(register const struct bpf_timeval *tvp) { register int s; #define TSBUFLEN 32 |