From 48b0814ace2d05f9fef093d9f309bfa186a6f365 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 27 Apr 2010 18:29:01 +0200 Subject: [PATCH] A fix in OSPFv3 next_hop calculation. --- proto/ospf/rt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 9e63d2c6..643da9af 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1300,10 +1300,15 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, * Next-hop is taken from lladdr field of Link-LSA, en->lb_id * is computed in link_back(). */ - struct top_hash_entry *llsa; - llsa = ospf_hash_find(po->gr, par->nhi->iface->index, en->lb_id, rid, LSA_T_LINK); + struct top_hash_entry *lhe; + lhe = ospf_hash_find(po->gr, par->nhi->iface->index, en->lb_id, rid, LSA_T_LINK); - if (!llsa || ipa_zero(llsa->lladdr)) + if (!lhe) + return 0; + + struct ospf_lsa_link *llsa = lhe->lsa_body; + + if (ipa_zero(llsa->lladdr)) return 0; en->nh = llsa->lladdr;