diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-26 22:41:02 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-26 22:41:02 +0000 |
commit | d578327e7c891a81541e79b491e8b85fdd9fbe49 (patch) | |
tree | a9f6021a13a3a2b41df6725919437e4970c903c1 /usr.sbin/bgpd/rde_decide.c | |
parent | 9c2ef8c102fc0af3c64645075803c73254270d08 (diff) |
"when you try to be very smart, something breaks horribly"
zap aspath->state, which was a copy of aspath->nexthop->state, for a tiny
little bit faster access. tho, it happened what had to happen, they ran
out of sync.
it's just not worth it.
also add a missinf LIST_INIT.
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; |