mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 03:27:39 +00:00
ospf6d: fix crash in SPF calculation
* ospf6_spf.c: Don't replace a node with another node with a lower
number of hops, instead get them from the queue in the correct
order. (Actually, the replacement crashed the ospf6d daemon
rather than worked.)
(cherry picked from commit 403138e189
)
This commit is contained in:
parent
dfc1d5caac
commit
a1239bc50d
@ -50,7 +50,9 @@ ospf6_vertex_cmp (void *a, void *b)
|
|||||||
struct ospf6_vertex *vb = (struct ospf6_vertex *) b;
|
struct ospf6_vertex *vb = (struct ospf6_vertex *) b;
|
||||||
|
|
||||||
/* ascending order */
|
/* ascending order */
|
||||||
return (va->cost - vb->cost);
|
if (va->cost != vb->cost)
|
||||||
|
return (va->cost - vb->cost);
|
||||||
|
return (va->hops - vb->hops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -320,22 +322,8 @@ ospf6_spf_install (struct ospf6_vertex *v,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prev = (struct ospf6_vertex *) route->route_option;
|
prev = (struct ospf6_vertex *) route->route_option;
|
||||||
if (prev->hops > v->hops)
|
assert (prev->hops <= v->hops);
|
||||||
{
|
ospf6_vertex_delete (v);
|
||||||
for (ALL_LIST_ELEMENTS (prev->child_list, node, nnode, w))
|
|
||||||
{
|
|
||||||
assert (w->parent == prev);
|
|
||||||
w->parent = v;
|
|
||||||
listnode_add_sort (v->child_list, w);
|
|
||||||
}
|
|
||||||
listnode_delete (prev->parent->child_list, prev);
|
|
||||||
listnode_add_sort (v->parent->child_list, v);
|
|
||||||
|
|
||||||
ospf6_vertex_delete (prev);
|
|
||||||
route->route_option = v;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ospf6_vertex_delete (v);
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user