Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/net/lib/libshmif Pass packet up if it's *for* us, n...



details:   https://anonhg.NetBSD.org/src/rev/d7016a70d1bf
branches:  trunk
changeset: 763110:d7016a70d1bf
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Mar 10 13:20:54 2011 +0000

description:
Pass packet up if it's *for* us, not if it's from someone else.
This fixes a rather curious forwarding/redirect/etc. storm which
happened when there were >2 shmif kernels on the same shmbus with
ip forwarding set on. (at least it stress-tested other code ;)

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 6ee5564b76c7 -r d7016a70d1bf sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Thu Mar 10 13:17:35 2011 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Thu Mar 10 13:20:54 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_shmem.c,v 1.33 2010/12/06 10:48:18 pooka Exp $      */
+/*     $NetBSD: if_shmem.c,v 1.34 2011/03/10 13:20:54 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.33 2010/12/06 10:48:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.34 2011/03/10 13:20:54 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -697,9 +697,10 @@
                m->m_len = m->m_pkthdr.len = sp.sp_len;
                m->m_pkthdr.rcvif = ifp;
 
-               /* if it's from us, don't pass up and reuse storage space */
+               /* if it's for us, pass up.  otherwise, reuse storage space */
                eth = mtod(m, struct ether_header *);
-               if (memcmp(eth->ether_shost, sc->sc_myaddr, 6) != 0) {
+               if (memcmp(eth->ether_dhost, sc->sc_myaddr, 6) == 0 ||
+                   memcmp(eth->ether_dhost, etherbroadcastaddr, 6) == 0) {
                        KERNEL_LOCK(1, NULL);
                        ifp->if_input(ifp, m);
                        KERNEL_UNLOCK_ONE(NULL);



Home | Main Index | Thread Index | Old Index