]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Sort cleanup in aging.
authorOndrej Filip <feela@network.cz>
Wed, 31 May 2000 14:21:56 +0000 (14:21 +0000)
committerOndrej Filip <feela@network.cz>
Wed, 31 May 2000 14:21:56 +0000 (14:21 +0000)
proto/ospf/lsalib.c
proto/ospf/lsalib.h
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/rt.c
proto/ospf/topology.c

index d462bbd051ff88372906f4fb38b051fd2f2478a3..62ea0b86165ae04334c2861a164488043e5c6fde 100644 (file)
@@ -16,28 +16,35 @@ flush_lsa(struct top_hash_entry *en, struct ospf_area *oa)
 }
 
 void
-ospf_age(struct top_hash_entry *en, bird_clock_t delta, int flush,
-  struct ospf_area *oa)
+ospf_age(struct ospf_area *oa)
 {
   struct proto *p=&oa->po->proto;
   struct proto_ospf *po=(struct proto_ospf *)p;
-  if(en->lsa.age==LSA_MAXAGE)
-  {
-    if(flush) flush_lsa(en,oa);
-    return;
-  }
-  if((en->lsa.rt==p->cf->global->router_id)&&(en->lsa.age>LSREFRESHTIME))
-  {
-     en->lsa.sn++;
-     en->lsa.age=0;
-     flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
-     return;
-  }
-  if((en->lsa.age+=delta)>LSA_MAXAGE)
+  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(flush) flush_lsa(en,oa);
-    else en->lsa.age=LSA_MAXAGE;
+    if(en->lsa.age==LSA_MAXAGE)
+    {
+      if(flush) flush_lsa(en,oa);
+      return;
+    }
+    if((en->lsa.rt==p->cf->global->router_id)&&(en->lsa.age>LSREFRESHTIME))
+    {
+       en->lsa.sn++;
+       en->lsa.age=0;
+       flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
+       return;
+    }
+    if((en->lsa.age+=delta)>LSA_MAXAGE)
+    {
+      if(flush) flush_lsa(en,oa);
+      else en->lsa.age=LSA_MAXAGE;
+    }
   }
+  oa->lage=now;
 }
 
 void
index f9cc8f39a4c93c0d2c32679a08cd0ef412cd9b5f..8dc1561bfc4f28c2b46feedc28495abb8e6f705e 100644 (file)
@@ -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);
 struct top_hash_entry *lsa_install_new(struct ospf_lsa_header *lsa, void *body,
   struct ospf_area *oa, struct proto *p);
-void ospf_age(struct top_hash_entry *en, bird_clock_t delta, int flush,
-  struct ospf_area *oa);
+void ospf_age(struct ospf_area *oa);
 
 #endif /* _BIRD_OSPF_LSALIB_H_ */
index 701c323026084cc8b95d25c08c7f9607ffc1f6b5..bc9a636b3355b976bc8796193159e90d02f7fdf9 100644 (file)
@@ -162,11 +162,9 @@ area_disp(timer *timer)
 {
   struct ospf_area *oa=timer->data;
   struct top_hash_entry *en,*nxt;
-  int flush=0;
 
   /* First of all try to age LSA DB */
-  flush=can_flush_lsa(oa);
-  WALK_SLIST_DELSAFE(en,nxt,oa->lsal) ospf_age(en,DISPTICK,flush,oa);
+  ospf_age(oa);
 
   /* Now try to originage rt_lsa */
   if(oa->origrt) originate_rt_lsa(oa);
index 81760355fa03d1a8b919ec8ca4469a0b7bc7d7f4..087e6e79c50da9f4fcd42d2284b12f605c6e8e97 100644 (file)
@@ -325,6 +325,7 @@ 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 27c6efb64919829ec2d736fe3976f962e7d38428..d13c9e59a9ff43a524296b0c2ed9b36fc32e07f6 100644 (file)
@@ -33,7 +33,7 @@ init_efib(struct fib_node *fn)
 void
 ospf_rt_spfa(struct ospf_area *oa)
 {
-  struct top_hash_entry *en, *nx;
+  struct top_hash_entry *en;
   u32 i,*rts;
   struct ospf_lsa_rt *rt;
   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,
     oa->areaid);
 
-  WALK_SLIST_DELSAFE(SNODE en, nx, oa->lsal)
+  WALK_SLIST(SNODE en, oa->lsal)
   {
     en->color=OUTSPF;
     en->dist=LSINFINITY;
index 901f4ae74644ace0d30c1a24c89c6a64990b3bd4..6dd4495e9da0eaa20443de8c74b9e1ddc9f6b7cf 100644 (file)
@@ -184,6 +184,7 @@ addifa_rtlsa(struct ospf_iface *ifa)
     oa->disp_timer->randomize=0;
     oa->disp_timer->hook=area_disp;
     oa->disp_timer->recurrent=DISPTICK;
+    oa->lage=now;
     tm_start(oa->disp_timer,DISPTICK);
     oa->calcrt=1;
     oa->origrt=0;