Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Destroy sav only in the loop for DEAD sav
details: https://anonhg.NetBSD.org/src/rev/e53d161b92e5
branches: trunk
changeset: 355656:e53d161b92e5
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Aug 08 08:24:34 2017 +0000
description:
Destroy sav only in the loop for DEAD sav
diffstat:
sys/netipsec/key.c | 26 ++++++--------------------
1 files changed, 6 insertions(+), 20 deletions(-)
diffs (74 lines):
diff -r 01b92bf769e7 -r e53d161b92e5 sys/netipsec/key.c
--- a/sys/netipsec/key.c Tue Aug 08 08:23:10 2017 +0000
+++ b/sys/netipsec/key.c Tue Aug 08 08:24:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.217 2017/08/08 08:23:10 ozaki-r Exp $ */
+/* $NetBSD: key.c,v 1.218 2017/08/08 08:24:34 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.217 2017/08/08 08:23:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.218 2017/08/08 08:24:34 ozaki-r Exp $");
/*
* This code is referd to RFC 2367
@@ -4719,7 +4719,7 @@
restart_sav_LARVAL:
SAVLIST_READER_FOREACH(sav, sah, SADB_SASTATE_LARVAL) {
if (now - sav->created > key_larval_lifetime) {
- KEY_FREESAV(&sav);
+ key_sa_chgstate(sav, SADB_SASTATE_DEAD);
goto restart_sav_LARVAL;
}
}
@@ -4746,7 +4746,6 @@
*/
if (sav->lft_c->sadb_lifetime_usetime == 0) {
key_sa_chgstate(sav, SADB_SASTATE_DEAD);
- KEY_FREESAV(&sav);
} else {
key_sa_chgstate(sav, SADB_SASTATE_DYING);
/*
@@ -4792,7 +4791,6 @@
if (sav->lft_h->sadb_lifetime_addtime != 0 &&
now - sav->created > sav->lft_h->sadb_lifetime_addtime) {
key_sa_chgstate(sav, SADB_SASTATE_DEAD);
- KEY_FREESAV(&sav);
goto restart_sav_DYING;
}
#if 0 /* XXX Should we keep to send expire message until HARD lifetime ? */
@@ -4816,27 +4814,15 @@
sav->lft_h->sadb_lifetime_bytes <
sav->lft_c->sadb_lifetime_bytes) {
key_sa_chgstate(sav, SADB_SASTATE_DEAD);
- KEY_FREESAV(&sav);
goto restart_sav_DYING;
}
}
/* delete entry in DEAD */
+ restart_sav_DEAD:
SAVLIST_READER_FOREACH(sav, sah, SADB_SASTATE_DEAD) {
- /* sanity check */
- if (sav->state != SADB_SASTATE_DEAD) {
- IPSECLOG(LOG_DEBUG,
- "invalid sav->state (queue: %d SA: %d): "
- "kill it anyway\n",
- SADB_SASTATE_DEAD, sav->state);
- }
-
- /*
- * do not call key_freesav() here.
- * sav should already be freed, and sav->refcnt
- * shows other references to sav
- * (such as from SPD).
- */
+ KEY_FREESAV(&sav);
+ goto restart_sav_DEAD;
}
s = pserialize_read_enter();
Home |
Main Index |
Thread Index |
Old Index