Source-Changes-HG archive

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

[src/trunk]: src/sys/net Don't classify dropped packets that we don't underst...



details:   https://anonhg.NetBSD.org/src/rev/b45e66756034
branches:  trunk
changeset: 1025169:b45e66756034
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Nov 08 16:50:05 2021 +0000

description:
Don't classify dropped packets that we don't understand as errors, for
example etype 0x88CA (TIPC (Transparent Inter Process Communication,)
or 0x893A (IEEE 1905).
Classify them as dropped like Linux does (FreeBSD just ignores them). From RVP.

diffstat:

 sys/net/if_ethersubr.c |  22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 308148d446f3 -r b45e66756034 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Mon Nov 08 11:01:51 2021 +0000
+++ b/sys/net/if_ethersubr.c    Mon Nov 08 16:50:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.302 2021/10/25 17:05:43 ryo Exp $   */
+/*     $NetBSD: if_ethersubr.c,v 1.303 2021/11/08 16:50:05 christos Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.302 2021/10/25 17:05:43 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.303 2021/11/08 16:50:05 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -668,8 +668,10 @@
 #endif
 
        if (__predict_false(m->m_len < sizeof(*eh))) {
-               if ((m = m_pullup(m, sizeof(*eh))) == NULL)
-                       goto dropped;
+               if ((m = m_pullup(m, sizeof(*eh))) == NULL) {
+                       if_statinc(ifp, if_ierrors);
+                       return;
+               }
        }
 
        eh = mtod(m, struct ether_header *);
@@ -870,7 +872,7 @@
                default:
                        if (subtype == 0 || subtype > 10) {
                                /* illegal value */
-                               goto drop;
+                               goto error;
                        }
                        /* unknown subtype */
                        break;
@@ -895,7 +897,7 @@
                ether_input_llc(ifp, m, eh);
                return;
 #else
-               goto drop;
+               goto error;
 #endif
        }
 
@@ -966,7 +968,7 @@
 
        if (__predict_false(!inq)) {
                /* Should not happen. */
-               goto drop;
+               goto error;
        }
 
        IFQ_ENQUEUE_ISR(inq, m, isr);
@@ -974,8 +976,12 @@
 
 drop:
        m_freem(m);
-dropped:
+       if_statinc(ifp, if_iqdrops); /* XXX should have a dedicated counter? */
+       return;
+error:
+       m_freem(m);
        if_statinc(ifp, if_ierrors); /* XXX should have a dedicated counter? */
+       return;
 }
 
 /*



Home | Main Index | Thread Index | Old Index