Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Simplify; we can assume sav->tdb_xform cannot b...
details: https://anonhg.NetBSD.org/src/rev/c663142aa53a
branches: trunk
changeset: 354962:c663142aa53a
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Jul 06 09:49:46 2017 +0000
description:
Simplify; we can assume sav->tdb_xform cannot be NULL while it's valid
diffstat:
sys/netipsec/ipsec_input.c | 17 +++--------------
sys/netipsec/ipsec_output.c | 11 +++--------
2 files changed, 6 insertions(+), 22 deletions(-)
diffs (70 lines):
diff -r 87d38de304ea -r c663142aa53a sys/netipsec/ipsec_input.c
--- a/sys/netipsec/ipsec_input.c Thu Jul 06 09:49:39 2017 +0000
+++ b/sys/netipsec/ipsec_input.c Thu Jul 06 09:49:46 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_input.c,v 1.45 2017/07/05 03:44:59 ozaki-r Exp $ */
+/* $NetBSD: ipsec_input.c,v 1.46 2017/07/06 09:49:46 ozaki-r Exp $ */
/* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $ */
/* $OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $ */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.45 2017/07/05 03:44:59 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.46 2017/07/06 09:49:46 ozaki-r Exp $");
/*
* IPsec input processing.
@@ -281,18 +281,7 @@
return ENOENT;
}
- if (sav->tdb_xform == NULL) {
- IPSECLOG(LOG_DEBUG,
- "attempted to use uninitialized SA %s/%08lx/%u\n",
- ipsec_address(&dst_address, buf, sizeof(buf)),
- (u_long) ntohl(spi), sproto);
- IPSEC_ISTAT(sproto, ESP_STAT_NOXFORM, AH_STAT_NOXFORM,
- IPCOMP_STAT_NOXFORM);
- KEY_FREESAV(&sav);
- splx(s);
- m_freem(m);
- return ENXIO;
- }
+ KASSERT(sav->tdb_xform != NULL);
/*
* Call appropriate transform and return -- callback takes care of
diff -r 87d38de304ea -r c663142aa53a sys/netipsec/ipsec_output.c
--- a/sys/netipsec/ipsec_output.c Thu Jul 06 09:49:39 2017 +0000
+++ b/sys/netipsec/ipsec_output.c Thu Jul 06 09:49:46 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_output.c,v 1.49 2017/07/04 06:45:05 ozaki-r Exp $ */
+/* $NetBSD: ipsec_output.c,v 1.50 2017/07/06 09:49:46 ozaki-r Exp $ */
/*-
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.49 2017/07/04 06:45:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.50 2017/07/06 09:49:46 ozaki-r Exp $");
/*
* IPsec output processing.
@@ -428,12 +428,7 @@
* Sanity check the SA contents for the caller
* before they invoke the xform output method.
*/
- if (sav->tdb_xform == NULL) {
- IPSECLOG(LOG_DEBUG, "no transform for SA\n");
- IPSEC_OSTAT(NOXFORM);
- *error = EHOSTUNREACH;
- goto bad;
- }
+ KASSERT(sav->tdb_xform != NULL);
return isr;
bad:
KASSERTMSG(*error != 0, "error return w/ no error code");
Home |
Main Index |
Thread Index |
Old Index