diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-05-12 20:53:03 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-05-12 20:53:03 +0000 |
commit | cb048ebcc85f52653f534dc0c4da9c14beb30bc4 (patch) | |
tree | 6a75761fb7d6e5b57091d0530ead7e8085462be3 /usr.sbin | |
parent | e22861f3593055ad845fb9a68f28a02921ab4a73 (diff) |
lsa_age() the vertex befor comparing the age with MAX_AGE.
Move a common check (cost == LS_INFINITY) out of the switch cases.
OK norby@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospfd/rde_spf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c index bd03a9597ff..76d028ee2ab 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.11 2005/05/12 19:32:46 claudio Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.12 2005/05/12 20:53:02 claudio Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -218,14 +218,15 @@ spf_calc(struct area *area) /* calculate route table */ RB_FOREACH(v, lsa_tree, tree) { - if (ntohs(v->lsa->hdr.age) == MAX_AGE) + lsa_age(v); + if (ntohs(v->lsa->hdr.age) == MAX_AGE || + v->cost == LS_INFINITY) continue; switch (v->type) { case LSA_TYPE_ROUTER: /* stub networks */ - if ((v->cost == LS_INFINITY) || - (v->nexthop.s_addr == 0)) + if (v->nexthop.s_addr == 0) continue; for (i = 0; i < lsa_num_links(v); i++) { @@ -250,8 +251,7 @@ spf_calc(struct area *area) adv_rtr, PT_INTRA_AREA, DT_RTR); break; case LSA_TYPE_NETWORK: - if ((v->cost == LS_INFINITY) || - (v->nexthop.s_addr == 0)) + if (v->nexthop.s_addr == 0) continue; addr.s_addr = htonl(v->ls_id) & v->lsa->data.net.mask; |