Simplify; we can assume sav->tdb_xform cannot be NULL while it's valid
This commit is contained in:
parent
810e1e7da1
commit
765c1e87d3
@ -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 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto)
|
||||
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
|
||||
|
@ -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 @@ again:
|
||||
* 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");
|
||||
|
Loading…
Reference in New Issue
Block a user