Changes so that BPF readers will get the data in fddi packet aligned along
normal boundaries. This makes tcpdump much happier.
This commit is contained in:
parent
ca5d93c91e
commit
08e1d890a4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pdq.c,v 1.20 1998/08/24 02:34:44 tv Exp $ */
|
||||
/* $NetBSD: pdq.c,v 1.21 1998/09/20 02:36:09 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995,1996 Matt Thomas <matt@3am-software.com>
|
||||
@ -751,7 +751,7 @@ pdq_process_received_data(
|
||||
* the real length.
|
||||
*/
|
||||
pdulen = datalen - 4 /* CRC */;
|
||||
segcnt = (pdulen + PDQ_RX_FC_OFFSET + PDQ_OS_DATABUF_SIZE - 1) / PDQ_OS_DATABUF_SIZE;
|
||||
segcnt = (pdulen + PDQ_OS_HDR_OFFSET + PDQ_OS_DATABUF_SIZE - 1) / PDQ_OS_DATABUF_SIZE;
|
||||
PDQ_OS_DATABUF_ALLOC(pdq, npdu);
|
||||
if (npdu == NULL) {
|
||||
PDQ_PRINTF(("discard: no databuf #0\n"));
|
||||
@ -775,11 +775,11 @@ pdq_process_received_data(
|
||||
buffers[(completion + idx) & ring_mask];
|
||||
buffers[(completion + idx) & ring_mask] = NULL;
|
||||
}
|
||||
PDQ_OS_DATABUF_ADJ(fpdu, PDQ_RX_FC_OFFSET);
|
||||
PDQ_OS_DATABUF_ADJ(fpdu, PDQ_OS_HDR_OFFSET);
|
||||
if (segcnt == 1) {
|
||||
PDQ_OS_DATABUF_LEN_SET(fpdu, pdulen);
|
||||
} else {
|
||||
PDQ_OS_DATABUF_LEN_SET(lpdu, pdulen + PDQ_RX_FC_OFFSET - (segcnt - 1) * PDQ_OS_DATABUF_SIZE);
|
||||
PDQ_OS_DATABUF_LEN_SET(lpdu, pdulen + PDQ_OS_HDR_OFFSET - (segcnt - 1) * PDQ_OS_DATABUF_SIZE);
|
||||
}
|
||||
/*
|
||||
* Do not pass to protocol if packet was received promiscuously
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pdq_ifsubr.c,v 1.21 1998/09/19 21:21:25 matt Exp $ */
|
||||
/* $NetBSD: pdq_ifsubr.c,v 1.22 1998/09/20 02:36:08 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
|
||||
@ -208,6 +208,11 @@ pdq_ifstart(
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (PDQ_RX_FC_OFFSET != PDQ_OS_HDR_OFFSET) {
|
||||
m->m_data += PDQ_RX_FC_OFFSET - PDQ_OS_HDR_OFFSET;
|
||||
m->m_len -= PDQ_RX_FC_OFFSET - PDQ_OS_HDR_OFFSET;
|
||||
m->m_pkthdr.len -= PDQ_RX_FC_OFFSET - PDQ_OS_HDR_OFFSET;
|
||||
}
|
||||
|
||||
if (pdq_queue_transmit_data(sc->sc_pdq, m) == PDQ_FALSE)
|
||||
break;
|
||||
@ -251,11 +256,8 @@ pdq_os_receive_pdu(
|
||||
#endif
|
||||
m->m_pkthdr.len = pktlen;
|
||||
#if NBPFILTER > 0
|
||||
if (sc->sc_bpf != NULL) {
|
||||
m->m_data -= 3; m->m_len += 3; m->m_pkthdr.len += 3;
|
||||
if (sc->sc_bpf != NULL)
|
||||
PDQ_BPF_MTAP(sc, m);
|
||||
m->m_data += 3; m->m_len -= 3; m->m_pkthdr.len -= 3;
|
||||
}
|
||||
#endif
|
||||
if (drop || (fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC) {
|
||||
PDQ_OS_DATABUF_FREE(pdq, m);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pdqvar.h,v 1.23 1998/08/16 03:44:42 matt Exp $ */
|
||||
/* $NetBSD: pdqvar.h,v 1.24 1998/09/20 02:36:09 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
|
||||
@ -150,6 +150,7 @@ typedef pdq_bus_memaddr_t pdq_bus_memoffset_t;
|
||||
#endif
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
#define PDQ_OS_HDR_OFFSET (PDQ_RX_FC_OFFSET-3)
|
||||
#define PDQ_OS_PTR_FMT "%p"
|
||||
#define PDQ_OS_CSR_FMT "0x%lx"
|
||||
typedef void ifnet_ret_t;
|
||||
@ -483,6 +484,10 @@ typedef mblk_t PDQ_OS_DATABUF_T;
|
||||
#define PDQ_OS_DATABUF_BUSPA(pdq, b) PDQ_OS_VA_TO_BUSPA(pdq, PDQ_OS_DATABUF_PTR(b))
|
||||
#endif
|
||||
|
||||
#ifndef PDQ_OS_HDR_OFFSET
|
||||
#define PDQ_OS_HDR_OFFSET PDQ_RX_FC_OFFSET
|
||||
#endif
|
||||
|
||||
extern void pdq_os_addr_fill(pdq_t *pdq, pdq_lanaddr_t *addrs, size_t numaddrs);
|
||||
extern void pdq_os_receive_pdu(pdq_t *, PDQ_OS_DATABUF_T *pdu, size_t pdulen, int drop);
|
||||
extern void pdq_os_restart_transmitter(pdq_t *pdq);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_fddi.h,v 1.5 1998/02/09 17:43:50 perry Exp $ */
|
||||
/* $NetBSD: if_fddi.h,v 1.6 1998/09/20 02:36:09 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
|
||||
@ -33,6 +33,7 @@
|
||||
* Structure of an 100Mb/s FDDI header.
|
||||
*/
|
||||
struct fddi_header {
|
||||
u_char fddi_ph[3]; /* makes the FDDI header 16 bytes */
|
||||
u_char fddi_fc;
|
||||
u_char fddi_dhost[6];
|
||||
u_char fddi_shost[6];
|
||||
@ -47,6 +48,14 @@ struct fddi_header {
|
||||
#define FDDIFC_F 0x30 /* 0b00110000 */
|
||||
#define FDDIFC_Z 0x0F /* 0b00001111 */
|
||||
|
||||
/*
|
||||
* FDDI Frame Control values. (48-bit addressing only).
|
||||
*/
|
||||
#define FDDIFC_VOID 0x40 /* Void frame */
|
||||
#define FDDIFC_NRT 0x80 /* Nonrestricted token */
|
||||
#define FDDIFC_RT 0xc0 /* Restricted token */
|
||||
#define FDDIFC_MAC_BEACON 0xc2 /* MAC Beacon frame */
|
||||
#define FDDIFC_MAC_CLAIM 0xc3 /* MAC Claim frame */
|
||||
#define FDDIFC_LLC_ASYNC 0x50
|
||||
#define FDDIFC_LLC_PRIO0 0
|
||||
#define FDDIFC_LLC_PRIO1 1
|
||||
@ -57,7 +66,15 @@ struct fddi_header {
|
||||
#define FDDIFC_LLC_PRIO6 6
|
||||
#define FDDIFC_LLC_PRIO7 7
|
||||
#define FDDIFC_LLC_SYNC 0xd0
|
||||
#define FDDIFC_IMP_ASYNC 0x60 /* Implementor Async. */
|
||||
#define FDDIFC_IMP_SYNC 0xe0 /* Implementor Synch. */
|
||||
#define FDDIFC_SMT 0x40
|
||||
#define FDDIFC_SMT_INFO 0x41 /* SMT Info */
|
||||
#define FDDIFC_SMT_NSA 0x4F /* SMT Next station adrs */
|
||||
#define FDDIFC_MAC 0xc0 /* MAC frame */
|
||||
|
||||
#define FDDIFC_CLFF 0xF0 /* Class/Length/Format bits */
|
||||
#define FDDIFC_ZZZZ 0x0F /* Control bits */
|
||||
|
||||
#if defined(KERNEL) || defined(_KERNEL)
|
||||
#if defined(__NetBSD__)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-fddi.c,v 1.5 1998/05/24 21:41:30 matt Exp $ */
|
||||
/* $NetBSD: print-fddi.c,v 1.6 1998/09/20 02:36:09 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
@ -27,7 +27,7 @@
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: print-fddi.c,v 1.36 97/05/26 17:13:35 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-fddi.c,v 1.5 1998/05/24 21:41:30 matt Exp $");
|
||||
__RCSID("$NetBSD: print-fddi.c,v 1.6 1998/09/20 02:36:09 matt Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -47,6 +47,7 @@ struct rtentry;
|
||||
#include <netinet/in.h>
|
||||
#ifdef __NetBSD__
|
||||
#include <net/if_ether.h>
|
||||
#include <net/if_fddi.h>
|
||||
#else
|
||||
#include <netinet/if_ether.h>
|
||||
#endif
|
||||
@ -64,8 +65,6 @@ struct rtentry;
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "fddi.h"
|
||||
|
||||
/*
|
||||
* Some FDDI interfaces use bit-swapped addresses.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user