summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-05-17 00:34:49 +0200
committerOndrej Filip <feela@network.cz>2000-05-17 00:34:49 +0200
commit508c36ab7981a8e50d1235c2c443491e4b04aa01 (patch)
tree35565bb9425d7749bc2f192b2222fd647f5b65d0 /proto
parenta96a979d5b2b3a7ef02d878e9598d3268cb4c8a7 (diff)
downloadbird-508c36ab7981a8e50d1235c2c443491e4b04aa01.tar
bird-508c36ab7981a8e50d1235c2c443491e4b04aa01.zip
Routing table calculation for ext LSAs having next-hop=!0.0.0.0
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/rt.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index cbda6c0..9b1b5fa 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -289,6 +289,11 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
if(lt->metric==LSINFINITY) continue;
ip=ipa_and(ipa_from_u32(en->lsa.id),le->netmask);
mlen=ipa_mklen(le->netmask);
+ if((mlen<0)||(mlen>32))
+ {
+ die("Invalid length of prefix! ID: %I, RT: %I, Type: %u, mask %I",
+ en->lsa.id,en->lsa.rt,en->lsa.type,le->netmask);
+ }
nf=NULL;
@@ -304,32 +309,57 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
met=0;met2=0;
+ WALK_LIST(atmp,po->area_list)
+ {
+ if((etmp=ospf_hash_find(atmp->gr,en->lsa.rt,en->lsa.rt,LSA_T_RT))!=NULL)
+ {
+ if((absr==NULL) || (absr->dist>etmp->dist) ||
+ ((etmp->dist==absr->dist) && (absroa->areaid<atmp->areaid)))
+ {
+ absr=etmp;
+ absroa=atmp;
+ break;
+ }
+ }
+ }
+ if(absr==NULL) continue;
+
if(1 || ipa_compare(lt->fwaddr,ipa_from_u32(0))==0) /* FIXME add fwaddr */
{
+ if(lt->etos>0)
+ {
+ met=absr->dist;
+ met2=lt->metric;
+ }
+ else
+ {
+ met=absr->dist+lt->metric;
+ met2=0;
+ }
+ }
+ else
+ {
+ nf=NULL;
WALK_LIST(atmp,po->area_list)
{
- if((etmp=ospf_hash_find(atmp->gr,en->lsa.rt,en->lsa.rt,LSA_T_RT))!=NULL)
+ if((nf=fib_route(&atmp->infib,lt->fwaddr,32))!=NULL)
{
- if((absr==NULL) || (absr->dist>etmp->dist) ||
- ((etmp->dist==absr->dist) && (absroa->areaid<atmp->areaid)))
- {
- absr=etmp;
- absroa=atmp;
- }
+ break;
}
}
- if(absr==NULL) continue;
+ if(nf==NULL) continue;
if(lt->etos>0)
{
- met=absr->dist;
+ met=nf->metric;
met2=lt->metric;
}
else
{
- met=absr->dist+lt->metric;
+ met=nf->metric+lt->metric;
met2=0;
}
}
+
nf=fib_get(ef,&ip, mlen);
if((nf->metric>met) || ((nf->metric==met)&&(nf->metric2>met2)))
{