Bugfix in external routes calculation.

This commit is contained in:
Ondrej Filip 2005-03-14 10:59:52 +00:00
parent f735de0290
commit a2d5b405d4

View file

@ -45,7 +45,7 @@ ospf_rt_initort(struct fib_node *fn)
/*
* This is hard to understand:
* If rfc1583 is set to 1, it work likes normal route_better()
* But if it is set to 0, it prunes number of AS bondary
* But if it is set to 0, it prunes number of AS boundary
* routes before it starts the router decision
*/
static int
@ -62,14 +62,14 @@ ri_better(struct proto_ospf *po, orta * new, ort *nefn, orta * old, ort *oefn, i
if (!rfc1583)
{
if(new->oa->areaid == 0) newtype = RTS_OSPF_IA;
if(old->oa->areaid == 0) oldtype = RTS_OSPF_IA;
if ((new->type < RTS_OSPF_EXT1) && (new->oa->areaid == 0)) newtype = RTS_OSPF_IA;
if ((old->type < RTS_OSPF_EXT2) && (old->oa->areaid == 0)) oldtype = RTS_OSPF_IA;
}
if (new->type < old->type)
if (newtype < oldtype)
return 1;
if (new->type > old->type)
if (newtype > oldtype)
return 0;
/* Same type */
@ -81,8 +81,8 @@ ri_better(struct proto_ospf *po, orta * new, ort *nefn, orta * old, ort *oefn, i
if (((new->type == RTS_OSPF_EXT2) || (new->type == RTS_OSPF_EXT1)) && (!po->rfc1583))
{
int newtype = nefn->n.type;
int oldtype = oefn->n.type;
newtype = nefn->n.type;
oldtype = oefn->n.type;
if (nefn->n.oa->areaid == 0) newtype = RTS_OSPF_IA;
if (oefn->n.oa->areaid == 0) oldtype = RTS_OSPF_IA;
@ -746,15 +746,15 @@ ospf_ext_spf(struct proto_ospf *po)
nhi = nf2->n.ifa;
}
nfh = nf2;
if (nf2->n.metric1 == LSINFINITY)
continue; /* distance is INF */
}
nfa.type = RTS_OSPF_EXT2;
if(met2 == LSINFINITY) nfa.type = RTS_OSPF_EXT1;
nfa.type = (met2 == LSINFINITY) ? RTS_OSPF_EXT1 : RTS_OSPF_EXT2;
nfa.capa = 0;
nfa.metric1 = met1;
nfa.metric2 = met2;
nfa.oa = po->backbone;
nfa.oa = (po->backbone == NULL) ? HEAD(po->area_list) : po->backbone;
nfa.ar = nf1->n.ar;
nfa.nh = nh;
nfa.ifa = nhi;