On Thu, Jan 14, 2021 at 08:22:45PM +0100, Denis Fondras wrote:
> Le Tue, Jan 12, 2021 at 10:06:46AM +0100, Claudio Jeker a écrit :
> > On Tue, Jan 05, 2021 at 11:17:22AM +0100, Claudio Jeker wrote:
> > > While changing log_addr() I noticed that struct bgpd_addr could benefit
> > > from changing the encoding of AID_VPN_IPv4 and AID_VPN_IPv6 addrs.
> > > Instead of having independent route distinguishers and labelstacks use
> > > common fields for those and use the v4 and v6 addresses for the prefix.
> > > This is a bit more compact but also simplifies some code since the
> > > handling of AID_VPN_IPv4 and AID_VPN_IPv6 can be handled in the same
> > > switch case.
> > > 
> > > I reduced the labelstack size from 21 to 18 (6 instead of 7 labels). Now
> > > in theory you could pack 7 labels into an IPv4 VPN NLRI (8bit prefixlen +
> > > 64bit RD + 16bit prefix + 21 * 8bit label = 256) but that is quite silly.
> > > Even 6 labels is more than enough. bgpd itself only allows a single MPLS
> > > label when announcing such networks.
> > 
> > Ping
> >  
> > Index: bgpd/util.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/bgpd/util.c,v
> > retrieving revision 1.58
> > diff -u -p -r1.58 util.c
> > --- bgpd/util.c     5 Jan 2021 10:00:28 -0000       1.58
> > +++ bgpd/util.c     5 Jan 2021 10:05:15 -0000
> > @@ -666,9 +669,17 @@ prefix_compare(const struct bgpd_addr *a
> >             mask = htonl(prefixlen2mask(prefixlen));
> >             aa = ntohl(a->v4.s_addr & mask);
> >             ba = ntohl(b->v4.s_addr & mask);
> > -           if (aa != ba)
> > -                   return (aa - ba);
> > -           return (0);
> > +           if (aa > ba)
> > +                   return (1);
> > +           if (aa < ba)
> > +                   return (1);
> 
> I guess it is -1 here.
> 
> Otherwise OK denis@

Thanks for spotting this glitch. That would have caused some havoc for
sure. 

-- 
:wq Claudio

Reply via email to