Module Name:    src
Committed By:   knakahara
Date:           Mon Dec 18 03:20:13 UTC 2017

Modified Files:
        src/sys/netinet: in_l2tp.c
        src/sys/netinet6: in6_l2tp.c

Log Message:
backout wrong fix again, sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netinet6/in6_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/netinet/in_l2tp.c
diff -u src/sys/netinet/in_l2tp.c:1.7 src/sys/netinet/in_l2tp.c:1.8
--- src/sys/netinet/in_l2tp.c:1.7	Fri Dec 15 05:01:16 2017
+++ src/sys/netinet/in_l2tp.c	Mon Dec 18 03:20:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_l2tp.c,v 1.7 2017/12/15 05:01:16 knakahara Exp $	*/
+/*	$NetBSD: in_l2tp.c,v 1.8 2017/12/18 03:20:12 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.7 2017/12/15 05:01:16 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.8 2017/12/18 03:20:12 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -369,10 +369,12 @@ in_l2tp_match(struct mbuf *m, int off, i
 	KASSERT(proto == IPPROTO_L2TP);
 
 	if (m->m_len < off + sizeof(uint32_t)) {
-		/* if payload length < 4 octets */
-		if(!m_ensure_contig(&m, off + sizeof(uint32_t)))
+		m = m_pullup(m, off + sizeof(uint32_t));
+		if (!m) {
+			/* if payload length < 4 octets */
 			return 0;
-	}
+		}
+        }
 
 	/* get L2TP session ID */
 	m_copydata(m, off, sizeof(uint32_t), (void *)&sess_id);

Index: src/sys/netinet6/in6_l2tp.c
diff -u src/sys/netinet6/in6_l2tp.c:1.10 src/sys/netinet6/in6_l2tp.c:1.11
--- src/sys/netinet6/in6_l2tp.c:1.10	Fri Dec 15 05:01:16 2017
+++ src/sys/netinet6/in6_l2tp.c	Mon Dec 18 03:20:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_l2tp.c,v 1.10 2017/12/15 05:01:16 knakahara Exp $	*/
+/*	$NetBSD: in6_l2tp.c,v 1.11 2017/12/18 03:20:13 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.10 2017/12/15 05:01:16 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.11 2017/12/18 03:20:13 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -361,10 +361,12 @@ in6_l2tp_match(struct mbuf *m, int off, 
 	KASSERT(proto == IPPROTO_L2TP);
 
 	if (m->m_len < off + sizeof(uint32_t)) {
-		/* if payload length < 4 octets */
-		if(!m_ensure_contig(&m, off + sizeof(uint32_t)))
+		m = m_pullup(m, off + sizeof(uint32_t));
+		if (!m) {
+			/* if payload length < 4 octets */
 			return 0;
-	}
+		}
+        }
 
 	/* get L2TP session ID */
 	m_copydata(m, off, sizeof(uint32_t), (void *)&sess_id);

Reply via email to