summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaul <paul>2005-06-13 13:57:16 +0000
committerpaul <paul>2005-06-13 13:57:16 +0000
commit7461d4594aad716f24690c68c5f82bd865cf9c25 (patch)
tree9a65d1ec29bf635122177b87caa86115d9028d78
parent1ada81981da3e6422a59d3052d32696fc93cdea1 (diff)
2005-06-13 Paul Jakma <paul.jakma@sun.com>
* ospf_spf.c: Try get more information on a SEGV under ospf_spf_vertex_add_parent. (ospf_vertex_free) NULL out the child and nexthop lists (ospf_vertex_add_parent) nexthop and child can not be NULL vertex_nexthop's parent->child list can not be NULL (ospf_spf_next) w and cw are per-loop iteration variables, move declarations into loop body.
-rw-r--r--ospfd/ChangeLog10
-rw-r--r--ospfd/ospf_spf.c15
2 files changed, 21 insertions, 4 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index b45739d9..4ba7addd 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,13 @@
+2005-06-13 Paul Jakma <paul.jakma@sun.com>
+
+ * ospf_spf.c: Try get more information on a SEGV under
+ ospf_spf_vertex_add_parent.
+ (ospf_vertex_free) NULL out the child and nexthop lists
+ (ospf_vertex_add_parent) nexthop and child can not be NULL
+ vertex_nexthop's parent->child list can not be NULL
+ (ospf_spf_next) w and cw are per-loop iteration variables, move
+ declarations into loop body.
+
2005-06-07 Hasso Tepper <hasso at quagga.net>
* ospf_apiserver.c: Fix obvious error in notifying clients about ISM
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index e34dd2ee..206a2e7c 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -129,13 +129,15 @@ ospf_vertex_free (struct vertex *v)
struct vertex_nexthop *nh;
list_delete (v->child);
-
+ v->child = NULL;
+
if (listcount (v->nexthop) > 0)
for (ALL_LIST_ELEMENTS (v->nexthop, node, nnode, nh))
vertex_nexthop_free (nh);
list_delete (v->nexthop);
-
+ v->nexthop = NULL;
+
XFREE (MTYPE_OSPF_VERTEX, v);
}
@@ -194,9 +196,13 @@ ospf_vertex_add_parent (struct vertex *v)
{
struct vertex_nexthop *nh;
struct listnode *node;
-
+
+ assert (v->nexthop && v->child);
+
for (ALL_LIST_ELEMENTS_RO (v->nexthop, node, nh))
{
+ assert (nh->parent && nh->parent->child);
+
/* No need to add two links from the same parent. */
if (listnode_lookup (nh->parent->child, v) == NULL)
listnode_add (nh->parent->child, v);
@@ -625,7 +631,6 @@ ospf_spf_next (struct vertex *v, struct ospf_area *area,
struct pqueue * candidate)
{
struct ospf_lsa *w_lsa = NULL;
- struct vertex *w, *cw;
u_char *p;
u_char *lim;
struct router_lsa_link *l = NULL;
@@ -645,6 +650,8 @@ ospf_spf_next (struct vertex *v, struct ospf_area *area,
while (p < lim)
{
+ struct vertex *w, *cw;
+
int link = -1; /* link index for w's back link */
/* In case of V is Router-LSA. */