On Fri, Feb 25, 2022 at 11:15:49AM +0100, Claudio Jeker wrote:
> For add-path send the Adj-RIB-Out needs to handle multiple paths per
> prefix. The Adj-RIB-Out stores the prefixes on RB trees and so extend
> the lookup function to include the path_id (which will be path_id_tx).
> 
> For now the path_id_tx in the Adj-RIB-Out is forced to 0 since
> up_generate_updates() is not ready to handle more than one path per prefix.
> 
> This mainly adjusts the bgpctl interface and the internals. Some functions
> are renamed to start with prefix_adjout_ like all other prefix functions
> opertating on the Adj-RIB-Out.

ok

> +/*
> + * Lookup a prefix without considering path_id in the peer prefix_index.
> + * Returns NULL if not found.
> + */
> +struct prefix *
> +prefix_adjout_lookup(struct rde_peer *peer, struct bgpd_addr *prefix,
> +    int prefixlen)
> +{
> +     struct prefix xp, *np;
> +     struct pt_entry *pte;
> +
> +     memset(&xp, 0, sizeof(xp));
> +     pte = pt_fill(prefix, prefixlen);
> +     xp.pt = pte;

I don't understand the benefit of the pte variable, but other lookup
functions do the same, so I guess it's better to be consistent.

> +
> +     np =  RB_NFIND(prefix_index, &peer->adj_rib_out, &xp);

Two spaces after =

> +     if (np != NULL && pt_prefix_cmp(np->pt, xp.pt) != 0)
> +             return NULL;
> +     return np;
> +}

Reply via email to