From 17e29574bcf0e03e3243a48e784b0248925cc5b4 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Wed, 7 Jun 2000 23:48:33 +0000 Subject: Better algoritmus of LSA aging. --- proto/ospf/lsalib.c | 5 ++--- proto/ospf/ospf.c | 1 - proto/ospf/ospf.h | 1 - proto/ospf/topology.h | 2 ++ 4 files changed, 4 insertions(+), 5 deletions(-) (limited to 'proto') diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index 3cd62a9..6bf3577 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -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) { diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index a7fb650..11daba1 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -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; diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 443eec0..d22b617 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -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 */ diff --git a/proto/ospf/topology.h b/proto/ospf/topology.h index 3a47508..ca3096e 100644 --- a/proto/ospf/topology.h +++ b/proto/ospf/topology.h @@ -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 { -- cgit v1.2.3