[PATCH] find correct IP address for PTMP I/Fs in calc_next_hop
Currently calc_next_hop searches for the next hop IP with RID as search key. This will not work when there are multiple links with the same RID. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> --- proto/ospf/rt.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 2f9fe49..e136aa3 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1360,6 +1360,9 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, /* The second case - ptp or ptmp neighbor */ if ((en->lsa.type == LSA_T_RT) && (par == oa->rt)) { + struct ospf_neighbor *m; + s16 n_pos; + ifa = rt_pos_to_ifa(oa, pos); if (!ifa) return NULL; @@ -1367,8 +1370,14 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, if (ifa->type == OSPF_IT_VLINK) return new_nexthop(po, IPA_NONE, NULL, 0); - struct ospf_neighbor *m = find_neigh(ifa, rid); - if (!m || (m->state != NEIGHBOR_FULL)) + n_pos = ifa->rt_pos_beg; + WALK_LIST(m, ifa->neigh_list) { + if (m->state != NEIGHBOR_FULL) + continue; + if (n_pos++ == pos) + break; + } + if (!m || m->rid != rid) /* Check rid just to be sure */ return NULL; return new_nexthop(po, m->ip, ifa->iface, ifa->ecmp_weight); -- 1.7.3.4
participants (1)
-
Joakim Tjernlund