Module Name: src
Committed By: bouyer
Date: Mon Apr 9 13:40:21 UTC 2018
Modified Files:
src/sys/net [netbsd-8]: if_l2tp.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.11.2.5 -r1.11.2.6 src/sys/net/if_l2tp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.11.2.5 src/sys/net/if_l2tp.c:1.11.2.6
--- src/sys/net/if_l2tp.c:1.11.2.5 Thu Mar 8 13:41:40 2018
+++ src/sys/net/if_l2tp.c Mon Apr 9 13:40:20 2018
@@ -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 @@ l2tpintr(struct l2tp_variant *var)
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;