Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic in promisc mode, don't inject outgoing packet to ...



details:   https://anonhg.NetBSD.org/src/rev/e6155d3bf5e7
branches:  trunk
changeset: 480652:e6155d3bf5e7
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jan 17 07:06:57 2000 +0000

description:
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).

diffstat:

 sys/dev/ic/smc91cxx.c |  33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diffs (63 lines):

diff -r fc8ec42c2700 -r e6155d3bf5e7 sys/dev/ic/smc91cxx.c
--- a/sys/dev/ic/smc91cxx.c     Mon Jan 17 06:29:07 2000 +0000
+++ b/sys/dev/ic/smc91cxx.c     Mon Jan 17 07:06:57 2000 +0000
@@ -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 @@
 
        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 @@
                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);
 



Home | Main Index | Thread Index | Old Index