Sort cleanup in aging.
This commit is contained in:
parent
70a383198a
commit
d1660fd3f3
6 changed files with 30 additions and 24 deletions
|
@ -16,11 +16,16 @@ flush_lsa(struct top_hash_entry *en, struct ospf_area *oa)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ospf_age(struct top_hash_entry *en, bird_clock_t delta, int flush,
|
ospf_age(struct ospf_area *oa)
|
||||||
struct ospf_area *oa)
|
|
||||||
{
|
{
|
||||||
struct proto *p=&oa->po->proto;
|
struct proto *p=&oa->po->proto;
|
||||||
struct proto_ospf *po=(struct proto_ospf *)p;
|
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)
|
||||||
|
{
|
||||||
if(en->lsa.age==LSA_MAXAGE)
|
if(en->lsa.age==LSA_MAXAGE)
|
||||||
{
|
{
|
||||||
if(flush) flush_lsa(en,oa);
|
if(flush) flush_lsa(en,oa);
|
||||||
|
@ -39,6 +44,8 @@ ospf_age(struct top_hash_entry *en, bird_clock_t delta, int flush,
|
||||||
else en->lsa.age=LSA_MAXAGE;
|
else en->lsa.age=LSA_MAXAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
oa->lage=now;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n)
|
htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n)
|
||||||
|
|
|
@ -23,7 +23,6 @@ u16 lsasum_check(struct ospf_lsa_header *h,void *body,struct proto_ospf *po);
|
||||||
int lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2);
|
int lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2);
|
||||||
struct top_hash_entry *lsa_install_new(struct ospf_lsa_header *lsa, void *body,
|
struct top_hash_entry *lsa_install_new(struct ospf_lsa_header *lsa, void *body,
|
||||||
struct ospf_area *oa, struct proto *p);
|
struct ospf_area *oa, struct proto *p);
|
||||||
void ospf_age(struct top_hash_entry *en, bird_clock_t delta, int flush,
|
void ospf_age(struct ospf_area *oa);
|
||||||
struct ospf_area *oa);
|
|
||||||
|
|
||||||
#endif /* _BIRD_OSPF_LSALIB_H_ */
|
#endif /* _BIRD_OSPF_LSALIB_H_ */
|
||||||
|
|
|
@ -162,11 +162,9 @@ area_disp(timer *timer)
|
||||||
{
|
{
|
||||||
struct ospf_area *oa=timer->data;
|
struct ospf_area *oa=timer->data;
|
||||||
struct top_hash_entry *en,*nxt;
|
struct top_hash_entry *en,*nxt;
|
||||||
int flush=0;
|
|
||||||
|
|
||||||
/* First of all try to age LSA DB */
|
/* First of all try to age LSA DB */
|
||||||
flush=can_flush_lsa(oa);
|
ospf_age(oa);
|
||||||
WALK_SLIST_DELSAFE(en,nxt,oa->lsal) ospf_age(en,DISPTICK,flush,oa);
|
|
||||||
|
|
||||||
/* Now try to originage rt_lsa */
|
/* Now try to originage rt_lsa */
|
||||||
if(oa->origrt) originate_rt_lsa(oa);
|
if(oa->origrt) originate_rt_lsa(oa);
|
||||||
|
|
|
@ -325,6 +325,7 @@ 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 */
|
||||||
|
|
|
@ -33,7 +33,7 @@ init_efib(struct fib_node *fn)
|
||||||
void
|
void
|
||||||
ospf_rt_spfa(struct ospf_area *oa)
|
ospf_rt_spfa(struct ospf_area *oa)
|
||||||
{
|
{
|
||||||
struct top_hash_entry *en, *nx;
|
struct top_hash_entry *en;
|
||||||
u32 i,*rts;
|
u32 i,*rts;
|
||||||
struct ospf_lsa_rt *rt;
|
struct ospf_lsa_rt *rt;
|
||||||
struct ospf_lsa_rt_link *rtl,*rr;
|
struct ospf_lsa_rt_link *rtl,*rr;
|
||||||
|
@ -50,7 +50,7 @@ ospf_rt_spfa(struct ospf_area *oa)
|
||||||
debug("%s: Starting routing table calculation for area %I\n",p->name,
|
debug("%s: Starting routing table calculation for area %I\n",p->name,
|
||||||
oa->areaid);
|
oa->areaid);
|
||||||
|
|
||||||
WALK_SLIST_DELSAFE(SNODE en, nx, oa->lsal)
|
WALK_SLIST(SNODE en, oa->lsal)
|
||||||
{
|
{
|
||||||
en->color=OUTSPF;
|
en->color=OUTSPF;
|
||||||
en->dist=LSINFINITY;
|
en->dist=LSINFINITY;
|
||||||
|
|
|
@ -184,6 +184,7 @@ addifa_rtlsa(struct ospf_iface *ifa)
|
||||||
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=DISPTICK;
|
oa->disp_timer->recurrent=DISPTICK;
|
||||||
|
oa->lage=now;
|
||||||
tm_start(oa->disp_timer,DISPTICK);
|
tm_start(oa->disp_timer,DISPTICK);
|
||||||
oa->calcrt=1;
|
oa->calcrt=1;
|
||||||
oa->origrt=0;
|
oa->origrt=0;
|
||||||
|
|
Loading…
Reference in a new issue