Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to ether_input() (with a few exceptions, which are documented in the code).
This commit is contained in:
parent
8dc841aa19
commit
7ca3fb9ef0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ed.c,v 1.33 2000/02/11 19:09:56 is Exp $ */
|
||||
/* $NetBSD: if_ed.c,v 1.34 2000/10/01 23:32:39 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
|
||||
|
@ -967,7 +967,6 @@ ed_get_packet(sc, buf, len)
|
|||
caddr_t buf;
|
||||
u_short len;
|
||||
{
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp;
|
||||
|
||||
|
@ -993,7 +992,6 @@ ed_get_packet(sc, buf, len)
|
|||
* header mbuf.
|
||||
*/
|
||||
m->m_data += EOFF;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
word_copy(buf, mtod(m, caddr_t), sizeof(struct ether_header));
|
||||
buf += sizeof(struct ether_header);
|
||||
|
@ -1011,22 +1009,8 @@ ed_get_packet(sc, buf, len)
|
|||
* Check if there's a BPF listener on this interface. If so, hand off
|
||||
* the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_es.c,v 1.24 1999/12/10 05:44:58 mhitch Exp $ */
|
||||
/* $NetBSD: if_es.c,v 1.25 2000/10/01 23:32:39 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Michael L. Hitch
|
||||
|
@ -537,7 +537,6 @@ esrint(sc)
|
|||
#endif
|
||||
struct ifnet *ifp;
|
||||
struct mbuf *top, **mp, *m;
|
||||
struct ether_header *eh;
|
||||
#ifdef USEPKTBUF
|
||||
u_char *b, pktbuf[1530];
|
||||
#endif
|
||||
|
@ -708,28 +707,13 @@ esrint(sc)
|
|||
while (smc->b2.mmucr & MMUCR_BUSY)
|
||||
;
|
||||
#endif
|
||||
eh = mtod(top, struct ether_header *);
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface. If so, hand off
|
||||
* the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, top);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((sc->sc_ethercom.ec_if.if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(top);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, top);
|
||||
#ifdef ESDEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_qn.c,v 1.18 1999/05/18 23:52:52 thorpej Exp $ */
|
||||
/* $NetBSD: if_qn.c,v 1.19 2000/10/01 23:32:39 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mika Kortelainen
|
||||
|
@ -562,7 +562,6 @@ qn_get_packet(sc, len)
|
|||
{
|
||||
register u_short volatile *nic_fifo_ptr = sc->nic_fifo;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m, *dst, *head = NULL;
|
||||
register u_short len1;
|
||||
u_short amount;
|
||||
|
@ -583,8 +582,6 @@ qn_get_packet(sc, len)
|
|||
m->m_len = 0;
|
||||
head = m;
|
||||
|
||||
eh = mtod(head, struct ether_header *);
|
||||
|
||||
word_copy_from_card(nic_fifo_ptr,
|
||||
mtod(head, u_short *),
|
||||
sizeof(struct ether_header));
|
||||
|
@ -623,23 +620,8 @@ qn_get_packet(sc, len)
|
|||
}
|
||||
|
||||
#if NBPFILTER > 0
|
||||
if (sc->sc_bpf) {
|
||||
if (sc->sc_bpf)
|
||||
bpf_mtap(sc->sc_bpf, head);
|
||||
|
||||
/*
|
||||
* The interface cannot be in promiscuous mode if there are
|
||||
* no BPF listeners. And in prom. mode we have to check
|
||||
* if the packet is really ours...
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* not bcast or mcast */
|
||||
bcmp(eh->ether_dhost,
|
||||
LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) != 0) {
|
||||
m_freem(head);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, head);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn.c,v 1.20 2000/06/29 08:34:11 mrg Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.21 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
/* $OpenBSD: if_sn.c,v 1.12 1999/05/13 15:44:48 jason Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1215,19 +1215,8 @@ sonic_read(sc, rxp)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_tap(sc->sc_if.if_bpf, pkt, len);
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(et->ether_dhost, (void *)LLADDR(ifp->if_sadl),
|
||||
sizeof(et->ether_dhost)) != 0)
|
||||
return(1); /* XXX - count this ? */
|
||||
}
|
||||
#endif
|
||||
m = sonic_get(sc, pkt, len);
|
||||
if (m == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ea.c,v 1.22 1999/05/18 23:52:52 thorpej Exp $ */
|
||||
/* $NetBSD: if_ea.c,v 1.23 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mark Brinicombe
|
||||
|
@ -1315,12 +1315,10 @@ earead(sc, buf, len)
|
|||
caddr_t buf;
|
||||
int len;
|
||||
{
|
||||
register struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp;
|
||||
|
||||
ifp = &sc->sc_ethercom.ec_if;
|
||||
eh = (struct ether_header *)buf;
|
||||
|
||||
/* Pull packet off interface. */
|
||||
m = eaget(buf, len, ifp);
|
||||
|
@ -1332,22 +1330,8 @@ earead(sc, buf, len)
|
|||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_eb.c,v 1.24 1999/11/30 17:02:39 tron Exp $ */
|
||||
/* $NetBSD: if_eb.c,v 1.25 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mark Brinicombe
|
||||
|
@ -1329,12 +1329,10 @@ ebread(sc, buf, len)
|
|||
caddr_t buf;
|
||||
int len;
|
||||
{
|
||||
register struct ether_header *eh;
|
||||
struct ifnet *ifp;
|
||||
struct mbuf *m;
|
||||
|
||||
ifp = &sc->sc_ethercom.ec_if;
|
||||
eh = (struct ether_header *)buf;
|
||||
|
||||
/* Pull packet off interface. */
|
||||
m = ebget(buf, len, ifp);
|
||||
|
@ -1348,22 +1346,8 @@ ebread(sc, buf, len)
|
|||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_es.c,v 1.16 1999/05/18 23:52:52 thorpej Exp $ */
|
||||
/* $NetBSD: if_es.c,v 1.17 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, Danny C Tsen.
|
||||
|
@ -560,7 +560,6 @@ esrint(sc)
|
|||
u_short pktctlw, pktlen, *buf;
|
||||
struct ifnet *ifp;
|
||||
struct mbuf *top, **mp, *m;
|
||||
struct ether_header *eh;
|
||||
u_char *b, *pktbuf;
|
||||
|
||||
#ifdef ESDEBUG
|
||||
|
@ -652,8 +651,6 @@ esrint(sc)
|
|||
top = NULL;
|
||||
mp = ⊤
|
||||
|
||||
eh = (struct ether_header *) pktbuf;
|
||||
|
||||
b = pktbuf;
|
||||
|
||||
while (pktlen > 0) {
|
||||
|
@ -683,22 +680,8 @@ esrint(sc)
|
|||
* Check if there's a BPF listener on this interface. If so, hand off
|
||||
* the raw packet to bpf.
|
||||
*/
|
||||
if (sc->sc_ethercom.ec_if.if_bpf) {
|
||||
if (sc->sc_ethercom.ec_if.if_bpf)
|
||||
bpf_mtap(sc->sc_ethercom.ec_if.if_bpf, top);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((sc->sc_ethercom.ec_if.if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(top);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, top);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_mc.c,v 1.16 2000/06/29 08:15:11 mrg Exp $ */
|
||||
/* $NetBSD: if_mc.c,v 1.17 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 David Huang <khym@bga.com>
|
||||
|
@ -627,9 +627,6 @@ mace_read(sc, pkt, len)
|
|||
int len;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
#if NBPFILTER > 0
|
||||
struct ether_header *eh = (struct ether_header *)pkt;
|
||||
#endif
|
||||
struct mbuf *m;
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
|
@ -648,13 +645,8 @@ mace_read(sc, pkt, len)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_tap(ifp->if_bpf, pkt, len);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
ETHER_CMP(eh->ether_dhost, sc->sc_enaddr))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
m = mace_get(sc, pkt, len);
|
||||
if (m == NULL) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn.c,v 1.26 2000/06/29 08:15:11 mrg Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.27 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor DP8393X SONIC Driver
|
||||
|
@ -1098,14 +1098,8 @@ sonic_read(sc, pkt, len)
|
|||
int len;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
|
||||
/*
|
||||
* Get pointer to ethernet header (in input buffer).
|
||||
*/
|
||||
eh = (struct ether_header *)pkt;
|
||||
|
||||
#ifdef SNDEBUG
|
||||
{
|
||||
printf("%s: rcvd 0x%p len=%d type=0x%x from %s",
|
||||
|
@ -1128,14 +1122,8 @@ sonic_read(sc, pkt, len)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_tap(ifp->if_bpf, pkt, len);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
m = sonic_get(sc, pkt, len);
|
||||
if (m == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: am79c950.c,v 1.8 2000/06/29 08:10:45 mrg Exp $ */
|
||||
/* $NetBSD: am79c950.c,v 1.9 2000/10/01 23:32:40 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 David Huang <khym@bga.com>
|
||||
|
@ -644,7 +644,6 @@ mace_read(sc, pkt, len)
|
|||
int len;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
struct ether_header *eh = (struct ether_header *)pkt;
|
||||
struct mbuf *m;
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
|
@ -663,13 +662,8 @@ mace_read(sc, pkt, len)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_tap(ifp->if_bpf, pkt, len);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
ETHER_CMP(eh->ether_dhost, sc->sc_enaddr))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
m = mace_get(sc, pkt, len);
|
||||
if (m == NULL) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn.c,v 1.4 2000/06/29 07:59:29 mrg Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.5 2000/10/01 23:32:41 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor DP8393X SONIC Driver
|
||||
|
@ -1081,14 +1081,8 @@ sonic_read(sc, pkt, len)
|
|||
int len;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
|
||||
/*
|
||||
* Get pointer to ethernet header (in input buffer).
|
||||
*/
|
||||
eh = (struct ether_header *)pkt;
|
||||
|
||||
#ifdef SNDEBUG
|
||||
{
|
||||
printf("%s: rcvd 0x%p len=%d type=0x%x from %s",
|
||||
|
@ -1111,14 +1105,8 @@ sonic_read(sc, pkt, len)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_tap(ifp->if_bpf, pkt, len);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
m = sonic_get(sc, pkt, len);
|
||||
if (m == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ie.c,v 1.33 2000/06/29 07:18:58 mrg Exp $ */
|
||||
/* $NetBSD: if_ie.c,v 1.34 2000/10/01 23:32:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
|
||||
|
@ -705,105 +705,19 @@ check_eh(sc, eh, to_bpf)
|
|||
int *to_bpf;
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
int i;
|
||||
|
||||
ifp = &sc->sc_if;
|
||||
|
||||
switch (sc->promisc) {
|
||||
case IFF_ALLMULTI:
|
||||
/*
|
||||
* Receiving all multicasts, but no unicasts except those
|
||||
* destined for us.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
/* BPF gets this packet if anybody cares */
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
if (eh->ether_dhost[0] & 1)
|
||||
return 1;
|
||||
if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl)))
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
case IFF_PROMISC:
|
||||
/*
|
||||
* Receiving all packets. These need to be passed on to BPF.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
/* If for us, accept and hand up to BPF */
|
||||
if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl)))
|
||||
return 1;
|
||||
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
*to_bpf = 2; /* we don't need to see it */
|
||||
#else
|
||||
*to_bpf = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Not a multicast, so BPF wants to see it but we don't.
|
||||
* This is all handled at a higher level now.
|
||||
*/
|
||||
if (!(eh->ether_dhost[0] & 1))
|
||||
return 1;
|
||||
|
||||
/*
|
||||
* If it's one of our multicast groups, accept it and pass it
|
||||
* up.
|
||||
*/
|
||||
for (i = 0; i < sc->mcast_count; i++) {
|
||||
if (ether_equal(eh->ether_dhost,
|
||||
(u_char *)&sc->mcast_addrs[i])) {
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
*to_bpf = 1;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
case IFF_ALLMULTI | IFF_PROMISC:
|
||||
/*
|
||||
* Acting as a multicast router, and BPF running at the same
|
||||
* time. Whew! (Hope this is a fast machine...)
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
/* We want to see multicasts. */
|
||||
if (eh->ether_dhost[0] & 1)
|
||||
return 1;
|
||||
|
||||
/* We want to see our own packets */
|
||||
if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl)))
|
||||
return 1;
|
||||
|
||||
/* Anything else goes to BPF but nothing else. */
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
*to_bpf = 2;
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
case 0:
|
||||
/*
|
||||
* Only accept unicast packets destined for us, or multicasts
|
||||
* for groups that we belong to. For now, we assume that the
|
||||
* '586 will only return packets that we asked it for. This
|
||||
* isn't strictly true (it uses hashing for the multicast filter),
|
||||
* but it will do in this case, and we want to get out of here
|
||||
* as quickly as possible.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#ifdef DIAGNOSTIC
|
||||
panic("ie: check_eh, impossible");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ln.c,v 1.14 2000/07/26 21:50:49 matt Exp $ */
|
||||
/* $NetBSD: if_ln.c,v 1.15 2000/10/01 23:32:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -535,7 +535,6 @@ ln_read(sc, boff, len)
|
|||
int len;
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
len > ETHERMTU + sizeof(struct ether_header)) {
|
||||
|
@ -552,29 +551,13 @@ ln_read(sc, boff, len)
|
|||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/* We assume that the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, sc->sc_enaddr, 6)) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Pass the packet up. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ni.c,v 1.5 2000/06/05 00:09:17 matt Exp $ */
|
||||
/* $NetBSD: if_ni.c,v 1.6 2000/10/01 23:32:41 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
*
|
||||
|
@ -590,7 +590,6 @@ nistart(ifp)
|
|||
void
|
||||
niintr(void *arg)
|
||||
{
|
||||
struct ether_header *eh;
|
||||
struct ni_softc *sc = arg;
|
||||
struct ni_dg *data;
|
||||
struct ni_msg *msg;
|
||||
|
@ -633,18 +632,8 @@ niintr(void *arg)
|
|||
break; /* Out of mbufs */
|
||||
|
||||
#if NBPFILTER > 0
|
||||
eh = mtod(m, struct ether_header *);
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0
|
||||
&& bcmp(LLADDR(ifp->if_sadl),
|
||||
eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0 &&
|
||||
((eh->ether_dhost[0] & 1) == 0)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, m);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dp8390.c,v 1.37 2000/05/29 17:37:12 jhawk Exp $ */
|
||||
/* $NetBSD: dp8390.c,v 1.38 2000/10/01 23:32:41 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
|
||||
|
@ -984,7 +984,6 @@ dp8390_read(sc, buf, len)
|
|||
{
|
||||
struct ifnet *ifp = &sc->sc_ec.ec_if;
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
|
||||
/* Pull packet off interface. */
|
||||
m = dp8390_get(sc, buf, len);
|
||||
|
@ -995,30 +994,13 @@ dp8390_read(sc, buf, len)
|
|||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/* We assume that the header fits entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: elink3.c,v 1.83 2000/09/28 10:10:14 tsutsui Exp $ */
|
||||
/* $NetBSD: elink3.c,v 1.84 2000/10/01 23:32:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -1500,7 +1500,6 @@ epread(sc)
|
|||
bus_space_handle_t ioh = sc->sc_ioh;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
int len;
|
||||
|
||||
len = bus_space_read_2(iot, ioh, ep_w1_reg(sc, ELINK_W1_RX_STATUS));
|
||||
|
@ -1548,31 +1547,15 @@ again:
|
|||
|
||||
++ifp->if_ipackets;
|
||||
|
||||
/* We assume the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(sc->sc_ethercom.ec_if.if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: elinkxl.c,v 1.40 2000/09/19 01:15:28 fvdl Exp $ */
|
||||
/* $NetBSD: elinkxl.c,v 1.41 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -1200,10 +1200,8 @@ ex_intr(arg)
|
|||
* instead.
|
||||
*/
|
||||
if (ex_add_rxbuf(sc, rxd) == 0) {
|
||||
struct ether_header *eh;
|
||||
u_int16_t total_len;
|
||||
|
||||
|
||||
if (pktstat & EX_UPD_ERR) {
|
||||
ifp->if_ierrors++;
|
||||
m_freem(m);
|
||||
|
@ -1218,29 +1216,10 @@ ex_intr(arg)
|
|||
}
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = total_len;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf) {
|
||||
bpf_tap(ifp->if_bpf,
|
||||
mtod(m, caddr_t),
|
||||
total_len);
|
||||
/*
|
||||
* Only pass this packet up
|
||||
* if it is for us.
|
||||
*/
|
||||
if ((ifp->if_flags &
|
||||
IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1)
|
||||
== 0 &&
|
||||
bcmp(eh->ether_dhost,
|
||||
LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost))
|
||||
!= 0) {
|
||||
m_freem(m);
|
||||
goto rcvloop;
|
||||
}
|
||||
}
|
||||
#endif /* NBPFILTER > 0 */
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
goto rcvloop;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hme.c,v 1.15 2000/06/25 01:05:16 eeh Exp $ */
|
||||
/* $NetBSD: hme.c,v 1.16 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -775,27 +775,8 @@ hme_read(sc, ix, len)
|
|||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
struct ether_header *eh;
|
||||
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
|
||||
/* We assume that the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
ether_cmp(eh->ether_dhost, sc->sc_enaddr) == 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Pass the packet up. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: i82557.c,v 1.37 2000/09/28 10:10:14 tsutsui Exp $ */
|
||||
/* $NetBSD: i82557.c,v 1.38 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -874,7 +874,6 @@ fxp_intr(arg)
|
|||
struct mbuf *m, *m0;
|
||||
bus_dmamap_t rxmap;
|
||||
struct fxp_rfa *rfa;
|
||||
struct ether_header *eh;
|
||||
int i, claimed = 0;
|
||||
u_int16_t len, rxstat, txstat;
|
||||
u_int8_t statack;
|
||||
|
@ -972,24 +971,15 @@ fxp_intr(arg)
|
|||
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Pass this up to any BPF listeners, but only
|
||||
* pass it up the stack it its for us.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(rxstat & FXP_RFA_STATUS_IAMATCH) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0) {
|
||||
m_freem(m);
|
||||
goto rcvloop;
|
||||
}
|
||||
}
|
||||
#endif /* NBPFILTER > 0 */
|
||||
#endif
|
||||
|
||||
/* Pass it on. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: i82586.c,v 1.27 2000/05/11 20:55:03 bjh21 Exp $ */
|
||||
/* $NetBSD: i82586.c,v 1.28 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -353,106 +353,19 @@ check_eh(sc, eh, to_bpf)
|
|||
int *to_bpf;
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
int i;
|
||||
|
||||
ifp = &sc->sc_ethercom.ec_if;
|
||||
|
||||
switch(sc->promisc) {
|
||||
case IFF_ALLMULTI:
|
||||
/*
|
||||
* Receiving all multicasts, but no unicasts except those
|
||||
* destined for us.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
/* BPF gets this packet if anybody cares */
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
if (eh->ether_dhost[0] & 1)
|
||||
return (1);
|
||||
if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl)))
|
||||
return (1);
|
||||
return (0);
|
||||
|
||||
case IFF_PROMISC:
|
||||
/*
|
||||
* Receiving all packets. These need to be passed on to BPF.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#else
|
||||
*to_bpf = 0;
|
||||
#endif
|
||||
/*
|
||||
* If for us, accept and hand up to BPF.
|
||||
*/
|
||||
if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl)))
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* If it's the broadcast address, accept and hand up to BPF.
|
||||
* This is all handled at a higher level now.
|
||||
*/
|
||||
if (ether_equal(eh->ether_dhost, etherbroadcastaddr))
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* If it's one of our multicast groups, accept it
|
||||
* and pass it up.
|
||||
*/
|
||||
for (i = 0; i < sc->mcast_count; i++) {
|
||||
if (ether_equal(eh->ether_dhost,
|
||||
(u_char *)&sc->mcast_addrs[i])) {
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
*to_bpf = 1;
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/* Not for us; BPF wants to see it but we don't. */
|
||||
if (*to_bpf)
|
||||
*to_bpf = 2;
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
|
||||
case IFF_ALLMULTI | IFF_PROMISC:
|
||||
/*
|
||||
* Acting as a multicast router, and BPF running at the same
|
||||
* time. Whew! (Hope this is a fast machine...)
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
/* We want to see multicasts. */
|
||||
if (eh->ether_dhost[0] & 1)
|
||||
return (1);
|
||||
|
||||
/* We want to see our own packets */
|
||||
if (ether_equal(eh->ether_dhost, LLADDR(ifp->if_sadl)))
|
||||
return (1);
|
||||
|
||||
/* Anything else goes to BPF but nothing else. */
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
*to_bpf = 2;
|
||||
#endif
|
||||
return (1);
|
||||
|
||||
default:
|
||||
/*
|
||||
* Only accept unicast packets destined for us, or multicasts
|
||||
* for groups that we belong to. For now, we assume that the
|
||||
* '586 will only return packets that we asked it for. This
|
||||
* isn't strictly true (it uses hashing for the multicast
|
||||
* filter), but it will do in this case, and we want to get
|
||||
* out of here as quickly as possible.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (ifp->if_bpf != 0);
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lance.c,v 1.12 2000/05/12 16:45:42 thorpej Exp $ */
|
||||
/* $NetBSD: lance.c,v 1.13 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -465,7 +465,6 @@ lance_read(sc, boff, len)
|
|||
int boff, len;
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
len > ETHERMTU + sizeof(struct ether_header)) {
|
||||
|
@ -486,31 +485,13 @@ lance_read(sc, boff, len)
|
|||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/* We assume that the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
#ifndef LANCE_REVC_BUG
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
ETHER_CMP(eh->ether_dhost, sc->sc_enaddr)) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LANCE_REVC_BUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lemac.c,v 1.15 2000/06/28 17:12:58 mrg Exp $ */
|
||||
/* $NetBSD: lemac.c,v 1.16 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1995, 1997 Matt Thomas <matt@3am-software.com>
|
||||
|
@ -284,17 +284,6 @@ lemac_input(
|
|||
LEMAC_GETBUF16(sc, offset, sizeof(eh) / 2, (void *) &eh);
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is single cast but not to us
|
||||
* drop it!
|
||||
*/
|
||||
if ((eh.ether_dhost[0] & 1) == 0
|
||||
#if NBPFILTER > 0
|
||||
&& (sc->sc_if.if_flags & IFF_PROMISC) == 0
|
||||
#endif
|
||||
&& !LEMAC_ADDREQUAL(eh.ether_dhost, sc->sc_enaddr))
|
||||
return;
|
||||
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == NULL) {
|
||||
sc->sc_if.if_ierrors++;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mb86960.c,v 1.41 2000/08/09 02:05:06 tv Exp $ */
|
||||
/* $NetBSD: mb86960.c,v 1.42 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
|
||||
|
@ -1331,7 +1331,6 @@ mb86960_get_packet(sc, len)
|
|||
bus_space_tag_t bst = sc->sc_bst;
|
||||
bus_space_handle_t bsh = sc->sc_bsh;
|
||||
struct ifnet *ifp = &sc->sc_ec.ec_if;
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
|
||||
/* Allocate a header mbuf. */
|
||||
|
@ -1370,7 +1369,6 @@ mb86960_get_packet(sc, len)
|
|||
* header mbuf.
|
||||
*/
|
||||
m->m_data += EOFF;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
/* Set the length of this packet. */
|
||||
m->m_len = len;
|
||||
|
@ -1384,22 +1382,8 @@ mb86960_get_packet(sc, len)
|
|||
* Check if there's a BPF listener on this interface. If so, hand off
|
||||
* the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, sc->sc_enaddr,
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rtl81x9.c,v 1.13 2000/09/25 01:07:25 enami Exp $ */
|
||||
/* $NetBSD: rtl81x9.c,v 1.14 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998
|
||||
|
@ -984,7 +984,6 @@ rtk_power(why, arg)
|
|||
STATIC void rtk_rxeof(sc)
|
||||
struct rtk_softc *sc;
|
||||
{
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp;
|
||||
int total_len = 0;
|
||||
|
@ -1124,7 +1123,6 @@ STATIC void rtk_rxeof(sc)
|
|||
if (m == NULL)
|
||||
continue;
|
||||
|
||||
eh = mtod(m, struct ether_header *);
|
||||
ifp->if_ipackets++;
|
||||
|
||||
#if NBPFILTER > 0
|
||||
|
@ -1134,16 +1132,8 @@ STATIC void rtk_rxeof(sc)
|
|||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
ETHER_IS_MULTICAST(eh->ether_dhost) == 0 &&
|
||||
memcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) != 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* pass it on. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: seeq8005.c,v 1.3 2000/09/23 15:13:02 bjh21 Exp $ */
|
||||
/* $NetBSD: seeq8005.c,v 1.4 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ben Harris
|
||||
|
@ -58,7 +58,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: seeq8005.c,v 1.3 2000/09/23 15:13:02 bjh21 Exp $");
|
||||
__RCSID("$NetBSD: seeq8005.c,v 1.4 2000/10/01 23:32:42 thorpej Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/endian.h>
|
||||
|
@ -1068,7 +1068,6 @@ eagetpackets(struct seeq8005_softc *sc)
|
|||
static void
|
||||
earead(struct seeq8005_softc *sc, int addr, int len)
|
||||
{
|
||||
register struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp;
|
||||
|
||||
|
@ -1078,7 +1077,6 @@ earead(struct seeq8005_softc *sc, int addr, int len)
|
|||
m = eaget(sc, addr, len, ifp);
|
||||
if (m == 0)
|
||||
return;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#ifdef EA_RX_DEBUG
|
||||
dprintf(("%s-->", ether_sprintf(eh->ether_shost)));
|
||||
|
@ -1090,22 +1088,8 @@ earead(struct seeq8005_softc *sc, int addr, int len)
|
|||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to bpf.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
!ETHER_IS_MULTICAST(eh->ether_dhost) &&
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sgec.c,v 1.6 2000/06/05 02:28:19 matt Exp $ */
|
||||
/* $NetBSD: sgec.c,v 1.7 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
*
|
||||
|
@ -432,27 +432,9 @@ sgec_intr(sc)
|
|||
sc->sc_nextrx = 0;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
((eh->ether_dhost[0] & 1) == 0) &&
|
||||
bcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* ALLMULTI means PROMISC in this driver.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_ALLMULTI) &&
|
||||
((eh->ether_dhost[0] & 1) == 0) &&
|
||||
bcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
|
||||
|
@ -663,6 +645,14 @@ ze_setup(sc)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ALLMULTI implies PROMISC in this driver.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_ALLMULTI)
|
||||
ifp->if_flags |= IFF_PROMISC;
|
||||
else if (ifp->if_pcount == 0)
|
||||
ifp->if_flags &= ~IFF_PROMISC;
|
||||
|
||||
/*
|
||||
* Fiddle with the receive logic.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: smc83c170.c,v 1.32 2000/05/26 00:14:41 tsutsui Exp $ */
|
||||
/* $NetBSD: smc83c170.c,v 1.33 2000/10/01 23:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -628,7 +628,6 @@ epic_intr(arg)
|
|||
{
|
||||
struct epic_softc *sc = arg;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct ether_header *eh;
|
||||
struct epic_rxdesc *rxd;
|
||||
struct epic_txdesc *txd;
|
||||
struct epic_descsoft *ds;
|
||||
|
@ -747,25 +746,15 @@ epic_intr(arg)
|
|||
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Pass this up to any BPF listeners, but only
|
||||
* pass it up the stack if its for us.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
memcmp(LLADDR(ifp->if_sadl),
|
||||
eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0 &&
|
||||
ETHER_IS_MULTICAST(eh->ether_dhost) == 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* NPBFILTER > 0 */
|
||||
#endif
|
||||
|
||||
/* Pass it on. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: smc91cxx.c,v 1.29 2000/08/06 00:19:04 briggs Exp $ */
|
||||
/* $NetBSD: smc91cxx.c,v 1.30 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -1054,15 +1054,6 @@ smc91cxx_read(sc)
|
|||
bpf_mtap(ifp->if_bpf, m);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If this is unicast and not for me, drop it.
|
||||
*/
|
||||
if ((eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
ether_cmp(eh->ether_dhost, LLADDR(ifp->if_sadl)) != 0) {
|
||||
m_freem(m);
|
||||
goto out;
|
||||
}
|
||||
|
||||
m->m_pkthdr.len = m->m_len = packetlen;
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tulip.c,v 1.71 2000/08/03 03:07:30 castor Exp $ */
|
||||
/* $NetBSD: tulip.c,v 1.72 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -1422,19 +1422,19 @@ tlp_rxintr(sc)
|
|||
#endif /* NPBFILTER > 0 */
|
||||
|
||||
/*
|
||||
* This test is outside the NBPFILTER block because
|
||||
* on the 21140 we have to use Hash-Only mode due to
|
||||
* a bug in the filter logic.
|
||||
* We sometimes have to run the 21140 in Hash-Only
|
||||
* mode. If we're in that mode, and not in promiscuous
|
||||
* mode, and we have a unicast packet that isn't for
|
||||
* us, then drop it.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 ||
|
||||
sc->sc_filtmode == TDCTL_Tx_FT_HASHONLY) {
|
||||
if (memcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0 &&
|
||||
ETHER_IS_MULTICAST(eh->ether_dhost) == 0) {
|
||||
if (sc->sc_filtmode == TDCTL_Tx_FT_HASHONLY &&
|
||||
(ifp->if_flags & IFF_PROMISC) == 0 &&
|
||||
ETHER_IS_MULTICAST(eh->ether_dhost) == 0 &&
|
||||
memcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pass it on. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cs89x0.c,v 1.14 2000/06/28 16:27:52 mrg Exp $ */
|
||||
/* $NetBSD: cs89x0.c,v 1.15 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997
|
||||
|
@ -1563,39 +1563,16 @@ cs_ether_input(sc, m)
|
|||
struct mbuf *m;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct ether_header *eh;
|
||||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/*
|
||||
* the first thing in the mbuf is the ethernet header. we need to
|
||||
* pass this header to the upper layers as a structure, so cast the
|
||||
* start of the mbuf, and adjust the mbuf to point to the end of the
|
||||
* ethernet header, ie the ethernet packet data.
|
||||
*/
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, sc->sc_enaddr,
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Pass the packet up. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_eg.c,v 1.49 2000/03/30 12:45:33 augustss Exp $ */
|
||||
/* $NetBSD: if_eg.c,v 1.50 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Dean Huxley <dean@fsa.ca>
|
||||
|
@ -753,7 +753,6 @@ egread(sc, buf, len)
|
|||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
len > ETHER_MAX_LEN) {
|
||||
|
@ -772,30 +771,13 @@ egread(sc, buf, len)
|
|||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/* We assume the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_el.c,v 1.60 2000/03/30 12:45:33 augustss Exp $ */
|
||||
/* $NetBSD: if_el.c,v 1.61 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted
|
||||
|
@ -578,7 +578,6 @@ elread(sc, len)
|
|||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
len > ETHER_MAX_LEN) {
|
||||
|
@ -597,30 +596,13 @@ elread(sc, len)
|
|||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/* We assume that the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_iy.c,v 1.42 2000/08/09 01:56:33 tv Exp $ */
|
||||
/* $NetBSD: if_iy.c,v 1.43 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
/* #define IYDEBUG */
|
||||
/* #define IYMEMDEBUG */
|
||||
|
||||
|
@ -977,7 +977,6 @@ iyget(sc, iot, ioh, rxlen)
|
|||
int rxlen;
|
||||
{
|
||||
struct mbuf *m, *top, **mp;
|
||||
struct ether_header *eh;
|
||||
struct ifnet *ifp;
|
||||
int len;
|
||||
|
||||
|
@ -1031,20 +1030,9 @@ iyget(sc, iot, ioh, rxlen)
|
|||
/* XXX receive the top here */
|
||||
++ifp->if_ipackets;
|
||||
|
||||
eh = mtod(top, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, top);
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
(eh->ether_dhost[0] & 1) == 0 &&
|
||||
bcmp(eh->ether_dhost,
|
||||
LLADDR(ifp->if_sadl), sizeof(eh->ether_dhost)) != 0) {
|
||||
|
||||
m_freem(top);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, top);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sip.c,v 1.15 2000/09/20 05:44:48 thorpej Exp $ */
|
||||
/* $NetBSD: if_sip.c,v 1.16 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Network Computer, Inc.
|
||||
|
@ -1174,7 +1174,6 @@ sip_rxintr(sc)
|
|||
struct sip_softc *sc;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct ether_header *eh;
|
||||
struct sip_rxsoft *rxs;
|
||||
struct mbuf *m;
|
||||
u_int32_t cmdsts;
|
||||
|
@ -1314,7 +1313,6 @@ sip_rxintr(sc)
|
|||
#endif /* __NO_STRICT_ALIGNMENT */
|
||||
|
||||
ifp->if_ipackets++;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
|
||||
|
@ -1323,14 +1321,8 @@ sip_rxintr(sc)
|
|||
* Pass this up to any BPF listeners, but only
|
||||
* pass if up the stack if it's for us.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(cmdsts & CMDSTS_Rx_DEST) == CMDSTS_Rx_DEST_REJ) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* NBPFILTER > 0 */
|
||||
|
||||
/* Pass it on. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ti.c,v 1.10 2000/09/24 14:19:52 martin Exp $ */
|
||||
/* $NetBSD: if_ti.c,v 1.11 2000/10/01 23:32:43 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
|
@ -1852,7 +1852,6 @@ static void ti_rxeof(sc)
|
|||
while(sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) {
|
||||
struct ti_rx_desc *cur_rx;
|
||||
u_int32_t rxidx;
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m = NULL;
|
||||
#if NVLAN > 0
|
||||
u_int16_t vlan_tag = 0;
|
||||
|
@ -1928,7 +1927,6 @@ static void ti_rxeof(sc)
|
|||
|
||||
m->m_pkthdr.len = m->m_len = cur_rx->ti_len;
|
||||
ifp->if_ipackets++;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
|
||||
#if NBPFILTER > 0
|
||||
|
@ -1938,16 +1936,8 @@ static void ti_rxeof(sc)
|
|||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if (ifp->if_flags & IFF_PROMISC &&
|
||||
(bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) &&
|
||||
(eh->ether_dhost[0] & 1) == 0)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TI_CSUM_OFFLOAD /* XXX NetBSD: broken because m points to ether pkt */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_tl.c,v 1.35 2000/09/05 22:37:33 thorpej Exp $ */
|
||||
/* $NetBSD: if_tl.c,v 1.36 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
|
||||
|
@ -943,36 +943,21 @@ tl_intr(v)
|
|||
|
||||
/* deliver packet */
|
||||
if (m) {
|
||||
struct ether_header *eh;
|
||||
if (size < sizeof(struct ether_header)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = size;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
#ifdef TLDEBUG_RX
|
||||
{ struct ether_header *eh =
|
||||
mtod(m, struct ether_header *);
|
||||
printf("tl_intr: Rx packet:\n");
|
||||
ether_printheader(eh);
|
||||
ether_printheader(eh); }
|
||||
#endif
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf) {
|
||||
bpf_tap(ifp->if_bpf,
|
||||
mtod(m, caddr_t), size);
|
||||
/*
|
||||
* Only pass this packet up
|
||||
* if it is for us.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
/* !mcast and !bcast */
|
||||
(eh->ether_dhost[0] & 1) == 0 &&
|
||||
bcmp(eh->ether_dhost,
|
||||
LLADDR(ifp->if_sadl),
|
||||
sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
#endif /* NBPFILTER > 0 */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_vr.c,v 1.37 2000/09/13 16:40:15 tron Exp $ */
|
||||
/* $NetBSD: if_vr.c,v 1.38 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -593,7 +593,6 @@ static void
|
|||
vr_rxeof(sc)
|
||||
struct vr_softc *sc;
|
||||
{
|
||||
struct ether_header *eh;
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp;
|
||||
struct vr_desc *d;
|
||||
|
@ -751,7 +750,6 @@ vr_rxeof(sc)
|
|||
#endif /* __NO_STRICT_ALIGNMENT */
|
||||
|
||||
ifp->if_ipackets++;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = total_len;
|
||||
#if NBPFILTER > 0
|
||||
|
@ -761,16 +759,8 @@ vr_rxeof(sc)
|
|||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
ETHER_IS_MULTICAST(eh->ether_dhost) == 0 &&
|
||||
memcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) != 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Pass it on. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_cnw.c,v 1.13 2000/07/05 18:47:51 itojun Exp $ */
|
||||
/* $NetBSD: if_cnw.c,v 1.14 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -875,7 +875,6 @@ cnw_recv(sc)
|
|||
int rser;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
|
||||
for (;;) {
|
||||
WAIT_WOC(sc);
|
||||
|
@ -902,19 +901,6 @@ cnw_recv(sc)
|
|||
bpf_mtap(ifp->if_bpf, m);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check that the packet is for us or {multi,broad}cast. Maybe
|
||||
* there's a fool-poof hardware check for this, but I don't
|
||||
* really know...
|
||||
*/
|
||||
eh = mtod(m, struct ether_header *);
|
||||
if ((eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(LLADDR(sc->sc_ethercom.ec_if.if_sadl),
|
||||
eh->ether_dhost, sizeof(eh->ether_dhost)) != 0) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Pass the packet up. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ray.c,v 1.21 2000/07/05 02:35:54 onoe Exp $ */
|
||||
/* $NetBSD: if_ray.c,v 1.22 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Christian E. Hopps
|
||||
* All rights reserved.
|
||||
|
@ -840,7 +840,11 @@ ray_init(sc)
|
|||
sc->sc_if.if_flags |= IFF_RUNNING | IFF_OACTIVE;
|
||||
|
||||
/* set this now so it gets set in the download */
|
||||
sc->sc_promisc = !!(sc->sc_if.if_flags & (IFF_PROMISC|IFF_ALLMULTI));
|
||||
if (sc->sc_if.if_flags & IFF_ALLMULTI)
|
||||
sc->sc_if.if_flags |= IFF_PROMISC;
|
||||
else if (sc->sc_if.if_pcount == 0)
|
||||
sc->sc_if.if_flags &= ~IFF_PROMISC;
|
||||
sc->sc_promisc = !!(sc->sc_if.if_flags & IFF_PROMISC);
|
||||
|
||||
/* call after we mark ourselves running */
|
||||
ray_download_params(sc);
|
||||
|
@ -2785,7 +2789,11 @@ ray_update_promisc(sc)
|
|||
ray_cmd_cancel(sc, SCP_UPD_PROMISC);
|
||||
|
||||
/* do the issue check before equality check */
|
||||
promisc = !!(sc->sc_if.if_flags & (IFF_PROMISC | IFF_ALLMULTI));
|
||||
if (sc->sc_if.if_flags & IFF_ALLMULTI)
|
||||
sc->sc_if.if_flags |= IFF_PROMISC;
|
||||
else if (sc->sc_if.if_pcount == 0)
|
||||
sc->sc_if.if_flags &= ~IFF_PROMISC;
|
||||
promisc = !!(sc->sc_if.if_flags & IFF_PROMISC);
|
||||
if ((sc->sc_if.if_flags & IFF_RUNNING) == 0)
|
||||
return;
|
||||
else if (ray_cmd_is_running(sc, SCP_UPDATESUBCMD)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_wi.c,v 1.36 2000/09/28 06:29:41 enami Exp $ */
|
||||
/* $NetBSD: if_wi.c,v 1.37 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
|
@ -571,15 +571,8 @@ static void wi_rxeof(sc)
|
|||
|
||||
#if NBPFILTER > 0
|
||||
/* Handle BPF listeners. */
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if (ifp->if_flags & IFF_PROMISC &&
|
||||
(bcmp(eh->ether_dhost, sc->sc_macaddr,
|
||||
ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Receive packet. */
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
/* $NetBSD: if_xi.c,v 1.4 2000/07/31 21:49:47 gmcgarry Exp $ */
|
||||
/* $NetBSD: if_xi.c,v 1.5 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
/* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */
|
||||
|
||||
/*
|
||||
* XXX THIS DRIVER IS BROKEN WRT. MULTICAST LISTS AND PROMISC/ALLMULTI
|
||||
* XXX FLAGS!
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas
|
||||
* All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_de.c,v 1.5 2000/06/08 19:58:49 ragge Exp $ */
|
||||
/* $NetBSD: if_de.c,v 1.6 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989 Regents of the University of California.
|
||||
|
@ -550,18 +550,8 @@ derecv(struct de_softc *sc)
|
|||
}
|
||||
m = sc->sc_rxmbuf[sc->sc_rindex];
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf) {
|
||||
struct ether_header *eh;
|
||||
|
||||
eh = mtod(m, struct ether_header *);
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
bcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0 &&
|
||||
(ETHER_IS_MULTICAST(eh->ether_dhost)==0)) {
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (de_add_rxbuf(sc, sc->sc_rindex) == 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_qe.c,v 1.42 2000/06/05 00:09:18 matt Exp $ */
|
||||
/* $NetBSD: if_qe.c,v 1.43 2000/10/01 23:32:44 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
*
|
||||
|
@ -606,27 +606,9 @@ qeintr(arg)
|
|||
sc->sc_nextrx = 0;
|
||||
eh = mtod(m, struct ether_header *);
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
bcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0 &&
|
||||
((eh->ether_dhost[0] & 1) == 0)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* ALLMULTI means PROMISC in this driver.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_ALLMULTI) &&
|
||||
((eh->ether_dhost[0] & 1) == 0) &&
|
||||
bcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
}
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
|
||||
|
@ -860,7 +842,11 @@ qe_setup(sc)
|
|||
* Until someone tells me, fall back to PROMISC when more than
|
||||
* 12 ethernet addresses.
|
||||
*/
|
||||
if (ifp->if_flags & (IFF_PROMISC|IFF_ALLMULTI))
|
||||
if (ifp->if_flags & IFF_ALLMULTI)
|
||||
ifp->if_flags |= IFF_PROMISC;
|
||||
else if (ifp->if_pcount == 0)
|
||||
ifp->if_flags &= ~IFF_PROMISC;
|
||||
if (ifp->if_flags & IFF_PROMISC)
|
||||
qc->qc_xmit[idx].qe_buf_len = -65;
|
||||
|
||||
qc->qc_xmit[idx].qe_addr_lo = LOWORD(sc->sc_pqedata->qc_setup);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_se.c,v 1.30 2000/06/09 08:54:22 enami Exp $ */
|
||||
/* $NetBSD: if_se.c,v 1.31 2000/10/01 23:32:45 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au>
|
||||
|
@ -652,7 +652,6 @@ se_read(sc, data, datalen)
|
|||
int datalen;
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct ether_header *eh;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
int n;
|
||||
|
||||
|
@ -695,30 +694,13 @@ se_read(sc, data, datalen)
|
|||
}
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/* We assume that the header fit entirely in one mbuf. */
|
||||
eh = mtod(m, struct ether_header *);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
|
||||
/* Note that the interface cannot be in
|
||||
* promiscuous mode if there are no BPF
|
||||
* listeners. And if we are in promiscuous
|
||||
* mode, we have to check if this packet is
|
||||
* really ours.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
ETHER_CMP(eh->ether_dhost, LLADDR(ifp->if_sadl))) {
|
||||
m_freem(m);
|
||||
goto next_packet;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Pass the packet up. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_aue.c,v 1.43 2000/09/20 01:26:14 itojun Exp $ */
|
||||
/* $NetBSD: if_aue.c,v 1.44 2000/10/01 23:32:45 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
|
||||
|
@ -1242,21 +1242,8 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
|
|||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
#if defined(__NetBSD__)
|
||||
struct ether_header *eh = mtod(m, struct ether_header *);
|
||||
if (ifp->if_bpf)
|
||||
BPF_MTAP(ifp, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
memcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) &&
|
||||
!(eh->ether_dhost[0] & 1)) {
|
||||
m_freem(m);
|
||||
goto done1;
|
||||
}
|
||||
#else
|
||||
BPF_MTAP(ifp, m);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->aue_dev),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_cue.c,v 1.23 2000/06/01 14:28:57 augustss Exp $ */
|
||||
/* $NetBSD: if_cue.c,v 1.24 2000/10/01 23:32:45 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
|
||||
|
@ -1000,21 +1000,8 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
|
|||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
#if defined(__NetBSD__)
|
||||
struct ether_header *eh = mtod(m, struct ether_header *);
|
||||
if (ifp->if_bpf)
|
||||
BPF_MTAP(ifp, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
memcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) &&
|
||||
!(eh->ether_dhost[0] & 1)) {
|
||||
m_freem(m);
|
||||
goto done1;
|
||||
}
|
||||
#else
|
||||
BPF_MTAP(ifp, m);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->cue_dev),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_kue.c,v 1.29 2000/06/01 14:28:58 augustss Exp $ */
|
||||
/* $NetBSD: if_kue.c,v 1.30 2000/10/01 23:32:45 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
|
||||
|
@ -966,21 +966,8 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
|
|||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
#if defined(__NetBSD__)
|
||||
struct ether_header *eh = mtod(m, struct ether_header *);
|
||||
if (ifp->if_bpf)
|
||||
BPF_MTAP(ifp, m);
|
||||
if ((ifp->if_flags & IFF_PROMISC) &&
|
||||
memcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
ETHER_ADDR_LEN) &&
|
||||
!(eh->ether_dhost[0] & 1)) {
|
||||
m_freem(m);
|
||||
goto done1;
|
||||
}
|
||||
#else
|
||||
BPF_MTAP(ifp, m);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->kue_dev),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ethersubr.c,v 1.60 2000/09/28 07:15:28 enami Exp $ */
|
||||
/* $NetBSD: if_ethersubr.c,v 1.61 2000/10/01 23:32:45 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -514,9 +514,9 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
|
|||
|
||||
ifp->if_lastchange = time;
|
||||
ifp->if_ibytes += m->m_pkthdr.len;
|
||||
if (eh->ether_dhost[0] & 1) {
|
||||
if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
|
||||
sizeof(etherbroadcastaddr)) == 0)
|
||||
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
|
||||
if (memcmp(etherbroadcastaddr,
|
||||
eh->ether_dhost, ETHER_ADDR_LEN) == 0)
|
||||
m->m_flags |= M_BCAST;
|
||||
else
|
||||
m->m_flags |= M_MCAST;
|
||||
|
@ -524,6 +524,18 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
|
|||
if (m->m_flags & (M_BCAST|M_MCAST))
|
||||
ifp->if_imcasts++;
|
||||
|
||||
/*
|
||||
* If we're in promiscuous mode, and we are holding a
|
||||
* unicast packet that isn't for us, drop it.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(m->m_flags & (M_BCAST|M_MCAST)) == 0 &&
|
||||
memcmp(LLADDR(ifp->if_sadl), eh->ether_dhost,
|
||||
ETHER_ADDR_LEN) != 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
|
||||
etype = ntohs(eh->ether_type);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue