Better algoritmus of LSA aging.
This commit is contained in:
parent
25a3f3da7a
commit
17e29574bc
4 changed files with 4 additions and 5 deletions
|
@ -40,7 +40,6 @@ ospf_age(struct ospf_area *oa)
|
||||||
struct proto_ospf *po=(struct proto_ospf *)p;
|
struct proto_ospf *po=(struct proto_ospf *)p;
|
||||||
struct top_hash_entry *en,*nxt;
|
struct top_hash_entry *en,*nxt;
|
||||||
int flush=can_flush_lsa(oa);
|
int flush=can_flush_lsa(oa);
|
||||||
bird_clock_t delta=now-oa->lage;
|
|
||||||
|
|
||||||
WALK_SLIST_DELSAFE(en,nxt,oa->lsal)
|
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);
|
flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if((en->lsa.age+=delta)>=LSA_MAXAGE)
|
if((en->lsa.age=(en->ini_age+(now-en->inst_t)))>=LSA_MAXAGE)
|
||||||
{
|
{
|
||||||
if(flush)
|
if(flush)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +77,6 @@ ospf_age(struct ospf_area *oa)
|
||||||
else en->lsa.age=LSA_MAXAGE;
|
else en->lsa.age=LSA_MAXAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oa->lage=now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
if(en->lsa_body!=NULL) mb_free(en->lsa_body);
|
||||||
en->lsa_body=body;
|
en->lsa_body=body;
|
||||||
memcpy(&en->lsa,lsa,sizeof(struct ospf_lsa_header));
|
memcpy(&en->lsa,lsa,sizeof(struct ospf_lsa_header));
|
||||||
|
en->ini_age=en->lsa.age;
|
||||||
|
|
||||||
if(change)
|
if(change)
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,6 @@ ospf_start(struct proto *p)
|
||||||
oa->disp_timer->randomize=0;
|
oa->disp_timer->randomize=0;
|
||||||
oa->disp_timer->hook=area_disp;
|
oa->disp_timer->hook=area_disp;
|
||||||
oa->disp_timer->recurrent=oa->tick;
|
oa->disp_timer->recurrent=oa->tick;
|
||||||
oa->lage=now;
|
|
||||||
tm_start(oa->disp_timer,oa->tick);
|
tm_start(oa->disp_timer,oa->tick);
|
||||||
oa->calcrt=0;
|
oa->calcrt=0;
|
||||||
oa->origrt=0;
|
oa->origrt=0;
|
||||||
|
|
|
@ -350,7 +350,6 @@ struct ospf_area {
|
||||||
node n;
|
node n;
|
||||||
u32 areaid;
|
u32 areaid;
|
||||||
timer *disp_timer; /* Area's dispatcher hear beat */
|
timer *disp_timer; /* Area's dispatcher hear beat */
|
||||||
bird_clock_t lage; /* Time of last aging */
|
|
||||||
int calcrt; /* Routing table calculation scheduled? */
|
int calcrt; /* Routing table calculation scheduled? */
|
||||||
int origrt; /* Rt lsa origination scheduled? */
|
int origrt; /* Rt lsa origination scheduled? */
|
||||||
struct top_graph *gr; /* LSA graph */
|
struct top_graph *gr; /* LSA graph */
|
||||||
|
|
|
@ -19,11 +19,13 @@ struct top_hash_entry { /* Index for fast mapping (type,rtrid,LSid)->vertex */
|
||||||
ip_addr nh; /* Next hop */
|
ip_addr nh; /* Next hop */
|
||||||
struct iface *nhi;
|
struct iface *nhi;
|
||||||
u16 dist; /* Distance from the root */
|
u16 dist; /* Distance from the root */
|
||||||
|
u16 ini_age;
|
||||||
u8 color;
|
u8 color;
|
||||||
#define OUTSPF 0
|
#define OUTSPF 0
|
||||||
#define CANDIDATE 1
|
#define CANDIDATE 1
|
||||||
#define INSPF 2
|
#define INSPF 2
|
||||||
u8 padding;
|
u8 padding;
|
||||||
|
u16 padding2;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct top_graph {
|
struct top_graph {
|
||||||
|
|
Loading…
Reference in a new issue