Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic drop wrongly looped back multicast packet before ...



details:   https://anonhg.NetBSD.org/src/rev/38dafded0159
branches:  trunk
changeset: 476297:38dafded0159
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Sep 12 18:26:58 1999 +0000

description:
drop wrongly looped back multicast packet before we put it into BPF.

diffstat:

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

diffs (58 lines):

diff -r 13c742d7d94f -r 38dafded0159 sys/dev/ic/smc91cxx.c
--- a/sys/dev/ic/smc91cxx.c     Sun Sep 12 17:40:57 1999 +0000
+++ b/sys/dev/ic/smc91cxx.c     Sun Sep 12 18:26:58 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc91cxx.c,v 1.18 1999/09/10 00:23:34 itojun Exp $     */
+/*     $NetBSD: smc91cxx.c,v 1.19 1999/09/12 18:26:58 itojun Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -923,10 +923,25 @@
 
        ifp->if_ipackets++;
 
+       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 NBPFILTER > 0
        /*
-        * Hand the packet off to bpf listeners.  If there's a bpf listener,
-        * we need to check if the packet is ours.
+        * Hand the packet off to bpf listeners.
         */
        if (ifp->if_bpf)
                bpf_mtap(ifp->if_bpf, m);
@@ -941,20 +956,6 @@
                        m_freem(m);
                        goto out;
                }
-
-               /*
-                * 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;
-               }
        }
 
        m->m_pkthdr.len = m->m_len = packetlen;



Home | Main Index | Thread Index | Old Index