diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-11-04 14:37:27 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-11-04 14:37:27 +0000 |
commit | c96b067bad956cd3d146bfabcb4cd917e897769e (patch) | |
tree | bb6f0f57153ef1c29cbc88b706a85c0501f8e08d /usr.sbin/ospfd | |
parent | ccb66f890b4ae92d509515596a7983c248852ad1 (diff) |
The candidate list is a sorted linear list so when changing the cost of
a vertex that is already a candidate it is necessary to remove and insert
the candidate otherwise the candidate list is no longer correctly sorted.
OK norby@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r-- | usr.sbin/ospfd/rde_spf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c index 53149a97d81..6a7b40c5e81 100644 --- a/usr.sbin/ospfd/rde_spf.c +++ b/usr.sbin/ospfd/rde_spf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_spf.c,v 1.34 2005/11/04 10:46:23 claudio Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.35 2005/11/04 14:37:26 claudio Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -174,15 +174,18 @@ spf_calc(struct area *area) w->cost = d; w->prev = v; calc_next_hop(w, v); + /* + * need to readd to candidate list + * because the list is sorted + */ + TAILQ_REMOVE(&cand_list, w, cand); } } else if (w->cost == LS_INFINITY && d < LS_INFINITY) { w->cost = d; - - cand_list_add(w); w->prev = v; - calc_next_hop(w, v); } + cand_list_add(w); } /* cand_list_dump(); */ |