summaryrefslogtreecommitdiff
path: root/proto/ospf/neighbor.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2001-06-09 14:55:10 +0000
committerOndrej Filip <feela@network.cz>2001-06-09 14:55:10 +0000
commite9d3c3aaea24724c285027154bd9f5ddef8394e0 (patch)
treee67326729beae873e2ffeb28e23ad3e9ecc15d6a /proto/ospf/neighbor.c
parentea31425a6191f0b3e181f8a1c7368fc4dfca24b4 (diff)
Bug in next-hop calculation fixed. (For dual connected neighbors.)
Diffstat (limited to 'proto/ospf/neighbor.c')
-rw-r--r--proto/ospf/neighbor.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index d22a60ef..ca92e9d6 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 *