diff options
author | Ondrej Filip <feela@network.cz> | 2000-08-18 16:44:37 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-08-18 16:44:37 +0000 |
commit | f321a61f77262d33dd43d50136c8116ebf8139c6 (patch) | |
tree | e4b06b081f67b2d96ff3775a662e2c70465a87dc /proto/ospf | |
parent | 88aa2af7effa3752d033ccab5e18fb1303603585 (diff) |
Fixed bug in nex hop calculation of external routes.
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/rt.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 743b585f..a7b541df 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -263,6 +263,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ struct top_hash_entry *en,*etmp,*absr; struct fib *ef=&po->efib; struct extfib *nf; + struct infib *inf; struct fib_iterator fit; struct ospf_area *oa=NULL,*atmp,*absroa; struct proto *p=&po->proto; @@ -366,18 +367,18 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ } tag=lt->tag; } - else + else /* FW address !=0 */ { - nf=NULL; /* FW address !=0 */ + inf=NULL; WALK_LIST(atmp,po->area_list) { - if((nf=fib_route(&atmp->infib,lt->fwaddr,32))!=NULL) + if((inf=fib_route(&atmp->infib,lt->fwaddr,32))!=NULL) { break; } } - if(nf==NULL) + if(inf==NULL) { DBG("Cannot find network route (GW=%I)\n",lt->fwaddr); continue; @@ -385,42 +386,46 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ if(lt->etos>0) { - met=nf->metric; + met=inf->metric; met2=lt->metric; } else { - met=nf->metric+lt->metric; + met=inf->metric+lt->metric; met2=LSINFINITY; } tag=lt->tag; if((nn=neigh_find(p,<->fwaddr,0))!=NULL) { - nnh=nn->addr; + nnh=IPA_NONE; nnhi=nn->iface; } else { - nnh=nf->nh; - nnhi=nf->nhi; + nnh=inf->en->nh; + nnhi=inf->en->nhi; } - } nf=fib_get(ef,&ip, mlen); - if(((nf->metric>met)&&(nf->metric2==met2)) || /* both E1 or E2 + if((nf->metric==LSINFINITY) || /* nf is new */ + ((met<nf->metric)&&(nf->metric2==met2)) || /* both E1 or E2 * with same metric */ - ((nf->metric2>met2)&&(nf->metric2!=LSINFINITY)) || /* E2 smaller and + ((met2<nf->metric2)&&(nf->metric2!=LSINFINITY)) || /* E2 smaller and * 1st is not E1 */ ((nf->metric2!=LSINFINITY)&&(met2==LSINFINITY))) /* 2nd is E1 and * 1st is E2 */ { + if(nf->metric!=LSINFINITY) + OSPF_TRACE(D_EVENTS, + "Rewritting %I/%d met=%d, met2=%d, nmet=%d, nmet2=%d", + ip, mlen, nf->metric, nf->metric2, met, met2); nf->metric=met; nf->metric2=met2; nf->tag=tag; - if(ipa_compare(nnh,ipa_from_u32(0))!=0) + if(nnhi!=NULL) { nf->nh=nnh; nf->nhi=nnhi; |