diff options
Diffstat (limited to 'usr.sbin/bgpd/rde_decide.c')
-rw-r--r-- | usr.sbin/bgpd/rde_decide.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 384e5e20a10..8060225d6e4 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.6 2003/12/26 19:28:52 henning Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.7 2003/12/26 22:41:01 henning Exp $ */ /* * Copyright (c) 2003 Claudio Jeker <claudio@openbsd.org> @@ -120,9 +120,13 @@ prefix_cmp(struct prefix *p1, struct prefix *p2) asp1 = p1->aspath; asp2 = p2->aspath; /* 1. check if prefix is eligible a.k.a reachable */ - if (asp2->state != NEXTHOP_REACH) + if (asp2->nexthop == NULL) return (1); - if (asp1->state != NEXTHOP_REACH) + if (asp1->nexthop == NULL) + return (-1); + if (asp2->nexthop->state != NEXTHOP_REACH) + return (1); + if (asp1->nexthop->state != NEXTHOP_REACH) return (-1); /* 2. preference of prefix, bigger is better */ @@ -211,10 +215,13 @@ prefix_evaluate(struct prefix *p, struct pt_entry *pte) * do not send an update if the only available path * has an unreachable nexthop */ - if (!(xp != NULL && xp->aspath->state != NEXTHOP_REACH)) + + if (!(xp != NULL && xp->aspath->nexthop != NULL && + xp->aspath->nexthop->state != NEXTHOP_REACH)) rde_send_kroute(xp, pte->active); - if (xp == NULL || xp->aspath->state != NEXTHOP_REACH) + if (xp == NULL || xp->aspath->nexthop == NULL || + xp->aspath->nexthop->state != NEXTHOP_REACH) pte->active = NULL; else { pte->active = xp; |