summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/mvme68k/dev/if_ie.c26
-rw-r--r--sys/arch/mvme88k/dev/if_ie.c24
-rw-r--r--sys/arch/sparc/dev/if_ie.c24
-rw-r--r--sys/arch/vax/if/if_de.c20
-rw-r--r--sys/arch/vax/if/if_qe.c10
-rw-r--r--sys/arch/vax/if/sgec.c6
-rw-r--r--sys/dev/isa/if_hp.c22
-rw-r--r--sys/dev/isa/if_ie.c21
8 files changed, 60 insertions, 93 deletions
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c
index 763f798b8b5..e878731c6e1 100644
--- a/sys/arch/mvme68k/dev/if_ie.c
+++ b/sys/arch/mvme68k/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.34 2006/03/25 22:41:41 djm Exp $ */
+/* $OpenBSD: if_ie.c,v 1.35 2006/04/16 00:46:32 pascoe Exp $ */
/*-
* Copyright (c) 1999 Steve Murphree, Jr.
@@ -249,8 +249,6 @@ int command_and_wait(struct ie_softc *, int,
void volatile *, int);
void ierint(struct ie_softc *);
void ietint(struct ie_softc *);
-int ieget(struct ie_softc *, struct mbuf **,
- struct ether_header *, int *);
void setup_bufs(struct ie_softc *);
int mc_setup(struct ie_softc *, void *);
void mc_reset(struct ie_softc *);
@@ -976,7 +974,7 @@ ieget(sc, mp, ehp, to_bpf)
{
struct mbuf *m, *top, **mymp;
int i;
- int offset;
+ int offset = 0;
int totlen, resid;
int thismboff;
int head;
@@ -1004,7 +1002,6 @@ ieget(sc, mp, ehp, to_bpf)
sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */
return -1;
}
- totlen -= (offset = sizeof *ehp);
MGETHDR(*mp, M_DONTWAIT, MT_DATA);
if (!*mp) {
@@ -1191,19 +1188,10 @@ ie_readframe(sc, num)
}
#if NBPFILTER > 0
- /*
- * Check for a BPF filter; if so, hand it up.
- * Note that we have to stick an extra mbuf up front, because bpf_mtap
- * expects to have the ether header at the front.
- * It doesn't matter that this results in an ill-formatted mbuf chain,
- * since BPF just looks at the data. (It doesn't try to free the mbuf,
- * tho' it will make a copy for tcpdump.)
- */
- if (bpf_gets_it) {
- /* Pass it up. */
- bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh,
- sizeof(eh), m, BPF_DIRECTION_IN);
- }
+ /* Check for a BPF filter; if so, hand it up. */
+ if (bpf_gets_it)
+ bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN);
+
/*
* A signal passed up from the filtering code indicating that the
* packet is intended for BPF but not for the protocol machinery.
@@ -1226,7 +1214,7 @@ ie_readframe(sc, num)
/*
* Finally pass this packet up to higher layers.
*/
- ether_input(&sc->sc_arpcom.ac_if, &eh, m);
+ ether_input_mbuf(&sc->sc_arpcom.ac_if, m);
}
void
diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c
index db1f9a63ae0..8d305d75a1b 100644
--- a/sys/arch/mvme88k/dev/if_ie.c
+++ b/sys/arch/mvme88k/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.38 2006/03/25 22:41:41 djm Exp $ */
+/* $OpenBSD: if_ie.c,v 1.39 2006/04/16 00:46:32 pascoe Exp $ */
/*-
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -940,7 +940,7 @@ ieget(sc, mp, ehp, to_bpf)
{
struct mbuf *m, *top, **mymp;
int i;
- int offset;
+ int offset = 0;
int totlen, resid;
int thismboff;
int head;
@@ -968,7 +968,6 @@ ieget(sc, mp, ehp, to_bpf)
sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */
return -1;
}
- totlen -= (offset = sizeof *ehp);
MGETHDR(*mp, M_DONTWAIT, MT_DATA);
if (!*mp) {
@@ -1155,19 +1154,10 @@ ie_readframe(sc, num)
}
#if NBPFILTER > 0
- /*
- * Check for a BPF filter; if so, hand it up.
- * Note that we have to stick an extra mbuf up front, because bpf_mtap
- * expects to have the ether header at the front.
- * It doesn't matter that this results in an ill-formatted mbuf chain,
- * since BPF just looks at the data. (It doesn't try to free the mbuf,
- * tho' it will make a copy for tcpdump.)
- */
- if (bpf_gets_it) {
- /* Pass it up. */
- bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh,
- sizeof(eh), m, BPF_DIRECTION_IN);
- }
+ /* Check for a BPF filter; if so, hand it up. */
+ if (bpf_gets_it)
+ bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN);
+
/*
* A signal passed up from the filtering code indicating that the
* packet is intended for BPF but not for the protocol machinery.
@@ -1190,7 +1180,7 @@ ie_readframe(sc, num)
/*
* Finally pass this packet up to higher layers.
*/
- ether_input(&sc->sc_arpcom.ac_if, &eh, m);
+ ether_input_mbuf(&sc->sc_arpcom.ac_if, m);
}
void
diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c
index 8e254a13a70..b0472a0cde1 100644
--- a/sys/arch/sparc/dev/if_ie.c
+++ b/sys/arch/sparc/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.34 2006/03/25 22:41:41 djm Exp $ */
+/* $OpenBSD: if_ie.c,v 1.35 2006/04/16 00:46:32 pascoe Exp $ */
/* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */
/*-
@@ -1114,7 +1114,7 @@ ieget(sc, mp, ehp, to_bpf)
{
struct mbuf *m, *top, **mymp;
int i;
- int offset;
+ int offset = 0;
int totlen, resid;
int thismboff;
int head;
@@ -1142,7 +1142,6 @@ ieget(sc, mp, ehp, to_bpf)
sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */
return -1;
}
- totlen -= (offset = sizeof *ehp);
MGETHDR(*mp, M_DONTWAIT, MT_DATA);
if (!*mp) {
@@ -1329,19 +1328,10 @@ ie_readframe(sc, num)
}
#if NBPFILTER > 0
- /*
- * Check for a BPF filter; if so, hand it up.
- * Note that we have to stick an extra mbuf up front, because bpf_mtap
- * expects to have the ether header at the front.
- * It doesn't matter that this results in an ill-formatted mbuf chain,
- * since BPF just looks at the data. (It doesn't try to free the mbuf,
- * tho' it will make a copy for tcpdump.)
- */
- if (bpf_gets_it) {
- /* Pass it up. */
- bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh,
- sizeof(eh), m, BPF_DIRECTION_IN);
- }
+ /* Check for a BPF filter; if so, hand it up. */
+ if (bpf_gets_it)
+ bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN);
+
/*
* A signal passed up from the filtering code indicating that the
* packet is intended for BPF but not for the protocol machinery.
@@ -1364,7 +1354,7 @@ ie_readframe(sc, num)
/*
* Finally pass this packet up to higher layers.
*/
- ether_input(&sc->sc_arpcom.ac_if, &eh, m);
+ ether_input_mbuf(&sc->sc_arpcom.ac_if, m);
}
static void
diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c
index bfbd73839ca..9071bb95413 100644
--- a/sys/arch/vax/if/if_de.c
+++ b/sys/arch/vax/if/if_de.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_de.c,v 1.18 2005/12/10 11:45:43 miod Exp $ */
+/* $OpenBSD: if_de.c,v 1.19 2006/04/16 00:46:32 pascoe Exp $ */
/* $NetBSD: if_de.c,v 1.27 1997/04/19 15:02:29 ragge Exp $ */
/*
@@ -542,11 +542,6 @@ deread(ds, ifrw, len)
struct ether_header *eh;
struct mbuf *m;
- /*
- * Deal with trailer protocol: if type is trailer type
- * get true type from first 16-bit word past data.
- * Remember that type was trailer by setting off.
- */
eh = (struct ether_header *)ifrw->ifrw_addr;
if (len == 0)
return;
@@ -557,8 +552,17 @@ deread(ds, ifrw, len)
* information to be at the front.
*/
m = if_ubaget(&ds->ds_deuba, ifrw, len, &ds->ds_if);
- if (m)
- ether_input(&ds->ds_if, eh, m);
+ if (m) {
+ /*
+ * XXX not exactly sure what if_ubaget does. Manually
+ * add the ethernet header to the start of the mbuf chain.
+ */
+ M_PREPEND(m, sizeof(*eh), M_DONTWAIT);
+ if (m) {
+ *mtod(m, struct ether_header *) = *eh;
+ ether_input_mbuf(&ds->ds_if, m);
+ }
+ }
}
/*
* Process an ioctl request.
diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c
index 37214187496..dc9027a8c15 100644
--- a/sys/arch/vax/if/if_qe.c
+++ b/sys/arch/vax/if/if_qe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_qe.c,v 1.19 2006/03/25 22:41:42 djm Exp $ */
+/* $OpenBSD: if_qe.c,v 1.20 2006/04/16 00:46:32 pascoe Exp $ */
/* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -581,11 +581,9 @@ qeintr(void *arg)
continue;
}
- if ((status1 & QE_ESETUP) == 0) {
- /* m_adj() the ethernet header out of the way and pass up */
- m_adj(m, sizeof(struct ether_header));
- ether_input(ifp, eh, m);
- } else
+ if ((status1 & QE_ESETUP) == 0)
+ ether_input_mbuf(ifp, m);
+ else
m_freem(m);
}
diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c
index e47923cc0fd..3cea80f7648 100644
--- a/sys/arch/vax/if/sgec.c
+++ b/sys/arch/vax/if/sgec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgec.c,v 1.10 2006/03/25 22:41:42 djm Exp $ */
+/* $OpenBSD: sgec.c,v 1.11 2006/04/16 00:46:32 pascoe Exp $ */
/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -449,9 +449,7 @@ sgec_intr(sc)
continue;
}
- /* m_adj() the ethernet header out of the way and pass up */
- m_adj(m, sizeof(struct ether_header));
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
}
if (csr & ZE_NICSR5_TI) {
diff --git a/sys/dev/isa/if_hp.c b/sys/dev/isa/if_hp.c
index 30487d2e7d6..8b01470c392 100644
--- a/sys/dev/isa/if_hp.c
+++ b/sys/dev/isa/if_hp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_hp.c,v 1.16 2006/03/25 22:41:44 djm Exp $ */
+/* $OpenBSD: if_hp.c,v 1.17 2006/04/16 00:46:32 pascoe Exp $ */
/* $NetBSD: if_hp.c,v 1.21 1995/12/24 02:31:31 mycroft Exp $ */
/* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */
@@ -800,16 +800,24 @@ hpread(ns, buf, len)
BPF_DIRECTION_IN);
#endif
/*
- * Pull packet off interface. Off is nonzero if packet
- * has trailing header; hpget will then force this header
- * information to be at the front, but we still have to drop
- * the type and length which are at the front of any trailer data.
- */
+ * Pull packet off interface. Off is nonzero if packet
+ * has trailing header; hpget will then force this header
+ * information to be at the front, but we still have to drop
+ * the type and length which are at the front of any trailer data.
+ */
m = hpget(buf, len, off, &ns->ns_if);
if (m == 0)
return;
- ether_input(&ns->ns_if, eh, m);
+ /*
+ * XXX I don't understand the implications of ETHERTYPE_TRAIL.
+ * Just prepend the "fixed" ethernet header to the mbuf chain.
+ */
+ M_PREPEND(m, sizeof(*eh), M_DONTWAIT);
+ if (m == 0)
+ return;
+ *mtod(m, struct ether_header *) = *eh;
+ ether_input_mbuf(&ns->ns_if, m);
}
/*
* Supporting routines
diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c
index 834ccca6789..11b5283716c 100644
--- a/sys/dev/isa/if_ie.c
+++ b/sys/dev/isa/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.32 2006/03/25 22:41:44 djm Exp $ */
+/* $OpenBSD: if_ie.c,v 1.33 2006/04/16 00:46:32 pascoe Exp $ */
/* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */
/*-
@@ -1239,7 +1239,7 @@ ieget(sc, ehp, to_bpf)
int thisrboff, thismboff;
int head;
- totlen = ie_packet_len(sc);
+ resid = totlen = ie_packet_len(sc);
if (totlen <= 0)
return 0;
@@ -1262,8 +1262,6 @@ ieget(sc, ehp, to_bpf)
return 0;
}
- resid = totlen -= (thisrboff = sizeof *ehp);
-
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
return 0;
@@ -1298,6 +1296,7 @@ ieget(sc, ehp, to_bpf)
}
m = top;
+ thisrboff = 0;
thismboff = 0;
/*
@@ -1385,18 +1384,10 @@ ie_readframe(sc, num)
#endif
#if NBPFILTER > 0
- /*
- * Check for a BPF filter; if so, hand it up.
- * Note that we have to stick an extra mbuf up front, because bpf_mtap
- * expects to have the ether header at the front.
- * It doesn't matter that this results in an ill-formatted mbuf chain,
- * since BPF just looks at the data. (It doesn't try to free the mbuf,
- * tho' it will make a copy for tcpdump.)
- */
+ /* Check for a BPF filter; if so, hand it up. */
if (bpf_gets_it) {
/* Pass it up. */
- bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh,
- sizeof(eh), m, BPF_DIRECTION_IN);
+ bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN);
/*
* A signal passed up from the filtering code indicating that
@@ -1422,7 +1413,7 @@ ie_readframe(sc, num)
/*
* Finally pass this packet up to higher layers.
*/
- ether_input(&sc->sc_arpcom.ac_if, &eh, m);
+ ether_input_mbuf(&sc->sc_arpcom.ac_if, m);
sc->sc_arpcom.ac_if.if_ipackets++;
}