From e9d3c3aaea24724c285027154bd9f5ddef8394e0 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sat, 9 Jun 2001 14:55:10 +0000 Subject: Bug in next-hop calculation fixed. (For dual connected neighbors.) --- proto/ospf/neighbor.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'proto/ospf/neighbor.c') diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index d22a60e..ca92e9d 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -432,16 +432,25 @@ find_neigh(struct ospf_iface *ifa, u32 rid) return NULL; } + +/* Find a closest neighbor which is at leas 2-Way */ struct ospf_neighbor * find_neigh_noifa(struct proto_ospf *po, u32 rid) { - struct ospf_neighbor *n; + struct ospf_neighbor *n=NULL,*m; struct ospf_iface *ifa; WALK_LIST (ifa, po->iface_list) - if((n=find_neigh(ifa, rid))!=NULL) - return n; - return NULL; + if((m=find_neigh(ifa, rid))!=NULL) + { + if(m->state>=NEIGHBOR_2WAY) + { + if(n==NULL) n=m; + else + if(m->ifa->cost < n->ifa->cost) n=m; + } + } + return n; } struct ospf_area * -- cgit v1.2.3