[quagga-dev 8163] Re: [PATCH] Zebra zserv: bogus conditional

Joakim Tjernlund joakim.tjernlund at transmode.se
Thu Aug 19 08:30:44 BST 2010


>
> On Wed, 18 Aug 2010 20:54:30 -0400
> Greg Troxel <gdt at ir.bbn.com> wrote:
>
> >
> > Stephen Hemminger <shemminger at vyatta.com> writes:
> >
> > > This looks like a bug in original code from misunderstanding
> > > of C rules of evaluation.
> > >
> > > ---
> > >  zebra/zserv.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/zebra/zserv.c b/zebra/zserv.c
> > > index 8e1df52..64a6c06 100644
> > > --- a/zebra/zserv.c
> > > +++ b/zebra/zserv.c
> > > @@ -451,7 +451,7 @@ zsend_route_multipath (int cmd, struct zserv *client,
> struct prefix *p,
> > >      }
> > >
> > >    /* Metric */
> > > -  if (cmd == ZEBRA_IPV4_ROUTE_ADD || ZEBRA_IPV6_ROUTE_ADD)
> > > +  if (cmd == ZEBRA_IPV4_ROUTE_ADD || cmd == ZEBRA_IPV6_ROUTE_ADD)
> > >      {
> > >        SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE);
> > >        stream_putc (s, rib->distance);
> >
> > I've applied locally and am running it, with ospfd and ripngd.  So far
> > it seems to behave exactly as before (which is good).
> >
> > I certainly see your point.  But, do you have an explanation of why the
> > code used to work, or a description of how the behavior was wrong?  Or
> > is cmd always one of those two, so the fact that this devolved to if(1)
> > is not an actual bug, just a latent bug?
>
> What happens is the old code adds unnecessary distance and metric info
> when routes are deleted. The zebra client protocol is NAME/VALUE so
> the extra info was just being ignored by the other servers.

Shouldn't this info always be included when deleting routes? It is
possible to have routes which only differs in metric so how to tell
which one to delete?

     Jocke




More information about the Quagga-dev mailing list