You are correct.  I missed the else if on the first look at the code.

donald

On Fri, May 22, 2015 at 8:14 AM, Timo Teras <[email protected]> wrote:

> On Fri, 22 May 2015 07:54:08 -0700
> Donald Sharp <[email protected]> wrote:
>
> > >
> > >
> > > -      if (is_default (p))
> > > -        {
> > > -          if (client->redist_default || client->redist[rib->type])
> > > -            {
> > > -              if (p->family == AF_INET)
> > > -                zsend_route_multipath (ZEBRA_IPV4_ROUTE_ADD,
> > > client, p, rib);
> > > -#ifdef HAVE_IPV6
> > > -              if (p->family == AF_INET6)
> > > -                zsend_route_multipath (ZEBRA_IPV6_ROUTE_ADD,
> > > client, p, rib);
> > > -#endif /* HAVE_IPV6 */
> > > -           }
> > > -        }
> > > -      else if (client->redist[rib->type])
> > > +      if ((is_default (p) && client->redist_default)
> > > +          || client->redist[rib->type])
> > >
> >
> > Shouldn't this be:
> >
> > if ( (is_default (p) && ( client->redist_default ||
> > cclient->redist[rib->type]))
>
> Certainly not this. Otherwise only default route would ever by
> announced out.
>
> > ....
> >
> > The comment stands for both changes
>
> I think my code is right.
>
> The original code is:
> if (is_default (p)) {
>         if (client->redist_default || client->redist[rib->type])
> } else if (client->redist[rib->type])
>
> Which is equivalent of:
> (is_default (p) && (client->redist_default || client->redist[rib->type]) )
> || (client->redist[rib->type])
>
> This simplifies to:
> (is_default (p) && client->redist_default) || client->redist[rib->type]
>
> Or you see a flaw in this logic?
>
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to