Module Name:    src
Committed By:   maxv
Date:           Tue May  1 08:27:13 UTC 2018

Modified Files:
        src/sys/netipsec: xform_ah.c xform_esp.c

Log Message:
When IP6_EXTHDR_GET fails, return ENOBUFS, and don't log an error (HDROPS
is not supposed to be used here).


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.84 -r1.85 src/sys/netipsec/xform_esp.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/netipsec/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.96 src/sys/netipsec/xform_ah.c:1.97
--- src/sys/netipsec/xform_ah.c:1.96	Tue May  1 08:16:34 2018
+++ src/sys/netipsec/xform_ah.c	Tue May  1 08:27:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.96 2018/05/01 08:16:34 maxv Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.97 2018/05/01 08:27:13 maxv Exp $	*/
 /*	$FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.96 2018/05/01 08:16:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.97 2018/05/01 08:27:13 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -532,10 +532,8 @@ ah_input(struct mbuf *m, struct secasvar
 	/* XXX don't pullup, just copy header */
 	IP6_EXTHDR_GET(ah, struct newah *, m, skip, rplen);
 	if (ah == NULL) {
-		DPRINTF(("%s: cannot pullup header\n", __func__));
-		error = ENOBUFS;
-		stat = AH_STAT_HDROPS;	/*XXX*/
-		goto bad;
+		/* m already freed */
+		return ENOBUFS;
 	}
 
 	nxt = ah->ah_nxt;

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.84 src/sys/netipsec/xform_esp.c:1.85
--- src/sys/netipsec/xform_esp.c:1.84	Tue May  1 08:16:34 2018
+++ src/sys/netipsec/xform_esp.c	Tue May  1 08:27:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.84 2018/05/01 08:16:34 maxv Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.85 2018/05/01 08:27:13 maxv Exp $	*/
 /*	$FreeBSD: xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.84 2018/05/01 08:16:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.85 2018/05/01 08:27:13 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -312,7 +312,7 @@ esp_input(struct mbuf *m, struct secasva
 	IP6_EXTHDR_GET(esp, struct newesp *, m, skip, sizeof(struct newesp));
 	if (esp == NULL) {
 		/* m already freed */
-		return EINVAL;
+		return ENOBUFS;
 	}
 
 	esph = sav->tdb_authalgxform;

Reply via email to