in promisc mode, don't inject outgoing packet to bpf twice.

this is because the card gets the outgoing packet from itself in promisc mode
(not really IFF_SIMPLEX).
This commit is contained in:
itojun 2000-01-17 07:06:57 +00:00
parent 3867d18179
commit e9100143aa
1 changed files with 16 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smc91cxx.c,v 1.20 1999/09/28 17:55:33 thorpej Exp $ */
/* $NetBSD: smc91cxx.c,v 1.21 2000/01/17 07:06:57 itojun Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -928,20 +928,30 @@ smc91cxx_read(sc)
ifp->if_ipackets++;
/*
* Make sure to behave as IFF_SIMPLEX in all cases.
* This is to cope with SMC91C92 (Megahertz XJ10BT), which
* loops back packets to itself on promiscuous mode.
* (should be ensured by chipset configuration)
*/
if ((ifp->if_flags & IFF_PROMISC) != 0) {
/*
* Make sure to behave as IFF_SIMPLEX in all cases.
* Drop multicast/broadcast packet looped back from myself.
*
* This is to cope with SMC91C92 (Megahertz XJ10BT), which
* loops back multicast packet to itself on promiscuous mode.
* (should be ensured by chipset configuration)
*/
if ((eh->ether_dhost[0] & 1) == 1 && /* mcast || bcast */
ether_cmp(eh->ether_shost, LLADDR(ifp->if_sadl)) == 0) {
m_freem(m);
goto out;
}
/*
* 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;
}
}
#if NBPFILTER > 0
@ -952,17 +962,6 @@ smc91cxx_read(sc)
bpf_mtap(ifp->if_bpf, m);
#endif
if ((ifp->if_flags & IFF_PROMISC) != 0) {
/*
* 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);