Better algoritmus of LSA aging.

This commit is contained in:
Ondrej Filip 2000-06-07 23:48:33 +00:00
parent 25a3f3da7a
commit 17e29574bc
4 changed files with 4 additions and 5 deletions

View file

@ -40,7 +40,6 @@ ospf_age(struct ospf_area *oa)
struct proto_ospf *po=(struct proto_ospf *)p;
struct top_hash_entry *en,*nxt;
int flush=can_flush_lsa(oa);
bird_clock_t delta=now-oa->lage;
WALK_SLIST_DELSAFE(en,nxt,oa->lsal)
{
@ -68,7 +67,7 @@ ospf_age(struct ospf_area *oa)
flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
continue;
}
if((en->lsa.age+=delta)>=LSA_MAXAGE)
if((en->lsa.age=(en->ini_age+(now-en->inst_t)))>=LSA_MAXAGE)
{
if(flush)
{
@ -78,7 +77,6 @@ ospf_age(struct ospf_area *oa)
else en->lsa.age=LSA_MAXAGE;
}
}
oa->lage=now;
}
void
@ -454,6 +452,7 @@ lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa)
if(en->lsa_body!=NULL) mb_free(en->lsa_body);
en->lsa_body=body;
memcpy(&en->lsa,lsa,sizeof(struct ospf_lsa_header));
en->ini_age=en->lsa.age;
if(change)
{

View file

@ -102,7 +102,6 @@ ospf_start(struct proto *p)
oa->disp_timer->randomize=0;
oa->disp_timer->hook=area_disp;
oa->disp_timer->recurrent=oa->tick;
oa->lage=now;
tm_start(oa->disp_timer,oa->tick);
oa->calcrt=0;
oa->origrt=0;

View file

@ -350,7 +350,6 @@ struct ospf_area {
node n;
u32 areaid;
timer *disp_timer; /* Area's dispatcher hear beat */
bird_clock_t lage; /* Time of last aging */
int calcrt; /* Routing table calculation scheduled? */
int origrt; /* Rt lsa origination scheduled? */
struct top_graph *gr; /* LSA graph */

View file

@ -19,11 +19,13 @@ struct top_hash_entry { /* Index for fast mapping (type,rtrid,LSid)->vertex */
ip_addr nh; /* Next hop */
struct iface *nhi;
u16 dist; /* Distance from the root */
u16 ini_age;
u8 color;
#define OUTSPF 0
#define CANDIDATE 1
#define INSPF 2
u8 padding;
u16 padding2;
};
struct top_graph {