Fixes some crashes in OSPFv2.

This commit is contained in:
Ondrej Zajicek 2009-11-29 10:29:33 +01:00
parent a6250a7d10
commit 4b84bd4554

View file

@ -776,6 +776,8 @@ add_cand(list * l, struct top_hash_entry *en, struct top_hash_entry *par,
node *prev, *n; node *prev, *n;
int added = 0; int added = 0;
struct top_hash_entry *act; struct top_hash_entry *act;
ip_addr old_nh;
struct ospf_iface *old_nhi;
if (en == NULL) if (en == NULL)
return; return;
@ -798,13 +800,20 @@ add_cand(list * l, struct top_hash_entry *en, struct top_hash_entry *par,
DBG(" Adding candidate: rt: %R, id: %R, type: %u\n", DBG(" Adding candidate: rt: %R, id: %R, type: %u\n",
en->lsa.rt, en->lsa.id, en->lsa.type); en->lsa.rt, en->lsa.id, en->lsa.type);
old_nhi = en->nhi;
old_nh = en->nh;
en->nhi = NULL; en->nhi = NULL;
en->nh = IPA_NONE; en->nh = IPA_NONE;
calc_next_hop(en, par, oa); calc_next_hop(en, par, oa);
if (!en->nhi) if (!en->nhi)
return; /* We cannot find next hop, ignore it */ {
/* No next hop found, we undo changes and return */
en->nhi = old_nhi;
en->nh = old_nh;
return;
}
if (en->color == CANDIDATE) if (en->color == CANDIDATE)
{ /* We found a shorter path */ { /* We found a shorter path */