summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorho <ho@openbsd.org>2004-04-07 20:04:34 +0000
committerho <ho@openbsd.org>2004-04-07 20:04:34 +0000
commit2cedb9dbf7983895fe00acdb4e769e7bd31dab7b (patch)
tree5a289c609d931d27279a3b2c01a9c4244d2a437c
parentrepair ntpd_flags; from Jeff Ito <jeffi@rcn.com> (diff)
downloadwireguard-openbsd-2cedb9dbf7983895fe00acdb4e769e7bd31dab7b.tar.xz
wireguard-openbsd-2cedb9dbf7983895fe00acdb4e769e7bd31dab7b.zip
More careful when walking LIST queues. hshoexer@, david@ ok.
-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);
+ }
+ }
}
/*