-/* $OpenBSD: rde_decide.c,v 1.101 2023/03/13 16:52:42 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.102 2023/10/12 14:22:08 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
* to be passed on (not only a change of the best prefix).
* rde_generate_updates() will then take care of distribution.
*/
- if (rde_evaluate_all())
- if ((new != NULL && prefix_eligible(new)) || old != NULL)
+ if (rde_evaluate_all()) {
+ if (new != NULL && !prefix_eligible(new))
+ new = NULL;
+ if (new != NULL || old != NULL)
rde_generate_updates(re, new, old, EVAL_ALL);
+ }
}
void
enum nexthop_state oldstate)
{
struct rib_entry *re = prefix_re(p);
- struct prefix *newbest, *oldbest;
+ struct prefix *newbest, *oldbest, *new, *old;
struct rib *rib;
/* Skip non local-RIBs or RIBs that are flagged as noeval. */
* Re-evaluate the prefix by removing the prefix then updating the
* nexthop state and reinserting the prefix again.
*/
+ old = p;
oldbest = prefix_best(re);
prefix_remove(p, re);
prefix_insert(p, NULL, re);
newbest = prefix_best(re);
+ new = p;
+ if (!prefix_eligible(new))
+ new = NULL;
/*
* If the active prefix changed or the active prefix was removed
*/
if ((rib->flags & F_RIB_NOFIB) == 0)
rde_send_kroute(rib, newbest, oldbest);
- rde_generate_updates(re, p, p, EVAL_DEFAULT);
+ rde_generate_updates(re, new, old, EVAL_DEFAULT);
return;
}
* rde_generate_updates() will then take care of distribution.
*/
if (rde_evaluate_all())
- rde_generate_updates(re, p, p, EVAL_ALL);
+ rde_generate_updates(re, new, old, EVAL_ALL);
}