On Fri, Feb 25, 2022 at 12:41:56PM +0100, Claudio Jeker wrote:
> On Fri, Feb 25, 2022 at 11:55:08AM +0100, Theo Buehler wrote:
> > 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.
> 
> How about this diff that removes this extra variable?

I think that reads better.

ok

> pt_fill() is a nasty function since it returns a pointer to some static
> memory.

Indeed.

Reply via email to