From 57c639f01ec6be70ac858f412d32b638a9756bed Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sat, 7 Jul 2012 17:06:12 +0200 Subject: ospf_spf_process_stubs: use LSA pos to find OSFP interface This is better than a prefix lookup as prefixes may not be unique, that is, the same prefix can exist on several interfaces. Signed-off-by: Joakim Tjernlund Signed-off-by: David Lamparter --- ospfd/ospf_route.c | 4 ++-- ospfd/ospf_route.h | 2 +- ospfd/ospf_spf.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index d2e5e1e7..a5d6d18c 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -429,7 +429,7 @@ ospf_intra_add_transit (struct route_table *rt, struct vertex *v, void ospf_intra_add_stub (struct route_table *rt, struct router_lsa_link *link, struct vertex *v, struct ospf_area *area, - int parent_is_root) + int parent_is_root, int lsa_pos) { u_int32_t cost; struct route_node *rn; @@ -577,7 +577,7 @@ ospf_intra_add_stub (struct route_table *rt, struct router_lsa_link *link, if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_intra_add_stub(): this network is on this router"); - if ((oi = ospf_if_lookup_by_prefix (area->ospf, &p))) + if ((oi = ospf_if_lookup_by_lsa_pos (area, lsa_pos))) { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_intra_add_stub(): the interface is %s", diff --git a/ospfd/ospf_route.h b/ospfd/ospf_route.h index 17ab68e5..5742b462 100644 --- a/ospfd/ospf_route.h +++ b/ospfd/ospf_route.h @@ -141,7 +141,7 @@ extern void ospf_intra_add_transit (struct route_table *, struct vertex *, extern void ospf_intra_add_stub (struct route_table *, struct router_lsa_link *, struct vertex *, struct ospf_area *, - int parent_is_root); + int parent_is_root, int); extern int ospf_route_cmp (struct ospf *, struct ospf_route *, struct ospf_route *); diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 26fe4851..66829511 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -973,6 +973,7 @@ ospf_spf_process_stubs (struct ospf_area *area, struct vertex *v, u_char *lim; struct router_lsa_link *l; struct router_lsa *rlsa; + int lsa_pos = 0; if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_process_stubs():processing router LSA, id: %s", @@ -994,7 +995,8 @@ ospf_spf_process_stubs (struct ospf_area *area, struct vertex *v, (l->m[0].tos_count * OSPF_ROUTER_LSA_TOS_SIZE)); if (l->m[0].type == LSA_LINK_TYPE_STUB) - ospf_intra_add_stub (rt, l, v, area, parent_is_root); + ospf_intra_add_stub (rt, l, v, area, parent_is_root, lsa_pos); + lsa_pos++; } } -- cgit v1.2.1