Module Name:    src
Committed By:   pooka
Date:           Thu Mar 10 13:20:54 UTC 2011

Modified Files:
        src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
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 ;)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/rump/net/lib/libshmif/if_shmem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.33 src/sys/rump/net/lib/libshmif/if_shmem.c:1.34
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.33	Mon Dec  6 10:48:18 2010
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Thu Mar 10 13:20:54 2011
@@ -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);

Reply via email to