+$OpenBSD: CHANGES,v 1.2 1996/03/04 15:47:12 mickey Exp $
$NetBSD: CHANGES,v 1.2 1995/03/06 11:37:58 mycroft Exp $
-@(#) Header: CHANGES,v 1.4 94/06/20 19:22:33 leres Exp (LBL)
+@(#) Header: CHANGES,v 1.4+ 94/06/20 19:22:33 leres Exp $ (LBL)
+
+v0.0.6 Fri Apr 28 04:07:13 PDT 1995
+
+- Add missing variable declaration missing from 0.0.6
+
+v0.0.5 Fri Apr 28 00:22:21 PDT 1995
+
+- Workaround for problems when pcap_read() returns 0 due to the timeout
+ expiring.
+
+v0.0.4 Thu Apr 20 20:41:48 PDT 1995
+
+- Change configuration to not use gcc v2 flags with gcc v1.
+
+- Fixed a bug in pcap_next(); if pcap_dispatch() returns 0, pcap_next()
+ should also return 0. Thanks to Richard Stevens (rstevens@noao.edu).
+
+- Fixed configure to test for snoop before dlpi to avoid problems under
+ IRIX 5. Thanks to J. Eric Townsend (jet@abulafia.genmagic.com).
+
+- Hack around deficiency in Ultrix's make.
+
+- Fix two bugs related to the Solaris pre-5.3.2 bufmod bug; handle
+ savefiles that have more than snapshot bytes of data in them (so we
+ can read old savefiles) and avoid writing such files.
+
+v0.0.3 Tue Oct 18 18:13:46 PDT 1994
+
+- Fixed configure to test for snoop before dlpi to avoid problems under
+ IRIX 5. Thanks to J. Eric Townsend (jet@abulafia.genmagic.com).
+
+v0.0.2 Wed Oct 12 20:56:37 PDT 1994
+
+- Implement timeout in the dlpi pcap_open_live(). Thanks to Richard
+ Stevens.
+
+- Determine pcap link type from dlpi media type. Resulted from report
+ by Mahesh Jethanandani (mahesh@npix.com).
+
+v0.0.1 Fri Jun 24 14:50:57 PDT 1994
+
+- Fixed bug in nit_setflags() in pcap-snit.c. The streams ioctl timeout
+ wasn't being initialized sometimes resulting in an "NIOCSFLAGS:
+ Invalid argument" error under OSF/1. Reported by Matt Day
+ (mday@artisoft.com) and Danny Mitzel (dmitzel@whitney.hitc.com).
+
+- Turn on FDDI support by default.
v0.0 Mon Jun 20 19:20:16 PDT 1994
+# $OpenBSD: Makefile,v 1.2 1996/03/04 15:47:13 mickey Exp $
# $NetBSD: Makefile,v 1.1 1995/03/06 11:38:04 mycroft Exp $
LIB= pcap
+$OpenBSD: README,v 1.2 1996/03/04 15:47:15 mickey Exp $
$NetBSD: README,v 1.2 1995/03/06 11:38:07 mycroft Exp $
@(#) Header: README,v 1.7 94/06/20 18:56:55 leres Exp (LBL)
-LIBPCAP 0.0
+LIBPCAP 0.0.6
Lawrence Berkeley Laboratory
Network Research Group
libpcap@ee.lbl.gov
+/* $OpenBSD: bpf_image.c,v 1.2 1996/03/04 15:47:16 mickey Exp $ */
/* $NetBSD: bpf_image.c,v 1.2 1995/03/06 11:38:11 mycroft Exp $ */
/*
+/* $OpenBSD: etherent.c,v 1.2 1996/03/04 15:47:17 mickey Exp $ */
/* $NetBSD: etherent.c,v 1.2 1995/03/06 11:38:14 mycroft Exp $ */
/*
+/* $OpenBSD: ethertype.h,v 1.2 1996/03/04 15:47:17 mickey Exp $ */
/* $NetBSD: ethertype.h,v 1.2 1995/03/06 11:38:17 mycroft Exp $ */
/*
+/* $OpenBSD: gencode.c,v 1.2 1996/03/04 15:47:18 mickey Exp $ */
/* $NetBSD: gencode.c,v 1.2 1995/03/06 11:38:21 mycroft Exp $ */
/*
+/* $OpenBSD: gencode.h,v 1.2 1996/03/04 15:47:20 mickey Exp $ */
/* $NetBSD: gencode.h,v 1.2 1995/03/06 11:38:24 mycroft Exp $ */
/*
%{
+/* $OpenBSD: grammar.y,v 1.2 1996/03/04 15:47:21 mickey Exp $ */
/* $NetBSD: grammar.y,v 1.2 1995/03/06 11:38:27 mycroft Exp $ */
/*
%}
%union {
+#define yylval pcap_lval
int i;
u_long h;
u_char *e;
+/* $OpenBSD: inet.c,v 1.2 1996/03/04 15:47:22 mickey Exp $ */
/* $NetBSD: inet.c,v 1.2 1995/03/06 11:38:29 mycroft Exp $ */
/*
+/* $OpenBSD: nametoaddr.c,v 1.2 1996/03/04 15:47:22 mickey Exp $ */
/* $NetBSD: nametoaddr.c,v 1.3 1995/04/29 05:42:23 cgd Exp $ */
/*
+/* $OpenBSD: optimize.c,v 1.2 1996/03/04 15:47:24 mickey Exp $ */
/* $NetBSD: optimize.c,v 1.3 1995/04/29 05:42:28 cgd Exp $ */
/*
+/* $OpenBSD: pcap-bpf.c,v 1.3 1996/03/04 15:47:25 mickey Exp $ */
/* $NetBSD: pcap-bpf.c,v 1.3 1995/04/29 05:42:31 cgd Exp $ */
/*
+/* $OpenBSD: pcap-int.h,v 1.2 1996/03/04 15:47:26 mickey Exp $ */
/* $NetBSD: pcap-int.h,v 1.2 1995/03/06 11:38:47 mycroft Exp $ */
/*
+/* $OpenBSD: pcap-namedb.h,v 1.2 1996/03/04 15:47:26 mickey Exp $ */
/* $NetBSD: pcap-namedb.h,v 1.2 1995/03/06 11:38:48 mycroft Exp $ */
/*
+.\" $OpenBSD: pcap.3,v 1.3 1996/03/04 15:47:27 mickey Exp $
.\" $NetBSD: pcap.3,v 1.2 1995/03/06 11:39:03 mycroft Exp $
.\"
.\" Copyright (c) 1994
+/* $OpenBSD: pcap.c,v 1.2 1996/03/04 15:47:28 mickey Exp $ */
/* $NetBSD: pcap.c,v 1.2 1995/03/06 11:39:05 mycroft Exp $ */
/*
- * Copyright (c) 1993, 1994
+ * Copyright (c) 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
int
pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
{
+ register int cc;
+
if (p->sf.rfile != NULL)
return (pcap_offline_read(p, cnt, callback, user));
- else
- return (pcap_read(p, cnt, callback, user));
+ /* XXX keep reading until we get something (or an error occurs) */
+ do {
+ cc = pcap_read(p, cnt, callback, user);
+ } while (cc == 0);
+ return (cc);
+
}
int
{
for (;;) {
int n = pcap_dispatch(p, cnt, callback, user);
- if (n < 0)
+ if (n <= 0)
return (n);
if (cnt > 0) {
cnt -= n;
struct singleton s;
s.hdr = h;
- if (pcap_dispatch(p, 1, pcap_oneshot, (u_char*)&s) < 0)
+ if (pcap_dispatch(p, 1, pcap_oneshot, (u_char*)&s) <= 0)
return (0);
return (s.pkt);
}
+/* $OpenBSD: pcap.h,v 1.3 1996/03/04 15:47:29 mickey Exp $ */
/* $NetBSD: pcap.h,v 1.2 1995/03/06 11:39:07 mycroft Exp $ */
/*
+/* $OpenBSD: savefile.c,v 1.2 1996/03/04 15:47:30 mickey Exp $ */
/* $NetBSD: savefile.c,v 1.2 1995/03/06 11:39:10 mycroft Exp $ */
/*
}
if (hdr->caplen > buflen) {
- sprintf(p->errbuf, "bad dump file format");
- return (-1);
- }
+ /*
+ * This can happen due to Solaris 2.3 systems tripping
+ * over the BUFMOD problem and not setting the snapshot
+ * correctly in the savefile header. If the caplen isn't
+ * grossly wrong, try to salvage.
+ */
+ static u_char *tp = NULL;
+ static int tsize = 0;
+
+ if (tsize < hdr->caplen) {
+ tsize = ((hdr->caplen + 1023) / 1024) * 1024;
+ if (tp != NULL)
+ free((u_char *)tp);
+ tp = (u_char *)malloc(tsize);
+ if (tp == NULL) {
+ sprintf(p->errbuf, "BUFMOD hack malloc");
+ return (-1);
+ }
+ }
+ if (fread((char *)tp, hdr->caplen, 1, fp) != 1) {
+ sprintf(p->errbuf, "truncated dump file");
+ return (-1);
+ }
+ memcpy((char *)buf, (char *)tp, buflen);
- /* read the packet itself */
+ } else {
+ /* read the packet itself */
- if (fread((char *)buf, hdr->caplen, 1, fp) != 1) {
- sprintf(p->errbuf, "truncated dump file");
- return (-1);
+ if (fread((char *)buf, hdr->caplen, 1, fp) != 1) {
+ sprintf(p->errbuf, "truncated dump file");
+ return (-1);
+ }
}
return (0);
}
struct pcap_pkthdr h;
status = sf_next_packet(p, &h, p->buffer, p->bufsize);
- if (status)
- return (-1);
+ if (status) {
+ if (status == 1)
+ return (0);
+ return (status);
+ }
if (fcode == NULL ||
bpf_filter(fcode, p->buffer, h.len, h.caplen)) {
%{
+/* $OpenBSD: scanner.l,v 1.2 1996/03/04 15:47:30 mickey Exp $ */
/* $NetBSD: scanner.l,v 1.2 1995/03/06 11:39:12 mycroft Exp $ */
/*