From e9100143aa2393d855c3386cae72948be71cc640 Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 17 Jan 2000 07:06:57 +0000 Subject: [PATCH] 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). --- sys/dev/ic/smc91cxx.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c index 88acdef82da5..511264e07c66 100644 --- a/sys/dev/ic/smc91cxx.c +++ b/sys/dev/ic/smc91cxx.c @@ -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);