diff options
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/ospf.c | 10 | ||||
-rw-r--r-- | proto/ospf/rt.c | 13 | ||||
-rw-r--r-- | proto/ospf/rt.h | 1 |
3 files changed, 17 insertions, 7 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index b385a482..15e9ea45 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -237,14 +237,20 @@ ospf_get_route_info(rte *rte, byte *buf, ea_list *attrs) { met='1'; 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) type='I'; buf += bsprintf(buf, " %c", type); if(met!=' ') buf += bsprintf(buf, "%c", met); 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 diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index d50e438a..9b85df74 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -259,6 +259,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ ip_addr ip,nnh; struct iface *nnhi=NULL; u16 met,met2; + u32 tag; neighbor *nn; 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; nnhi=NULL; - met=0;met2=0; + met=0;met2=0;tag=0; WALK_LIST(atmp,po->area_list) { @@ -338,8 +339,9 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ else { met=absr->dist+lt->metric; - met2=0; + met2=LSINFINITY; } + tag=lt->tag; } else { @@ -360,9 +362,9 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ else { met=nf->metric+lt->metric; - met2=0; + met2=LSINFINITY; } - + tag=lt->tag; if((nn=neigh_find(p,<->fwaddr,0))!=NULL) { @@ -376,6 +378,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ { nf->metric=met; nf->metric2=met2; + nf->tag=tag; if(nnhi!=NULL) { nf->nh=nnh; @@ -447,7 +450,7 @@ noch: e=rte_get_temp(&a0); e->u.ospf.metric1=nf->metric; e->u.ospf.metric2=nf->metric2; - e->u.ospf.tag=0; /* FIXME Some config? */ + e->u.ospf.tag=nf->tag; e->pflags = 0; e->net=ne; e->pref = p->preference; diff --git a/proto/ospf/rt.h b/proto/ospf/rt.h index 66c04df5..efd09061 100644 --- a/proto/ospf/rt.h +++ b/proto/ospf/rt.h @@ -22,6 +22,7 @@ struct extfib { u16 metric; u16 metric2; ip_addr nh; + u32 tag; struct iface *nhi; }; |