summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2004-04-07 20:04:35 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2004-04-07 20:04:35 +0000
commitdc49df34a5b711a13a375fc29635991abdb9466f (patch)
treee92e327102d20d874768d03e9685cd0725d77ba7 /sbin
parent7de22ca021b6171fb17b56b6ac97fa283250b005 (diff)
More careful when walking LIST queues. hshoexer@, david@ ok.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/sa.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/sbin/isakmpd/sa.c b/sbin/isakmpd/sa.c
index 7e1c60f580c..6011ffb4e70 100644
--- a/sbin/isakmpd/sa.c
+++ b/sbin/isakmpd/sa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sa.c,v 1.77 2004/03/19 14:04:43 hshoexer Exp $ */
+/* $OpenBSD: sa.c,v 1.78 2004/04/07 20:04:34 ho Exp $ */
/* $EOM: sa.c,v 1.112 2000/12/12 00:22:52 niklas Exp $ */
/*
@@ -1093,20 +1093,23 @@ void
sa_teardown_all (void)
{
int i;
- struct sa *sa;
+ struct sa *sa, *next = 0;
LOG_DBG ((LOG_SA, 70, "sa_teardown_all:"));
/* Get Phase 2 SAs. */
for (i = 0; i <= bucket_mask; i++)
- for (sa = LIST_FIRST (&sa_tab[i]); sa; sa = LIST_NEXT (sa, link))
- if (sa->phase == 2)
- {
- /* Teardown the phase 2 SAs by name, similar to ui_teardown. */
- LOG_DBG ((LOG_SA, 70, "sa_teardown_all: tearing down SA %s",
- sa->name));
- connection_teardown (sa->name);
- sa_delete (sa, 1);
- }
+ for (sa = LIST_FIRST (&sa_tab[i]); sa; sa = next)
+ {
+ next = LIST_NEXT (sa, link);
+ if (sa->phase == 2)
+ {
+ /* Teardown the phase 2 SAs by name, similar to ui_teardown. */
+ LOG_DBG ((LOG_SA, 70, "sa_teardown_all: tearing down SA %s",
+ sa->name));
+ connection_teardown (sa->name);
+ sa_delete (sa, 1);
+ }
+ }
}
/*