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;

}