Added tagging of external LSA.

This commit is contained in:
Ondrej Filip 2000-05-31 12:07:09 +00:00
parent fec5bec0b5
commit a7a3a0a383
3 changed files with 17 additions and 7 deletions

View file

@ -237,14 +237,20 @@ ospf_get_route_info(rte *rte, byte *buf, ea_list *attrs)
{ {
met='1'; met='1';
type='E'; type='E';
} }
if(rte->u.ospf.metric2!=0) met='2'; if(rte->u.ospf.metric2!=LSINFINITY) met='2';
if(rte->attrs->source==RTS_OSPF_IA) type='A'; if(rte->attrs->source==RTS_OSPF_IA) type='A';
if(rte->attrs->source==RTS_OSPF) type='I'; if(rte->attrs->source==RTS_OSPF) type='I';
buf += bsprintf(buf, " %c", type); buf += bsprintf(buf, " %c", type);
if(met!=' ') buf += bsprintf(buf, "%c", met); if(met!=' ') buf += bsprintf(buf, "%c", met);
buf += bsprintf(buf, " (%d/%d)", rte->pref, buf += bsprintf(buf, " (%d/%d)", rte->pref,
(rte->u.ospf.metric2==0) ? rte->u.ospf.metric1 : rte->u.ospf.metric2); (rte->u.ospf.metric2==LSINFINITY) ? rte->u.ospf.metric1 :
rte->u.ospf.metric2);
if(rte->attrs->source==RTS_OSPF_EXT)
{
buf += bsprintf(buf, " [%d]", rte->u.ospf.tag);
}
} }
static int static int

View file

@ -259,6 +259,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
ip_addr ip,nnh; ip_addr ip,nnh;
struct iface *nnhi=NULL; struct iface *nnhi=NULL;
u16 met,met2; u16 met,met2;
u32 tag;
neighbor *nn; neighbor *nn;
debug("%s: Starting routing table calculation for external routes\n", debug("%s: Starting routing table calculation for external routes\n",
@ -311,7 +312,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
absroa=NULL; absroa=NULL;
nnhi=NULL; nnhi=NULL;
met=0;met2=0; met=0;met2=0;tag=0;
WALK_LIST(atmp,po->area_list) WALK_LIST(atmp,po->area_list)
{ {
@ -338,8 +339,9 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
else else
{ {
met=absr->dist+lt->metric; met=absr->dist+lt->metric;
met2=0; met2=LSINFINITY;
} }
tag=lt->tag;
} }
else else
{ {
@ -360,9 +362,9 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
else else
{ {
met=nf->metric+lt->metric; met=nf->metric+lt->metric;
met2=0; met2=LSINFINITY;
} }
tag=lt->tag;
if((nn=neigh_find(p,&lt->fwaddr,0))!=NULL) if((nn=neigh_find(p,&lt->fwaddr,0))!=NULL)
{ {
@ -376,6 +378,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
{ {
nf->metric=met; nf->metric=met;
nf->metric2=met2; nf->metric2=met2;
nf->tag=tag;
if(nnhi!=NULL) if(nnhi!=NULL)
{ {
nf->nh=nnh; nf->nh=nnh;
@ -447,7 +450,7 @@ noch:
e=rte_get_temp(&a0); e=rte_get_temp(&a0);
e->u.ospf.metric1=nf->metric; e->u.ospf.metric1=nf->metric;
e->u.ospf.metric2=nf->metric2; e->u.ospf.metric2=nf->metric2;
e->u.ospf.tag=0; /* FIXME Some config? */ e->u.ospf.tag=nf->tag;
e->pflags = 0; e->pflags = 0;
e->net=ne; e->net=ne;
e->pref = p->preference; e->pref = p->preference;

View file

@ -22,6 +22,7 @@ struct extfib {
u16 metric; u16 metric;
u16 metric2; u16 metric2;
ip_addr nh; ip_addr nh;
u32 tag;
struct iface *nhi; struct iface *nhi;
}; };