]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Better algoritmus of LSA aging.
authorOndrej Filip <feela@network.cz>
Wed, 7 Jun 2000 23:48:33 +0000 (23:48 +0000)
committerOndrej Filip <feela@network.cz>
Wed, 7 Jun 2000 23:48:33 +0000 (23:48 +0000)
proto/ospf/lsalib.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/topology.h

index 3cd62a9ea34e9779cb7a7ecbb6ba3c4c57a3a7a1..6bf3577a3e4337622f7e5c76871be8c851f4fb3b 100644 (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)
   {
index a7fb650e91ab412413981e23fd53a58b941f7d9b..11daba19be6130086ea53d507e73e83c95376f41 100644 (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;
index 443eec0dfbf4d3421c683418b9030cc31dfdeff2..d22b617c2006d8a885919db895c3df68a7715e2b 100644 (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 */
index 3a47508518d2fea627ddd6636e69a318f67b6108..ca3096e4cbd4fc5eed4ce368b4e9d6a868a8c80a 100644 (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 {