Resolve conflicts
This commit is contained in:
parent
985e82ae38
commit
a520af71e9
@ -1,5 +1,91 @@
|
||||
$NetBSD: CHANGES,v 1.3 1996/12/13 08:25:54 mikel Exp $
|
||||
@(#) Header: CHANGES,v 1.34 96/07/23 14:36:14 leres Exp (LBL)
|
||||
$NetBSD: CHANGES,v 1.4 1997/10/03 15:53:00 christos Exp $
|
||||
@(#) Header: CHANGES,v 1.43 97/09/24 19:48:58 leres Exp (LBL)
|
||||
|
||||
v0.4 Wed Sep 24 19:48:54 PDT 1997
|
||||
|
||||
- Fix endian problem with DLT_NULL devices. From FreeBSD via Bill
|
||||
Fenner (fenner@parc.xerox.com)
|
||||
|
||||
- Fix alignment problem with FDDI under DLPI. This was causing core
|
||||
dumps under Solaris.
|
||||
|
||||
- Added configure options to disable flex and bison. Resulted from a
|
||||
bug report by barnett@grymoire.crd.ge.com (Bruce Barnett). Also added
|
||||
options to disable gcc and to force a particular packet capture type.
|
||||
|
||||
- Added support for Fore ATM interfaces (qaa and fa) under IRIX. Thanks
|
||||
to John Hawkinson (jhawk@mit.edu)
|
||||
|
||||
- Change Linux PPP and SLIP to use DLT_RAW since the kernel does not
|
||||
supply any "link layer" data.
|
||||
|
||||
- Change Linux to use SIOCGIFHWADDR ioctl to determine link layer type.
|
||||
Thanks to Thomas Sailer (sailer@ife.ee.ethz.ch)
|
||||
|
||||
- Change IRIX PPP to use DLT_RAW since the kernel does not supply any
|
||||
"link layer" data.
|
||||
|
||||
- Modified to support the new BSD/OS 2.1 PPP and SLIP link layer header
|
||||
formats.
|
||||
|
||||
- Added some new SGI snoop interface types. Thanks to Steve Alexander
|
||||
(sca@refugee.engr.sgi.com)
|
||||
|
||||
- Fixes for HP-UX 10.20 (which is similar to HP-UX 9). Thanks to
|
||||
Richard Allen (ra@hp.is) and Steinar Haug (sthaug@nethelp.no)
|
||||
|
||||
- Fddi supports broadcast as reported by Jeff Macdonald
|
||||
(jeff@iacnet.com). Also correct ieee802 and arcnet.
|
||||
|
||||
- Determine Linux pcap buffer size at run time or else it might not be
|
||||
big enough for some interface types (e.g. FDDI). Thanks to Jes
|
||||
Sorensen (Jes.Sorensen@cern.ch)
|
||||
|
||||
- Fix some linux alignment problems.
|
||||
|
||||
- Document promisc argument to pcap_open_live(). Reported by Ian Marsh
|
||||
(ianm@sics.se)
|
||||
|
||||
- Support Metricom radio packets under Linux. Thanks to Kevin Lai
|
||||
(laik@gunpowder.stanford.edu)
|
||||
|
||||
- Bind to interface name under Linux to avoid packets from multiple
|
||||
interfaces on multi-homed hosts. Thanks to Kevin Lai
|
||||
(laik@gunpowder.stanford.edu)
|
||||
|
||||
- Change L_SET to SEEK_SET for HP-UX. Thanks to Roland Roberts
|
||||
(rroberts@muller.com)
|
||||
|
||||
- Fixed an uninitialized memory reference found by Kent Vander Velden
|
||||
(graphix@iastate.edu)
|
||||
|
||||
- Fixed lex pattern for IDs to allow leading digits. As reported by
|
||||
Theo de Raadt (deraadt@cvs.openbsd.org)
|
||||
|
||||
- Fixed Linux include file problems when using GNU libc.
|
||||
|
||||
- Ifdef ARPHRD_FDDI since not all versions of the Linux kernel have it.
|
||||
Reported reported by Eric Jacksch (jacksch@tenebris.ca)
|
||||
|
||||
v0.3 Sat Nov 30 20:56:27 PST 1996
|
||||
|
||||
- Added Linux support.
|
||||
|
||||
- Fixed savefile bugs.
|
||||
|
||||
- Solaris x86 fix from Tim Rylance (t.rylance@elsevier.nl)
|
||||
|
||||
- Add support for bpf kernel port filters.
|
||||
|
||||
- Remove duplicate atalk protocol table entry. Thanks to Christian
|
||||
Hopps (chopps@water.emich.edu)
|
||||
|
||||
- Fixed pcap_lookupdev() to ignore nonexistent devices. This was
|
||||
reported to happen under BSD/OS by David Vincenzetti
|
||||
(vince@cryptonet.it)
|
||||
|
||||
- Avoid solaris compiler warnings. Thanks to Bruce Barnett
|
||||
(barnett@grymoire.crd.ge.com)
|
||||
|
||||
v0.2.1 Sun Jul 14 03:02:26 PDT 1996
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
# $NetBSD: Makefile,v 1.11 1997/05/15 10:04:27 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.12 1997/10/03 15:53:01 christos Exp $
|
||||
|
||||
WARNS?= 1
|
||||
LIB= pcap
|
||||
MAN= pcap.3
|
||||
MAN= pcap.3
|
||||
|
||||
LEX= flex
|
||||
|
||||
@ -12,12 +13,13 @@ CFLAGS+=-DLBL_ALIGN=1
|
||||
LFLAGS+=-olex.yy.c -Ppcap_
|
||||
YFLAGS+=-ppcap_
|
||||
|
||||
SRCS= bpf_filter.c bpf_image.c etherent.c gencode.c grammar.y inet.c \
|
||||
nametoaddr.c optimize.c pcap-bpf.c pcap.c savefile.c scanner.l
|
||||
SRCS= scanner.l savefile.c pcap.c pcap-bpf.c optimize.c nametoaddr.c \
|
||||
inet.c grammar.y gencode.c etherent.c bpf_image.c
|
||||
SRCS+= bpf_filter.c
|
||||
|
||||
.PATH: ${.CURDIR}/../../sys/net
|
||||
|
||||
INCS=pcap.h pcap-namedb.h
|
||||
INCS= pcap-namedb.h pcap.h
|
||||
INCSDIR=/usr/include
|
||||
|
||||
CLEANFILES+= y.tab.h
|
||||
|
@ -1,7 +1,7 @@
|
||||
$NetBSD: README,v 1.3 1996/12/13 08:25:56 mikel Exp $
|
||||
@(#) Header: README,v 1.15 96/07/07 22:38:34 leres Exp (LBL)
|
||||
$NetBSD: README,v 1.4 1997/10/03 15:53:01 christos Exp $
|
||||
@(#) Header: README,v 1.18 97/06/12 14:23:56 leres Exp (LBL)
|
||||
|
||||
LIBPCAP 0.2.1
|
||||
LIBPCAP 0.4
|
||||
Lawrence Berkeley National Laboratory
|
||||
Network Research Group
|
||||
libpcap@ee.lbl.gov
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bpf_image.c,v 1.4 1997/01/23 14:02:56 mrg Exp $ */
|
||||
/* $NetBSD: bpf_image.c,v 1.5 1997/10/03 15:53:02 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996
|
||||
@ -21,9 +21,14 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: bpf_image.c,v 1.21 96/07/15 00:48:36 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: bpf_image.c,v 1.22 96/09/26 23:27:56 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: bpf_image.c,v 1.5 1997/10/03 15:53:02 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: etherent.c,v 1.3 1996/12/13 08:26:01 mikel Exp $ */
|
||||
/* $NetBSD: etherent.c,v 1.4 1997/10/03 15:53:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993, 1994, 1995, 1996
|
||||
@ -21,9 +21,14 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: etherent.c,v 1.19 96/07/15 00:48:47 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: etherent.c,v 1.20 96/09/26 23:28:00 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: etherent.c,v 1.4 1997/10/03 15:53:03 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ethertype.h,v 1.3 1996/12/13 08:26:02 mikel Exp $ */
|
||||
/* $NetBSD: ethertype.h,v 1.4 1997/10/03 15:53:04 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1996
|
||||
@ -20,7 +20,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) Header: ethertype.h,v 1.6 96/07/14 18:21:49 leres Exp (LBL)
|
||||
* @(#) Header: ethertype.h,v 1.6 96/07/14 18:21:49 leres Exp (LBL)
|
||||
*/
|
||||
|
||||
/* Types missing from some systems */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: gencode.c,v 1.7 1997/03/15 18:34:01 is Exp $ */
|
||||
/* $NetBSD: gencode.c,v 1.8 1997/10/03 15:53:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -20,9 +20,14 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: gencode.c,v 1.88 96/07/23 01:30:41 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: gencode.c,v 1.93 97/06/12 14:22:47 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: gencode.c,v 1.8 1997/10/03 15:53:05 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -56,6 +61,7 @@ struct rtentry;
|
||||
|
||||
#include "ethertype.h"
|
||||
#include "gencode.h"
|
||||
#include "ppp.h"
|
||||
#include <pcap-namedb.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
@ -421,7 +427,8 @@ gen_bcmp(offset, size, v)
|
||||
b = NULL;
|
||||
while (size >= 4) {
|
||||
register const u_char *p = &v[size - 4];
|
||||
bpf_int32 w = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
|
||||
bpf_int32 w = ((bpf_int32)p[0] << 24) |
|
||||
((bpf_int32)p[1] << 16) | ((bpf_int32)p[2] << 8) | p[3];
|
||||
|
||||
tmp = gen_cmp(offset + size - 4, BPF_W, w);
|
||||
if (b != NULL)
|
||||
@ -431,7 +438,7 @@ gen_bcmp(offset, size, v)
|
||||
}
|
||||
while (size >= 2) {
|
||||
register const u_char *p = &v[size - 2];
|
||||
bpf_int32 w = (p[0] << 8) | p[1];
|
||||
bpf_int32 w = ((bpf_int32)p[0] << 8) | p[1];
|
||||
|
||||
tmp = gen_cmp(offset + size - 2, BPF_H, w);
|
||||
if (b != NULL)
|
||||
@ -479,6 +486,13 @@ init_linktype(type)
|
||||
off_nl = 16;
|
||||
return;
|
||||
|
||||
case DLT_SLIP_BSDOS:
|
||||
/* XXX this may be the same as the DLT_PPP_BSDOS case */
|
||||
off_linktype = -1;
|
||||
/* XXX end */
|
||||
off_nl = 24;
|
||||
return;
|
||||
|
||||
case DLT_NULL:
|
||||
off_linktype = 0;
|
||||
off_nl = 4;
|
||||
@ -489,6 +503,11 @@ init_linktype(type)
|
||||
off_nl = 4;
|
||||
return;
|
||||
|
||||
case DLT_PPP_BSDOS:
|
||||
off_linktype = 5;
|
||||
off_nl = 24;
|
||||
return;
|
||||
|
||||
case DLT_FDDI:
|
||||
/*
|
||||
* FDDI doesn't really have a link-level type field.
|
||||
@ -518,6 +537,11 @@ init_linktype(type)
|
||||
off_linktype = 6;
|
||||
off_nl = 8;
|
||||
return;
|
||||
|
||||
case DLT_RAW:
|
||||
off_linktype = -1;
|
||||
off_nl = 0;
|
||||
return;
|
||||
}
|
||||
bpf_error("unknown data link type 0x%x", linktype);
|
||||
/* NOTREACHED */
|
||||
@ -552,24 +576,53 @@ gen_false()
|
||||
|
||||
static struct block *
|
||||
gen_linktype(proto)
|
||||
int proto;
|
||||
register int proto;
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
/* If we're not using encapsulation and checking for IP, we're done */
|
||||
if (off_linktype == -1 && proto == ETHERTYPE_IP)
|
||||
return gen_true();
|
||||
|
||||
switch (linktype) {
|
||||
|
||||
case DLT_SLIP:
|
||||
if (proto == ETHERTYPE_IP)
|
||||
return gen_true();
|
||||
else
|
||||
return gen_false();
|
||||
return gen_false();
|
||||
|
||||
case DLT_PPP:
|
||||
if (proto == ETHERTYPE_IP)
|
||||
proto = 0x0021; /* XXX - need ppp.h defs */
|
||||
proto = PPP_IP; /* XXX was 0x21 */
|
||||
break;
|
||||
|
||||
case DLT_PPP_BSDOS:
|
||||
switch (proto) {
|
||||
|
||||
case ETHERTYPE_IP:
|
||||
b0 = gen_cmp(off_linktype, BPF_H, PPP_IP);
|
||||
b1 = gen_cmp(off_linktype, BPF_H, PPP_VJC);
|
||||
gen_or(b0, b1);
|
||||
b0 = gen_cmp(off_linktype, BPF_H, PPP_VJNC);
|
||||
gen_or(b1, b0);
|
||||
return b0;
|
||||
|
||||
case ETHERTYPE_DN:
|
||||
proto = PPP_DECNET;
|
||||
break;
|
||||
|
||||
case ETHERTYPE_ATALK:
|
||||
proto = PPP_APPLE;
|
||||
break;
|
||||
|
||||
case ETHERTYPE_NS:
|
||||
proto = PPP_NS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DLT_NULL:
|
||||
/* XXX */
|
||||
if (proto == ETHERTYPE_IP)
|
||||
return (gen_cmp(0, BPF_W, (bpf_int32)AF_INET));
|
||||
return (gen_cmp(0, BPF_W, (bpf_int32)htonl(AF_INET)));
|
||||
else
|
||||
return gen_false();
|
||||
}
|
||||
@ -1201,6 +1254,7 @@ gen_scode(name, q)
|
||||
{
|
||||
int proto = q.proto;
|
||||
int dir = q.dir;
|
||||
int tproto;
|
||||
u_char *eaddr;
|
||||
bpf_u_int32 mask, addr, **alist;
|
||||
struct block *b, *tmp;
|
||||
@ -1255,10 +1309,13 @@ gen_scode(name, q)
|
||||
alist = pcap_nametoaddr(name);
|
||||
if (alist == NULL || *alist == NULL)
|
||||
bpf_error("unknown host '%s'", name);
|
||||
b = gen_host(**alist++, 0xffffffff, proto, dir);
|
||||
tproto = proto;
|
||||
if (off_linktype == -1 && tproto == Q_DEFAULT)
|
||||
tproto = Q_IP;
|
||||
b = gen_host(**alist++, 0xffffffff, tproto, dir);
|
||||
while (*alist) {
|
||||
tmp = gen_host(**alist++, 0xffffffff,
|
||||
proto, dir);
|
||||
tproto, dir);
|
||||
gen_or(b, tmp);
|
||||
b = tmp;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gencode.h,v 1.4 1996/12/13 08:26:04 mikel Exp $ */
|
||||
/* $NetBSD: gencode.h,v 1.5 1997/10/03 15:53:06 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
@ -20,7 +20,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) Header: gencode.h,v 1.36 96/07/17 00:11:34 leres Exp (LBL)
|
||||
* @(#) Header: gencode.h,v 1.36 96/07/17 00:11:34 leres Exp (LBL)
|
||||
*/
|
||||
|
||||
/*XXX*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: gnuc.h,v 1.3 1997/05/25 22:44:42 pk Exp $ */
|
||||
/* $NetBSD: gnuc.h,v 1.4 1997/10/03 15:53:07 christos Exp $ */
|
||||
|
||||
/* @(#) Header: gnuc.h,v 1.3 95/10/09 02:47:01 leres Exp (LBL) */
|
||||
/* @(#) Header: gnuc.h,v 1.3 95/10/09 02:47:01 leres Exp (LBL) */
|
||||
|
||||
/* Define __P() macro, if necessary */
|
||||
#ifndef __P
|
||||
|
@ -1,5 +1,5 @@
|
||||
%{
|
||||
/* $NetBSD: grammar.y,v 1.4 1997/03/15 18:34:03 is Exp $ */
|
||||
/* $NetBSD: grammar.y,v 1.5 1997/10/03 15:53:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
@ -22,9 +22,14 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: grammar.y,v 1.54 96/07/17 00:11:34 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: grammar.y,v 1.56 96/11/02 21:54:55 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: grammar.y,v 1.5 1997/10/03 15:53:07 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -69,7 +74,7 @@ static void
|
||||
yyerror(char *msg)
|
||||
{
|
||||
++n_errors;
|
||||
bpf_error(msg);
|
||||
bpf_error("%s", msg);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: inet.c,v 1.5 1997/01/23 14:02:59 mrg Exp $ */
|
||||
/* $NetBSD: inet.c,v 1.6 1997/10/03 15:53:08 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996
|
||||
* Copyright (c) 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -33,9 +33,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: inet.c,v 1.18 96/07/15 00:48:49 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: inet.c,v 1.21 97/07/17 14:24:58 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: inet.c,v 1.6 1997/10/03 15:53:08 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -102,6 +107,7 @@ pcap_lookupdev(errbuf)
|
||||
ifc.ifc_len = sizeof ibuf;
|
||||
ifc.ifc_buf = (caddr_t)ibuf;
|
||||
|
||||
memset((char *)ibuf, 0, sizeof(ibuf));
|
||||
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
|
||||
ifc.ifc_len < sizeof(struct ifreq)) {
|
||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "SIOCGIFCONF: %s",
|
||||
@ -134,8 +140,12 @@ pcap_lookupdev(errbuf)
|
||||
*/
|
||||
strncpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name));
|
||||
if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifr) < 0) {
|
||||
if (errno == ENXIO)
|
||||
continue;
|
||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
||||
"SIOCGIFFLAGS: %s", pcap_strerror(errno));
|
||||
"SIOCGIFFLAGS: %.*s: %s",
|
||||
(int)sizeof(ifr.ifr_name), ifr.ifr_name,
|
||||
pcap_strerror(errno));
|
||||
(void)close(fd);
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nametoaddr.c,v 1.6 1997/03/15 18:34:04 is Exp $ */
|
||||
/* $NetBSD: nametoaddr.c,v 1.7 1997/10/03 15:53:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
@ -24,14 +24,20 @@
|
||||
* These functions are not time critical.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: nametoaddr.c,v 1.43 96/07/17 00:11:41 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: nametoaddr.c,v 1.47 97/06/13 13:16:19 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: nametoaddr.c,v 1.7 1997/10/03 15:53:09 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h> /* concession to AIX */
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
@ -195,7 +201,6 @@ struct eproto eproto_db[] = {
|
||||
{ "sprite", ETHERTYPE_SPRITE },
|
||||
{ "mopdl", ETHERTYPE_MOPDL },
|
||||
{ "moprc", ETHERTYPE_MOPRC },
|
||||
{ "atalk", ETHERTYPE_ATALK },
|
||||
{ "decnet", ETHERTYPE_DN },
|
||||
{ "lat", ETHERTYPE_LAT },
|
||||
{ "sca", ETHERTYPE_SCA },
|
||||
@ -351,7 +356,7 @@ pcap_ether_hostton(const char *name)
|
||||
if (ether_hostton((char *)name, (struct ether_addr *)a) == 0) {
|
||||
ap = (u_char *)malloc(6);
|
||||
if (ap != NULL)
|
||||
memcpy(ap, a, 6);
|
||||
memcpy((char *)ap, (char *)a, 6);
|
||||
}
|
||||
return (ap);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: optimize.c,v 1.6 1997/09/28 09:41:53 mycroft Exp $ */
|
||||
/* $NetBSD: optimize.c,v 1.7 1997/10/03 15:53:11 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
|
||||
@ -22,9 +22,14 @@
|
||||
*
|
||||
* Optimization module for tcpdump intermediate representation.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: optimize.c,v 1.59 96/07/15 00:48:49 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: optimize.c,v 1.60 96/09/26 23:28:14 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: optimize.c,v 1.7 1997/10/03 15:53:11 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcap-bpf.c,v 1.5 1997/01/23 14:03:00 mrg Exp $ */
|
||||
/* $NetBSD: pcap-bpf.c,v 1.6 1997/10/03 15:53:12 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996
|
||||
@ -20,9 +20,14 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#)Header: pcap-bpf.c,v 1.26 96/07/15 00:48:50 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: pcap-bpf.c,v 1.29 96/12/31 20:53:40 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: pcap-bpf.c,v 1.6 1997/10/03 15:53:12 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/param.h> /* optionally get BSD define */
|
||||
@ -204,6 +209,19 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
|
||||
pcap_strerror(errno));
|
||||
goto bad;
|
||||
}
|
||||
#if _BSDI_VERSION - 0 >= 199510
|
||||
/* The SLIP and PPP link layer header changed in BSD/OS 2.1 */
|
||||
switch (v) {
|
||||
|
||||
case DLT_SLIP:
|
||||
v = DLT_SLIP_BSDOS;
|
||||
break;
|
||||
|
||||
case DLT_PPP:
|
||||
v = DLT_PPP_BSDOS;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
p->linktype = v;
|
||||
|
||||
/* set timeout */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcap-int.h,v 1.3 1996/12/13 08:26:10 mikel Exp $ */
|
||||
/* $NetBSD: pcap-int.h,v 1.4 1997/10/03 15:53:13 christos 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: pcap-int.h,v 1.17 96/07/12 22:45:52 leres Exp (LBL)
|
||||
* @(#) Header: pcap-int.h,v 1.18 96/11/27 18:43:09 leres Exp (LBL)
|
||||
*/
|
||||
|
||||
#ifndef pcap_int_h
|
||||
@ -60,6 +60,11 @@ struct pcap_md {
|
||||
u_long TotDrops; /* count of dropped packets */
|
||||
long TotMissed; /* missed by i/f during this run */
|
||||
long OrigMissed; /* missed by i/f before this run */
|
||||
#ifdef linux
|
||||
int pad;
|
||||
int skip;
|
||||
char *device;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct pcap {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcap-namedb.h,v 1.4 1996/12/13 08:26:10 mikel Exp $ */
|
||||
/* $NetBSD: pcap-namedb.h,v 1.5 1997/10/03 15:53:14 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1996
|
||||
@ -32,7 +32,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) Header: pcap-namedb.h,v 1.5 96/07/14 03:00:14 leres Exp (LBL)
|
||||
* @(#) Header: pcap-namedb.h,v 1.5 96/07/14 03:00:14 leres Exp (LBL)
|
||||
*/
|
||||
|
||||
#ifndef lib_pcap_ethers_h
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" $NetBSD: pcap.3,v 1.4 1996/12/13 08:26:12 mikel Exp $
|
||||
.\" $NetBSD: pcap.3,v 1.5 1997/10/03 15:53:15 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1994, 1996
|
||||
.\" Copyright (c) 1994, 1996, 1997
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@ -19,7 +19,7 @@
|
||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.TH PCAP 3 "18 July 1996"
|
||||
.TH PCAP 3 "26 April 1997"
|
||||
.SH NAME
|
||||
pcap \- Packet Capture library
|
||||
.SH SYNOPSIS
|
||||
@ -39,9 +39,9 @@ pcap_dumper_t *pcap_dump_open(pcap_t *p, char *fname)
|
||||
.ft B
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
char *pcap_lookupdev(char *errbuf)
|
||||
int pcap_lookupnet(char *device, u_int32_t *netp,
|
||||
int pcap_lookupnet(char *device, bpf_u_int32 *netp,
|
||||
.ti +8
|
||||
u_int32_t *maskp, char *errbuf)
|
||||
bpf_u_int32 *maskp, char *errbuf)
|
||||
.ft
|
||||
.LP
|
||||
.ft B
|
||||
@ -59,7 +59,7 @@ u_char *sp)
|
||||
.ft B
|
||||
int pcap_compile(pcap_t *p, struct bpf_program *fp,
|
||||
.ti +8
|
||||
char *str, int optimize, u_int32_t netmask)
|
||||
char *str, int optimize, bpf_u_int32 netmask)
|
||||
int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
|
||||
.ft
|
||||
.LP
|
||||
@ -100,6 +100,10 @@ at packets on the network.
|
||||
is a string that specifies the network device to open.
|
||||
.I snaplen
|
||||
specifies the maximum number of bytes to capture.
|
||||
.I promisc
|
||||
specifies if the interface is to be put into promiscuous mode.
|
||||
(Note that even if this parameter is false, the interface
|
||||
could well be in promiscuous mode for some other reason.)
|
||||
.I to_ms
|
||||
specifies the read timeout in milliseconds.
|
||||
.I ebuf
|
||||
@ -165,7 +169,7 @@ Both
|
||||
and
|
||||
.I maskp
|
||||
are
|
||||
.I u_int32_t
|
||||
.I bpf_u_int32
|
||||
pointers.
|
||||
A return of -1 indicates an error in which case
|
||||
.I errbuf
|
||||
@ -190,7 +194,9 @@ pointer which is passed in from
|
||||
a pointer to the
|
||||
.I pcap_pkthdr
|
||||
struct (which precede the actual network headers and data),
|
||||
and a length. The number of packets read is returned.
|
||||
and a
|
||||
.I u_char
|
||||
pointer to the packet data. The number of packets read is returned.
|
||||
Zero is returned when
|
||||
.B EOF
|
||||
is reached in a ``savefile.'' A return of -1 indicates
|
||||
@ -221,12 +227,16 @@ controls whether optimization on the resulting code is performed.
|
||||
specifies the netmask of the local net.
|
||||
.PP
|
||||
.B pcap_setfilter()
|
||||
is used to specify the a filter program.
|
||||
is used to specify a filter program.
|
||||
.I fp
|
||||
is a pointer to an array of
|
||||
.I bpf_program
|
||||
struct, usually the result of a call to
|
||||
.BR pcap_compile() .
|
||||
.B \-1
|
||||
is returned on failure;
|
||||
.B 0
|
||||
is returned on success.
|
||||
.PP
|
||||
.B pcap_loop()
|
||||
is similar to
|
||||
@ -307,5 +317,16 @@ closes the ``savefile.''
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
tcpdump(1), tcpslice(1)
|
||||
.SH AUTHORS
|
||||
Van Jacobson,
|
||||
Craig Leres and
|
||||
Steven McCanne, all of the
|
||||
Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
|
||||
.LP
|
||||
The current version is available via anonymous ftp:
|
||||
.LP
|
||||
.RS
|
||||
.I ftp://ftp.ee.lbl.gov/libpcap.tar.Z
|
||||
.RE
|
||||
.SH BUGS
|
||||
.SH HISTORY
|
||||
Please send bug reports to libpcap@ee.lbl.gov.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcap.c,v 1.4 1997/01/23 14:03:01 mrg Exp $ */
|
||||
/* $NetBSD: pcap.c,v 1.5 1997/10/03 15:53:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996
|
||||
@ -33,9 +33,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: pcap.c,v 1.25 96/06/05 21:45:26 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: pcap.c,v 1.27 96/11/27 18:43:25 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: pcap.c,v 1.5 1997/10/03 15:53:16 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -192,6 +197,10 @@ pcap_close(pcap_t *p)
|
||||
free(p->sf.base);
|
||||
} else if (p->buffer != NULL)
|
||||
free(p->buffer);
|
||||
#ifdef linux
|
||||
if (p->md.device != NULL)
|
||||
free(p->md.device);
|
||||
#endif
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcap.h,v 1.5 1996/12/13 08:26:13 mikel Exp $ */
|
||||
/* $NetBSD: pcap.h,v 1.6 1997/10/03 15:53:17 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996
|
||||
@ -32,7 +32,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) Header: pcap.h,v 1.20 96/07/12 19:24:15 leres Exp (LBL)
|
||||
* @(#) Header: pcap.h,v 1.20 96/07/12 19:24:15 leres Exp (LBL)
|
||||
*/
|
||||
|
||||
#ifndef lib_pcap_h
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: savefile.c,v 1.4 1997/01/23 14:03:03 mrg Exp $ */
|
||||
/* $NetBSD: savefile.c,v 1.5 1997/10/03 15:53:17 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996
|
||||
@ -19,13 +19,7 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#)Header: savefile.c,v 1.30 96/07/15 00:48:52 leres Exp (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
* savefile.c - supports offline use of tcpdump
|
||||
* Extraction/creation by Jeffrey Mogul, DECWRL
|
||||
* Modified by Steve McCanne, LBL.
|
||||
@ -36,6 +30,16 @@ static char rcsid[] =
|
||||
* dependent values so we can print the dump file on any architecture.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: savefile.c,v 1.36 96/12/10 23:15:02 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: savefile.c,v 1.5 1997/10/03 15:53:17 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -67,7 +71,7 @@ static char rcsid[] =
|
||||
#define SWAPLONG(y) \
|
||||
((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
|
||||
#define SWAPSHORT(y) \
|
||||
( (((y)&0xff)<<8) | (((y)&0xff00)>>8) )
|
||||
( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) )
|
||||
|
||||
#define SFERR_TRUNC 1
|
||||
#define SFERR_BADVERSION 2
|
||||
@ -238,12 +242,17 @@ sf_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char *buf, int buflen)
|
||||
static u_char *tp = NULL;
|
||||
static int tsize = 0;
|
||||
|
||||
if (hdr->caplen > 65535) {
|
||||
sprintf(p->errbuf, "bogus savefile header");
|
||||
return (-1);
|
||||
}
|
||||
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) {
|
||||
tsize = 0;
|
||||
(void)snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||
"BUFMOD hack malloc");
|
||||
return (-1);
|
||||
@ -254,6 +263,14 @@ sf_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char *buf, int buflen)
|
||||
"truncated dump file");
|
||||
return (-1);
|
||||
}
|
||||
/*
|
||||
* We can only keep up to buflen bytes. Since caplen > buflen
|
||||
* is exactly how we got here, we know we can only keep the
|
||||
* first buflen bytes and must drop the remainder. Adjust
|
||||
* caplen accordingly, so we don't get confused later as
|
||||
* to how many bytes we have to play with.
|
||||
*/
|
||||
hdr->caplen = buflen;
|
||||
memcpy((char *)buf, (char *)tp, buflen);
|
||||
|
||||
} else {
|
||||
|
@ -1,8 +1,8 @@
|
||||
%{
|
||||
/* $NetBSD: scanner.l,v 1.3 1996/12/13 08:26:15 mikel Exp $ */
|
||||
/* $NetBSD: scanner.l,v 1.4 1997/10/03 15:53:18 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -22,9 +22,14 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) Header: scanner.l,v 1.53 96/07/17 00:11:34 leres Exp (LBL)";
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: scanner.l,v 1.56 97/07/21 13:31:50 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: scanner.l,v 1.4 1997/10/03 15:53:18 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -48,6 +53,7 @@ static int stoi(char *);
|
||||
static inline int xdtoi(int);
|
||||
|
||||
#ifdef FLEX_SCANNER
|
||||
#define YY_NO_UNPUT
|
||||
#undef YY_INPUT
|
||||
#define YY_INPUT(buf, result, max)\
|
||||
{\
|
||||
@ -134,14 +140,15 @@ outbound return OUTBOUND;
|
||||
">>" return RSH;
|
||||
{N} { yylval.i = stoi((char *)yytext); return NUM; }
|
||||
({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
|
||||
yylval.s = sdup((char *)yytext); return HID;
|
||||
}
|
||||
yylval.s = sdup((char *)yytext); return HID; }
|
||||
{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext);
|
||||
return EID; }
|
||||
{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
|
||||
[A-Za-z][-_.A-Za-z0-9]* { yylval.s = sdup((char *)yytext); return ID; }
|
||||
[A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] {
|
||||
yylval.s = sdup((char *)yytext); return ID; }
|
||||
"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; }
|
||||
[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { bpf_error("illegal token: %s\n", yytext); }
|
||||
[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+i {
|
||||
bpf_error("illegal token: %s\n", yytext); }
|
||||
. { bpf_error("illegal char '%c'", *yytext); }
|
||||
%%
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user