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 Ignore too short packets. This co...



details:   https://anonhg.NetBSD.org/src/rev/3362cbad7af6
branches:  trunk
changeset: 787377:3362cbad7af6
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Jun 14 05:56:29 2013 +0000

description:
Ignore too short packets.  This condition is true especially for the
first packet on a new bus (len == 0).  Everything else in the stack
besides bpf seemed to be able to deal with one, though.

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 63f88b97b390 -r 3362cbad7af6 sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Fri Jun 14 05:54:04 2013 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Fri Jun 14 05:56:29 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_shmem.c,v 1.54 2013/05/01 06:58:36 pooka Exp $      */
+/*     $NetBSD: if_shmem.c,v 1.55 2013/06/14 05:56:29 pooka Exp $      */
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.54 2013/05/01 06:58:36 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.55 2013/06/14 05:56:29 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -724,6 +724,12 @@
                            sc, sc->sc_devgen));
                }
 
+               if (__predict_false(sp.sp_len < ETHER_HDR_LEN)) {
+                       DPRINTF(("shmif read packet len %d < ETHER_HDR_LEN\n",
+                           sp.sp_len));
+                       continue;
+               }
+
                m->m_len = m->m_pkthdr.len = sp.sp_len;
                m->m_pkthdr.rcvif = ifp;
 



Home | Main Index | Thread Index | Old Index