ECMP/multipath support
Joakim Tjernlund
joakim.tjernlund at transmode.se
Sun Jan 9 00:03:19 CET 2011
> >> 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:
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index 2f9fe49..ea3b660 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 mpnh *nh, *p_nh;
+ struct ospf_neighbor *m;
+
ifa = rt_pos_to_ifa(oa, pos);
if (!ifa)
return NULL;
@@ -1367,11 +1370,15 @@ 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))
- return NULL;
-
- return new_nexthop(po, m->ip, ifa->iface, ifa->ecmp_weight);
+ nh = p_nh = NULL;
+ WALK_LIST(m, ifa->neigh_list) {
+ if (m->rid != rid || m->state != NEIGHBOR_FULL)
+ continue;
+ nh = new_nexthop(po, m->ip, ifa->iface, ifa->ecmp_weight);
+ nh->next = p_nh;
+ p_nh = nh;
+ }
+ return nh;
}
/* The third case - bcast or nbma neighbor */
But this will cause some extra work as originate_rt_lsa_body() adds
identical entries to the RT LSA for multiple ptmp links between the same two
routers. I am not sure what the point is with adding identical entries?
Question, would this unrelated simplification work?
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 9e693e1..da15e52 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -230,14 +230,6 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length)
{
int net_lsa = 0;
- if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa == oa) &&
- (!EMPTY_LIST(ifa->neigh_list)))
- {
- neigh = (struct ospf_neighbor *) HEAD(ifa->neigh_list);
- if ((neigh->state == NEIGHBOR_FULL) && (ifa->cost <= 0xffff))
- bitv = 1;
- }
-
if ((ifa->oa != oa) || (ifa->state == OSPF_IS_DOWN))
continue;
@@ -287,6 +279,8 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length)
ln->data = ipa_to_u32(ifa->addr->ip);
ln->metric = ifa->cost;
ln->padding = 0;
+ if (ifa->voa == oa)
+ bitv = 1;
i++;
}
break;
More information about the Bird-users
mailing list