Le Tue, Jan 12, 2021 at 05:39:02PM +0100, Claudio Jeker a écrit :
> This diff changes two things:
> - First, it move the kroute update into rde_generate_updates() simplifying
> prefix_evaluate a little bit.
>
> - Second, it changes prefix_evaluate to take an additional argument for the
> old prefix (to be removed). Instead of doing this outside of
> prefix_evaluate() with some drawbacks in case the same prefix is removed
> and readded, the code is now in prefix_evaluate() and does all the magic
> itself.
>
> Index: rde_decide.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rde_decide.c,v
> retrieving revision 1.78
> diff -u -p -r1.78 rde_decide.c
> --- rde_decide.c 9 Aug 2019 13:44:27 -0000 1.78
> +++ rde_decide.c 12 Jan 2021 16:24:36 -0000
> @@ -238,14 +238,16 @@ prefix_cmp(struct prefix *p1, struct pre
> * The to evaluate prefix must not be in the prefix list.
> */
> void
> -prefix_evaluate(struct prefix *p, struct rib_entry *re)
> +prefix_evaluate(struct rib_entry *re, struct prefix *new, struct prefix *old)
> {
> struct prefix *xp;
>
> if (re_rib(re)->flags & F_RIB_NOEVALUATE) {
> /* decision process is turned off */
> - if (p != NULL)
> - LIST_INSERT_HEAD(&re->prefix_h, p, entry.list.rib);
> + if (old != NULL)
> + LIST_REMOVE(old, entry.list.rib);
> + if (new != NULL)
> + LIST_INSERT_HEAD(&re->prefix_h, new, entry.list.rib);
Would it be beneficial to have a p == new test ?
Otherwise OK denis@