Source-Changes-HG archive

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

[src/trunk]: src/sys/net Make an mbuf writable before un-tagging



details:   https://anonhg.NetBSD.org/src/rev/8d29f6bfa00d
branches:  trunk
changeset: 984616:8d29f6bfa00d
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Wed Jul 14 06:23:06 2021 +0000

description:
Make an mbuf writable before un-tagging

diffstat:

 sys/net/if_vlan.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 8ac24181d673 -r 8d29f6bfa00d sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Wed Jul 14 03:22:33 2021 +0000
+++ b/sys/net/if_vlan.c Wed Jul 14 06:23:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.157 2021/07/06 02:39:46 yamaguchi Exp $  */
+/*     $NetBSD: if_vlan.c,v 1.158 2021/07/14 06:23:06 yamaguchi Exp $  */
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.157 2021/07/06 02:39:46 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.158 2021/07/14 06:23:06 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1622,6 +1622,14 @@
                            "dropping packet.\n", ifp->if_xname);
                        return;
                }
+
+               if (m_makewritable(&m, 0,
+                   sizeof(struct ether_vlan_header), M_DONTWAIT)) {
+                       m_freem(m);
+                       if_statinc(ifp, if_ierrors);
+                       return;
+               }
+
                evl = mtod(m, struct ether_vlan_header *);
                KASSERT(ntohs(evl->evl_encap_proto) == ETHERTYPE_VLAN);
 



Home | Main Index | Thread Index | Old Index