>
> > >> Something else, in calc_next_hop:
> > >> don't you need to return all next hops for ptmp links now that you
> > >> support ECMP?
> > >
> > >The same as in ptp or bcast - multiple next hops are created
> > >by compositing returns of calc_next_hop(). Look at the caller
> > >of calc_next_hop().
> >
> > Don't think it will work as intended(I am traveling and only have mail 
> > access)
> > but I think the find_neigh(ifa, rid);
> > will always find the same neighbor so any additional links
> > will be missed.
>
> Still think you need to do something like this:

This one doesn't require changes to originate_rt_lsa_body()
Just that the neighbour list doesn't change between originate_rt_lsa_body
and calc_next_hop.

>From ee7096e741617292df5ea96f5f366b99a2bcd135 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <joakim.tjernl...@transmode.se>
Date: Sun, 9 Jan 2011 15:45:18 +0100
Subject: [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.tjernl...@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

Reply via email to