Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by msait...



details:   https://anonhg.NetBSD.org/src/rev/8984b76d33bc
branches:  netbsd-8
changeset: 371824:8984b76d33bc
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Oct 10 16:09:12 2022 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1770):

        sys/net/if_ethersubr.c: revision 1.254

Fix a bug in the VLAN path: there's an inverted logic, the mbuf needs to
be bigger than struct ether_vlan_header, not smaller.

Meanwhile add a KASSERT in the LLC path.

diffstat:

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

diffs (55 lines):

diff -r fe1ec89782da -r 8984b76d33bc sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Mon Oct 10 15:11:45 2022 +0000
+++ b/sys/net/if_ethersubr.c    Mon Oct 10 16:09:12 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.242.6.9 2021/10/27 18:52:51 martin Exp $    */
+/*     $NetBSD: if_ethersubr.c,v 1.242.6.10 2022/10/10 16:09:12 martin 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.242.6.9 2021/10/27 18:52:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.10 2022/10/10 16:09:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -706,7 +706,7 @@
                 * just being used to store the priority.  Extract the ether
                 * type, and if IP or IPV6, let them deal with it.
                 */
-               if (m->m_len <= sizeof(*evl)
+               if (m->m_len >= sizeof(*evl)
                    && EVL_VLANOFTAG((ntohs(evl->evl_tag))) == 0) {
                        etype = ntohs(evl->evl_proto);
                        ehlen = sizeof(*evl);
@@ -841,11 +841,13 @@
                        return;
                }
        } else {
+               KASSERT(ehlen == sizeof(*eh));
 #if defined (LLC) || defined (NETATALK)
-               if (m->m_len < ehlen + sizeof(struct llc)) {
+               if (m->m_len < sizeof(*eh) + sizeof(struct llc)) {
                        goto dropanyway;
                }
                l = (struct llc *)(eh+1);
+
                switch (l->llc_dsap) {
 #ifdef NETATALK
                case LLC_SNAP_LSAP:
@@ -871,10 +873,10 @@
                                    sizeof(aarp_org_code)) == 0 &&
                                    ntohs(l->llc_snap_ether_type) ==
                                    ETHERTYPE_AARP) {
-                                       m_adj( m, sizeof(struct ether_header)
+                                       m_adj(m, sizeof(struct ether_header)
                                            + sizeof(struct llc));
                                        aarpinput(ifp, m); /* XXX */
-                                   return;
+                                       return;
                                }
 
                        default:



Home | Main Index | Thread Index | Old Index