[quagga-dev 4579] Re: ospfd assertion `new_distance <= w->distance' failed

Anders K. Pedersen mailnews+router-quagga-dev at news.cohaesio.com
Sun Feb 11 14:54:07 GMT 2007

Anders K. Pedersen wrote:
> Paul Jakma wrote:
>> On Sun, 4 Feb 2007, Anders K. Pedersen wrote:
>>> The zebra daemon is running without any problems, but when starting
>>> ospfd it consistently crashes after a few seconds with the following
>>> stack trace:
>>> 2007/02/04 18:55:45 OSPF: Assertion `new_distance <= w->distance' failed
>>> in file ospf_spf.c, line 442, function ospf_spf_add_parent
>> Ah, this is due to the patch at:
>> http://bugzilla.quagga.net/show_bug.cgi?id=330

I had a look at ospf_spf.c to see, if I could figure out, why it hit the
assertion. It seems that the following code in ospf_spf_next():

      /* calculate link cost D. */
      if (v->lsa->type == OSPF_ROUTER_LSA)
        distance = v->distance + ntohs (l->m[0].metric);
      else /* v is not a Router-LSA */
        distance = v->distance;

      /* Is there already vertex W in candidate list? */
      if (w_lsa->stat == LSA_SPF_NOT_EXPLORED)
          /* prepare vertex W. */
          w = ospf_vertex_new (w_lsa);
          w->distance = distance;

          /* Calculate nexthop to W. */
          if (ospf_nexthop_calculation (area, v, w, l))
            pqueue_enqueue (w, candidate);

for (v->lsa->type != OSPF_ROUTER_LSA) && (w_lsa->stat ==
LSA_SPF_NOT_EXPLORED) conflicts with ospf_spf_add_parent() (called via
ospf_nexthop_calculation() above):

  new_distance = v->distance + ntohs (l->m[0].metric);

  /* We shouldn't get here unless callers have determined V(l)->W is
   * shortest / equal-shortest path.
  assert (new_distance <= w->distance);

where new_distance is unconditionally calculated as ospf_spf_next()
would have done for (v->lsa->type == OSPF_ROUTER_LSA).

My understanding of the code isn't good enough to tell which of the two
functions is right, but I'm hoping that the above will help get the
problem fixed.

Anders K. Pedersen
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Anders K. Pedersen" <akp at cohaesio.com>

More information about the Quagga-dev mailing list