which supplies different headers from BSD ARCNET, and fixes to the
ARCNET code generator (the protocol ID field is 1 byte, so the values
for it shouldn't be byte-swapped).
Whitespace cleanups.
The "NetBSD-style" ARCNET headers are used in other BSDs as well, so
just call them "BSD-style".
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*
- * @(#) $Header: /tcpdump/master/libpcap/bpf/net/Attic/bpf.h,v 1.66 2003-01-21 04:39:05 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/bpf/net/Attic/bpf.h,v 1.67 2003-01-23 07:24:53 guy Exp $ (LBL)
*/
#ifndef BPF_MAJOR_VERSION
*/
#ifndef BPF_MAJOR_VERSION
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* IEEE 802 Networks */
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* IEEE 802 Networks */
-#define DLT_ARCNET 7 /* ARCNET, with NetBSD-style header */
+#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
/*
#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
/*
- * NetBSD's ARCNET headers have the source host, destination host,
+ * BSD's ARCNET headers have the source host, destination host,
* and type at the beginning of the packet; that's what's handed
* up to userland via BPF.
*
* and type at the beginning of the packet; that's what's handed
* up to userland via BPF.
*
*/
#ifndef lint
static const char rcsid[] =
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.183 2002-12-12 07:04:17 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.184 2003-01-23 07:24:51 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
case DLT_ARCNET:
off_linktype = 2;
case DLT_ARCNET:
off_linktype = 2;
- off_nl = 6; /* XXX in reality, variable! */
+ off_nl = 6; /* XXX in reality, variable! */
off_nl_nosnap = 6; /* no 802.2 LLC */
return;
off_nl_nosnap = 6; /* no 802.2 LLC */
return;
+ case DLT_ARCNET_LINUX:
+ off_linktype = 4;
+ off_nl = 8; /* XXX in reality, variable! */
+ off_nl_nosnap = 8; /* no 802.2 LLC */
+ return;
+
case DLT_EN10MB:
off_linktype = 12;
off_nl = 14; /* Ethernet II */
case DLT_EN10MB:
off_linktype = 12;
off_nl = 14; /* Ethernet II */
return gen_ether_linktype(proto);
break;
return gen_ether_linktype(proto);
break;
- case DLT_C_HDLC:
- switch (proto) {
- case LLCSAP_ISONS:
- proto = (proto << 8 | LLCSAP_ISONS);
- /* fall through */
- default:
- return gen_cmp(off_linktype, BPF_H, (bpf_int32)proto);
- break;
- }
+ case DLT_C_HDLC:
+ switch (proto) {
+
+ case LLCSAP_ISONS:
+ proto = (proto << 8 | LLCSAP_ISONS);
+ /* fall through */
+
+ default:
+ return gen_cmp(off_linktype, BPF_H, (bpf_int32)proto);
+ break;
+ }
+ break;
+
case DLT_IEEE802_11:
case DLT_PRISM_HEADER:
case DLT_IEEE802_11_RADIO:
case DLT_IEEE802_11:
case DLT_PRISM_HEADER:
case DLT_IEEE802_11_RADIO:
return (gen_cmp(0, BPF_W, (bpf_int32)proto));
case DLT_ARCNET:
return (gen_cmp(0, BPF_W, (bpf_int32)proto));
case DLT_ARCNET:
/*
* XXX should we check for first fragment if the protocol
* uses PHDS?
*/
/*
* XXX should we check for first fragment if the protocol
* uses PHDS?
*/
default:
return gen_false();
default:
return gen_false();
#ifdef INET6
case ETHERTYPE_IPV6:
#ifdef INET6
case ETHERTYPE_IPV6:
- return(gen_cmp(2, BPF_B,
- (bpf_int32)htonl(ARCTYPE_INET6)));
+ return (gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_INET6));
- b0 = gen_cmp(2, BPF_B, (bpf_int32)htonl(ARCTYPE_IP));
- b1 = gen_cmp(2, BPF_B,
- (bpf_int32)htonl(ARCTYPE_IP_OLD));
+ b0 = gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_IP);
+ b1 = gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_IP_OLD);
- b0 = gen_cmp(2, BPF_B, (bpf_int32)htonl(ARCTYPE_ARP));
- b1 = gen_cmp(2, BPF_B,
- (bpf_int32)htonl(ARCTYPE_ARP_OLD));
+ b0 = gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_ARP);
+ b1 = gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_ARP_OLD);
- return(gen_cmp(2, BPF_B,
- (bpf_int32)htonl(ARCTYPE_REVARP)));
+ return (gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_REVARP));
+
- return(gen_cmp(2, BPF_B,
- (bpf_int32)htonl(ARCTYPE_ATALK)));
+ return (gen_cmp(off_linktype, BPF_B,
+ (bpf_int32)ARCTYPE_ATALK));
case Q_DEFAULT:
case Q_LINK:
case Q_DEFAULT:
case Q_LINK:
- if (linktype == DLT_ARCNET)
+ if (linktype == DLT_ARCNET || linktype == DLT_ARCNET_LINUX)
return gen_ahostop(abroadcast, Q_DST);
if (linktype == DLT_EN10MB)
return gen_ehostop(ebroadcast, Q_DST);
return gen_ahostop(abroadcast, Q_DST);
if (linktype == DLT_EN10MB)
return gen_ehostop(ebroadcast, Q_DST);
case Q_DEFAULT:
case Q_LINK:
case Q_DEFAULT:
case Q_LINK:
- if (linktype == DLT_ARCNET)
+ if (linktype == DLT_ARCNET || linktype == DLT_ARCNET_LINUX)
/* all ARCnet multicasts use the same address */
return gen_ahostop(abroadcast, Q_DST);
/* all ARCnet multicasts use the same address */
return gen_ahostop(abroadcast, Q_DST);
struct qual q;
{
if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) {
struct qual q;
{
if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) {
- if (linktype == DLT_ARCNET)
+ if (linktype == DLT_ARCNET || linktype == DLT_ARCNET_LINUX)
return gen_ahostop(eaddr, (int)q.dir);
}
bpf_error("ARCnet address used in non-arc expression");
return gen_ahostop(eaddr, (int)q.dir);
}
bpf_error("ARCnet address used in non-arc expression");
*/
#ifndef lint
static const char rcsid[] =
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.87 2002-12-22 02:36:49 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.88 2003-01-23 07:24:52 guy Exp $ (LBL)";
break;
case ARPHRD_ARCNET:
break;
case ARPHRD_ARCNET:
- handle->linktype = DLT_ARCNET;
+ handle->linktype = DLT_ARCNET_LINUX;
break;
#ifndef ARPHRD_FDDI /* From Linux 2.2.13 */
break;
#ifndef ARPHRD_FDDI /* From Linux 2.2.13 */
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.44 2003-01-16 07:44:27 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.45 2003-01-23 07:24:52 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
static struct dlt_choice dlt_choices[] = {
DLT_CHOICE(DLT_ARCNET),
static struct dlt_choice dlt_choices[] = {
DLT_CHOICE(DLT_ARCNET),
+ DLT_CHOICE(DLT_ARCNET_LINUX),
DLT_CHOICE(DLT_EN10MB),
DLT_CHOICE(DLT_SLIP),
DLT_CHOICE(DLT_SLIP_BSDOS),
DLT_CHOICE(DLT_EN10MB),
DLT_CHOICE(DLT_SLIP),
DLT_CHOICE(DLT_SLIP_BSDOS),
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.74 2003-01-21 04:39:05 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.75 2003-01-23 07:24:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
#define LINKTYPE_PRONET DLT_PRONET
#define LINKTYPE_CHAOS DLT_CHAOS
#define LINKTYPE_TOKEN_RING DLT_IEEE802 /* DLT_IEEE802 is used for Token Ring */
#define LINKTYPE_PRONET DLT_PRONET
#define LINKTYPE_CHAOS DLT_CHAOS
#define LINKTYPE_TOKEN_RING DLT_IEEE802 /* DLT_IEEE802 is used for Token Ring */
-#define LINKTYPE_ARCNET DLT_ARCNET /* NetBSD-style headers */
+#define LINKTYPE_ARCNET DLT_ARCNET /* BSD-style headers */
#define LINKTYPE_SLIP DLT_SLIP
#define LINKTYPE_PPP DLT_PPP
#define LINKTYPE_FDDI DLT_FDDI
#define LINKTYPE_SLIP DLT_SLIP
#define LINKTYPE_PPP DLT_PPP
#define LINKTYPE_FDDI DLT_FDDI