summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_decide.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-01-13 13:04:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-01-13 13:04:34 +0000
commit4766c36ded8cac683f5f5ec72fb72b60f5d3b1af (patch)
tree3fedb28577087357610ed439c7a470a3a1aaebb0 /usr.sbin/bgpd/rde_decide.c
parent86b6893b3c3439b7e1cb614235b5c0471c266990 (diff)
Simplify evaluation process. Instead of checking the reachability of a prefix
at many different places do it once. This simplifies the logic and makes it easier to extend it for upcomming Adj-RIB-In addition. OK Henning.
Diffstat (limited to 'usr.sbin/bgpd/rde_decide.c')
-rw-r--r--usr.sbin/bgpd/rde_decide.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index a50b09717f4..e4895538c07 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.44 2006/01/04 12:50:31 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.45 2006/01/13 13:04:33 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -230,7 +230,13 @@ prefix_evaluate(struct prefix *p, struct pt_entry *pte)
}
}
}
+
xp = LIST_FIRST(&pte->prefix_h);
+ if (xp == NULL || (xp->aspath->nexthop != NULL &&
+ xp->aspath->nexthop->state != NEXTHOP_REACH))
+ /* xp is ineligible */
+ xp = NULL;
+
if (pte->active != xp) {
/* need to generate an update */
if (pte->active != NULL)
@@ -246,12 +252,8 @@ prefix_evaluate(struct prefix *p, struct pt_entry *pte)
rde_generate_updates(xp, pte->active);
rde_send_kroute(xp, pte->active);
- if (xp == NULL || (xp->aspath->nexthop != NULL &&
- xp->aspath->nexthop->state != NEXTHOP_REACH))
- pte->active = NULL;
- else {
- pte->active = xp;
- pte->active->aspath->active_cnt++;
- }
+ pte->active = xp;
+ if (xp != NULL)
+ xp->aspath->active_cnt++;
}
}