Source-Changes-HG archive

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

src: Pull up following revision(s) (requested by knakahara in ti...



details:   https://anonhg.NetBSD.org/src/rev/edd14d2bbdab
branches:  netbsd-8
changeset: 317947:edd14d2bbdab
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Apr 09 13:40:20 2018 +0000
description:
Pull up following revision(s) (requested by knakahara in ticket #725):
        sys/net/if_l2tp.c: revision 1.21
Fix l2tp(4) alignment check. Pointed out and reviewed by k-goda@IIJ.
The alignment check should be done for the address of m_data instead of
the value of m_data.
XXX pullup-8

diffstat:

 sys/net/if_l2tp.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r 45f1dbd52832 -r edd14d2bbdab sys/net/if_l2tp.c
--- a/sys/net/if_l2tp.c Mon Apr 09 13:36:36 2018 +0000
+++ b/sys/net/if_l2tp.c Mon Apr 09 13:40:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_l2tp.c,v 1.11.2.5 2018/03/08 13:41:40 martin Exp $  */
+/*     $NetBSD: if_l2tp.c,v 1.11.2.6 2018/04/09 13:40:20 bouyer Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11.2.5 2018/03/08 13:41:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11.2.6 2018/04/09 13:40:20 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -465,18 +465,20 @@
 void
 l2tp_input(struct mbuf *m, struct ifnet *ifp)
 {
-       u_long val;
+       vaddr_t addr;
 
        KASSERT(ifp != NULL);
 
-       if (m->m_pkthdr.len < sizeof(val)) {
+       /*
+        * Currently, l2tp(4) supports only ethernet as inner protocol.
+        */
+       if (m->m_pkthdr.len < sizeof(struct ether_header)) {
                m_freem(m);
                return;
        }
 
-       m_copydata(m, 0, sizeof(val), &val);
-
-       if ((val & 0x03) == 0) {
+       addr = mtod(m, vaddr_t);
+       if ((addr & 0x03) == 0) {
                /* copy and align head of payload */
                struct mbuf *m_head;
                int copy_length;



Home | Main Index | Thread Index | Old Index