summaryrefslogtreecommitdiff
path: root/proto/ospf
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-11-29 10:29:33 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-11-29 10:29:33 +0100
commit4b84bd4554b2a9331055bfd8d02a0bab0d10df92 (patch)
tree522e9995ae845ad383df85340d05dc21579c0f72 /proto/ospf
parenta6250a7d1013442ad4feb0d67128a707f2c6880b (diff)
Fixes some crashes in OSPFv2.
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/rt.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index a230d38f..2e1de440 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -776,6 +776,8 @@ add_cand(list * l, struct top_hash_entry *en, struct top_hash_entry *par,
node *prev, *n;
int added = 0;
struct top_hash_entry *act;
+ ip_addr old_nh;
+ struct ospf_iface *old_nhi;
if (en == NULL)
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",
en->lsa.rt, en->lsa.id, en->lsa.type);
+ old_nhi = en->nhi;
+ old_nh = en->nh;
+
en->nhi = NULL;
en->nh = IPA_NONE;
-
calc_next_hop(en, par, oa);
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)
{ /* We found a shorter path */