Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Make sure to behave as IFF_SIMPLEX in all cases.



details:   https://anonhg.NetBSD.org/src/rev/1c32443aa93a
branches:  trunk
changeset: 476226:1c32443aa93a
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Sep 10 00:23:34 1999 +0000

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

Reviewed by: thorpej

diffstat:

 sys/dev/ic/smc91cxx.c |  29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r 3fed4ef1c1d5 -r 1c32443aa93a sys/dev/ic/smc91cxx.c
--- a/sys/dev/ic/smc91cxx.c     Fri Sep 10 00:18:20 1999 +0000
+++ b/sys/dev/ic/smc91cxx.c     Fri Sep 10 00:23:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc91cxx.c,v 1.17 1999/05/18 23:52:56 thorpej Exp $    */
+/*     $NetBSD: smc91cxx.c,v 1.18 1999/09/10 00:23:34 itojun Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -928,17 +928,34 @@
         * Hand the packet off to bpf listeners.  If there's a bpf listener,
         * we need to check if the packet is ours.
         */
-       if (ifp->if_bpf) {
+       if (ifp->if_bpf)
                bpf_mtap(ifp->if_bpf, m);
+#endif
 
-               if ((ifp->if_flags & IFF_PROMISC) &&
-                   (eh->ether_dhost[0] & 1) == 0 &&    /* !mcast and !bcast */
-                   ether_cmp(eh->ether_dhost, LLADDR(ifp->if_sadl))) {
+       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;
+               }
+
+               /*
+                * 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;
                }
        }
-#endif
 
        m->m_pkthdr.len = m->m_len = packetlen;
        (*ifp->if_input)(ifp, m);



Home | Main Index | Thread Index | Old Index