Source-Changes-HG archive

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

[src/trunk]: src/sys/net rate limit the printfs for oversized ethernet packets.



details:   https://anonhg.NetBSD.org/src/rev/95327fb40772
branches:  trunk
changeset: 580663:95327fb40772
user:      matt <matt%NetBSD.org@localhost>
date:      Mon May 02 21:20:27 2005 +0000

description:
rate limit the printfs for oversized ethernet packets.

diffstat:

 sys/net/if_ethersubr.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 351f1909169b -r 95327fb40772 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Mon May 02 16:02:43 2005 +0000
+++ b/sys/net/if_ethersubr.c    Mon May 02 21:20:27 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.122 2005/03/31 15:48:13 christos Exp $      */
+/*     $NetBSD: if_ethersubr.c,v 1.123 2005/05/02 21:20:27 matt 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.122 2005/03/31 15:48:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.123 2005/05/02 21:20:27 matt Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -183,6 +183,11 @@
 extern u_char  aarp_org_code[3];
 #endif /* NETATALK */
 
+static struct timeval bigpktppslim_last;
+static int bigpktppslim = 2;   /* XXX */
+static int bigpktpps_count;
+
+
 const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN] =
     { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 const uint8_t ethermulticastaddr_slowprotocols[ETHER_ADDR_LEN] =
@@ -672,8 +677,11 @@
         */
        if (m->m_pkthdr.len >
            ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) {
-               printf("%s: discarding oversize frame (len=%d)\n",
-                   ifp->if_xname, m->m_pkthdr.len);
+               if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count,
+                           bigpktppslim)) {
+                       printf("%s: discarding oversize frame (len=%d)\n",
+                           ifp->if_xname, m->m_pkthdr.len);
+               }
                m_freem(m);
                return;
        }



Home | Main Index | Thread Index | Old Index