maybe it is a bug in nexthop__same function

Derek Pan DPan at advaoptical.com
Mon Mar 11 10:57:06 CET 2019


Hi

I think below function should be used by comparing two netxhop object with different pointer.
If this function is called, the X and Y always have different pointer values, but if their values are same, they also can be treated as the same.
I think the "return x== y;" should be replaced by "return 1;".
Please have a look. Thank.

int
nexthop__same(struct nexthop *x, struct nexthop *y)
{
  for (; x && y; x = x->next, y = y->next)
  {
    if (!ipa_equal(x->gw, y->gw) || (x->iface != y->iface) ||
             (x->flags != y->flags) || (x->weight != y->weight) ||
             (x->labels_orig != y->labels_orig) || (x->labels != y->labels))
      return 0;

    for (int i = 0; i < x->labels; i++)
      if (x->label[i] != y->label[i])
             return 0;
  }

  return x == y;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20190311/5d34e407/attachment.html>


More information about the Bird-users mailing list