| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_ethersubr.c,v 1.276 2019/07/17 03:26:24 msaitoh Exp $ */ | | 1 | /* $NetBSD: if_ethersubr.c,v 1.277 2019/10/01 08:13:16 msaitoh 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.276 2019/07/17 03:26:24 msaitoh Exp $"); | | 64 | __KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.277 2019/10/01 08:13:16 msaitoh 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" |
| @@ -609,26 +609,27 @@ ether_input(struct ifnet *ifp, struct mb | | | @@ -609,26 +609,27 @@ ether_input(struct ifnet *ifp, struct mb |
609 | /* | | 609 | /* |
610 | * Determine if the packet is within its size limits. For MPLS the | | 610 | * Determine if the packet is within its size limits. For MPLS the |
611 | * header length is variable, so we skip the check. | | 611 | * header length is variable, so we skip the check. |
612 | */ | | 612 | */ |
613 | if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len > | | 613 | if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len > |
614 | ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) { | | 614 | ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) { |
615 | mutex_enter(&bigpktpps_lock); | | 615 | mutex_enter(&bigpktpps_lock); |
616 | if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count, | | 616 | if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count, |
617 | bigpktppslim)) { | | 617 | bigpktppslim)) { |
618 | printf("%s: discarding oversize frame (len=%d)\n", | | 618 | printf("%s: discarding oversize frame (len=%d)\n", |
619 | ifp->if_xname, m->m_pkthdr.len); | | 619 | ifp->if_xname, m->m_pkthdr.len); |
620 | } | | 620 | } |
621 | mutex_exit(&bigpktpps_lock); | | 621 | mutex_exit(&bigpktpps_lock); |
| | | 622 | ifp->if_iqdrops++; |
622 | m_freem(m); | | 623 | m_freem(m); |
623 | return; | | 624 | return; |
624 | } | | 625 | } |
625 | | | 626 | |
626 | if (ETHER_IS_MULTICAST(eh->ether_dhost)) { | | 627 | if (ETHER_IS_MULTICAST(eh->ether_dhost)) { |
627 | /* | | 628 | /* |
628 | * If this is not a simplex interface, drop the packet | | 629 | * If this is not a simplex interface, drop the packet |
629 | * if it came from us. | | 630 | * if it came from us. |
630 | */ | | 631 | */ |
631 | if ((ifp->if_flags & IFF_SIMPLEX) == 0 && | | 632 | if ((ifp->if_flags & IFF_SIMPLEX) == 0 && |
632 | memcmp(CLLADDR(ifp->if_sadl), eh->ether_shost, | | 633 | memcmp(CLLADDR(ifp->if_sadl), eh->ether_shost, |
633 | ETHER_ADDR_LEN) == 0) { | | 634 | ETHER_ADDR_LEN) == 0) { |
634 | m_freem(m); | | 635 | m_freem(m); |