Tue Oct 8 18:12:44 2019 UTC ()
Pull up following revision(s) (requested by msaitoh in ticket #1402):

	sys/net/if_ethersubr.c: revision 1.277

Increment if_iqdrops when dropping an oversized frame.


(martin)
diff -r1.242.6.6 -r1.242.6.7 src/sys/net/if_ethersubr.c

cvs diff -r1.242.6.6 -r1.242.6.7 src/sys/net/if_ethersubr.c (expand / switch to unified diff)

--- src/sys/net/if_ethersubr.c 2019/10/08 18:09:41 1.242.6.6
+++ src/sys/net/if_ethersubr.c 2019/10/08 18:12:44 1.242.6.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_ethersubr.c,v 1.242.6.6 2019/10/08 18:09:41 martin Exp $ */ 1/* $NetBSD: if_ethersubr.c,v 1.242.6.7 2019/10/08 18:12:44 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -51,27 +51,27 @@ @@ -51,27 +51,27 @@
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE. 58 * SUCH DAMAGE.
59 * 59 *
60 * @(#)if_ethersubr.c 8.2 (Berkeley) 4/4/96 60 * @(#)if_ethersubr.c 8.2 (Berkeley) 4/4/96
61 */ 61 */
62 62
63#include <sys/cdefs.h> 63#include <sys/cdefs.h>
64__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.6 2019/10/08 18:09:41 martin Exp $"); 64__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.7 2019/10/08 18:12:44 martin Exp $");
65 65
66#ifdef _KERNEL_OPT 66#ifdef _KERNEL_OPT
67#include "opt_inet.h" 67#include "opt_inet.h"
68#include "opt_atalk.h" 68#include "opt_atalk.h"
69#include "opt_mbuftrace.h" 69#include "opt_mbuftrace.h"
70#include "opt_mpls.h" 70#include "opt_mpls.h"
71#include "opt_gateway.h" 71#include "opt_gateway.h"
72#include "opt_pppoe.h" 72#include "opt_pppoe.h"
73#include "opt_net_mpsafe.h" 73#include "opt_net_mpsafe.h"
74#endif 74#endif
75 75
76#include "vlan.h" 76#include "vlan.h"
77#include "pppoe.h" 77#include "pppoe.h"
@@ -593,26 +593,27 @@ ether_input(struct ifnet *ifp, struct mb @@ -593,26 +593,27 @@ ether_input(struct ifnet *ifp, struct mb
593 593
594 /* 594 /*
595 * Determine if the packet is within its size limits. 595 * Determine if the packet is within its size limits.
596 */ 596 */
597 if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len > 597 if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len >
598 ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) { 598 ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) {
599 mutex_enter(&bigpktpps_lock); 599 mutex_enter(&bigpktpps_lock);
600 if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count, 600 if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count,
601 bigpktppslim)) { 601 bigpktppslim)) {
602 printf("%s: discarding oversize frame (len=%d)\n", 602 printf("%s: discarding oversize frame (len=%d)\n",
603 ifp->if_xname, m->m_pkthdr.len); 603 ifp->if_xname, m->m_pkthdr.len);
604 } 604 }
605 mutex_exit(&bigpktpps_lock); 605 mutex_exit(&bigpktpps_lock);
 606 ifp->if_iqdrops++;
606 m_freem(m); 607 m_freem(m);
607 return; 608 return;
608 } 609 }
609 610
610 if (ETHER_IS_MULTICAST(eh->ether_dhost)) { 611 if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
611 /* 612 /*
612 * If this is not a simplex interface, drop the packet 613 * If this is not a simplex interface, drop the packet
613 * if it came from us. 614 * if it came from us.
614 */ 615 */
615 if ((ifp->if_flags & IFF_SIMPLEX) == 0 && 616 if ((ifp->if_flags & IFF_SIMPLEX) == 0 &&
616 memcmp(CLLADDR(ifp->if_sadl), eh->ether_shost, 617 memcmp(CLLADDR(ifp->if_sadl), eh->ether_shost,
617 ETHER_ADDR_LEN) == 0) { 618 ETHER_ADDR_LEN) == 0) {
618 m_freem(m); 619 m_freem(m);