]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
I will not originate the same lsa before MINLSINTERVAL.
authorOndrej Filip <feela@network.cz>
Sat, 11 Aug 2001 14:01:54 +0000 (14:01 +0000)
committerOndrej Filip <feela@network.cz>
Sat, 11 Aug 2001 14:01:54 +0000 (14:01 +0000)
proto/ospf/iface.c
proto/ospf/iface.h
proto/ospf/neighbor.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/topology.c

index 9cd469297fe2f7771e2614eddfd13caee5643d57..ac34d634a4493a326688c177ea760ce975989ef5 100644 (file)
@@ -494,3 +494,8 @@ ospf_ifa_add(struct object_lock *lock)
   ospf_int_sm(ifa, ISM_UP);
 }
 
+void
+schedule_net_lsa(struct ospf_iface *ifa)
+{
+  ifa->orignet=1;
+}
index 99a32bfed8e23fd5996d7a461ce478c49cda0e09..350f5317d5d697a150f165f1e670b62dcef9c4be 100644 (file)
@@ -23,5 +23,6 @@ struct ospf_iface *find_iface(struct proto_ospf *p, struct iface *what);
 void ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface);
 void ospf_iface_info(struct ospf_iface *ifa);
 void ospf_ifa_add(struct object_lock *lock);
+void schedule_net_lsa(struct ospf_iface *ifa);
 
 #endif /* _BIRD_OSPF_IFACE_H_ */
index ca92e9d69551e5ae605503ac0e8b4345ff0a0aee..cbb3e5e129bb82c74625d7437999f5bf822df8ea 100644 (file)
@@ -58,14 +58,14 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
     {
       ifa->fadj--;
       schedule_rt_lsa(ifa->oa);
-      originate_net_lsa(ifa);
+      schedule_net_lsa(ifa);
     }
   
     if(state==NEIGHBOR_FULL)   /* Increase number of adjacencies */
     {
       ifa->fadj++;
       schedule_rt_lsa(ifa->oa);
-      originate_net_lsa(ifa);
+      schedule_net_lsa(ifa);
     }
     if(oldstate>=NEIGHBOR_EXSTART && state<NEIGHBOR_EXSTART)
     {
index 151187f92ba9fe8e333e4c36d6d32cb0da73fb30..8447e6987744d7f28ec2eff2076bb4d2b1db4966 100644 (file)
@@ -265,7 +265,8 @@ schedule_rtcalc(struct ospf_area *oa)
  * @timer: it's called every @ospf_area->tick seconds
  *
  * It ivokes aging and when @ospf_area->origrt is set to 1, start
- * function for origination of router LSA. It also start routing
+ * function for origination of router LSA and network LSA's.
+ * It also start routing
  * table calculation when @ospf_area->calcrt is set.
  */
 void
@@ -273,13 +274,20 @@ area_disp(timer *timer)
 {
   struct ospf_area *oa=timer->data;
   struct top_hash_entry *en,*nxt;
+  struct proto_ospf *po=oa->po;
+  struct ospf_iface *ifa;
 
   /* First of all try to age LSA DB */
   ospf_age(oa);
 
   /* Now try to originage rt_lsa */
   if(oa->origrt) originate_rt_lsa(oa);
-  oa->origrt=0;
+
+  /* Now try to originate network LSA's */
+  WALK_LIST(ifa, po->iface_list)
+  {
+    if(ifa->orignet&&(ifa->an==oa->areaid)) originate_net_lsa(ifa);
+  }
 
   if(oa->calcrt) ospf_rt_spfa(oa);
   oa->calcrt=0;
index 3eb46598658813c40c3e1f0199238ea248feef7d..11283a7e0214e698861d695338006d9b4f33f025 100644 (file)
@@ -136,6 +136,7 @@ struct ospf_iface {
                         * - using 4*HELLO
                         */
   struct top_hash_entry *nlsa; /* Originated net lsa */
+  int orignet;         /* Schedule network LSA origination */
   int fadj;            /* Number of full adjacent neigh */
   list nbma_list;
 };
index a0dd18a6bbf3e9290b86e834fed0c159aaf62d54..c07b1a793bd2d1c775d2830c2265317d3988508b 100644 (file)
@@ -189,6 +189,13 @@ originate_rt_lsa(struct ospf_area *oa)
   struct top_hash_entry *en;
   void *body;
 
+  if((oa->rt)&&((oa->rt->inst_t+MINLSINTERVAL))>now) return;
+       /*
+         * Tick is probably set to very low value. We cannot
+        * originate new LSA before MINLSINTERVAL. We will
+        * try to do it next tick.
+         */
+
   OSPF_TRACE(D_EVENTS, "Originating RT_lsa for area \"%I\".",oa->areaid);
 
   lsa.age=0;
@@ -210,6 +217,7 @@ originate_rt_lsa(struct ospf_area *oa)
   oa->rt=en;
   flood_lsa(NULL,NULL,&oa->rt->lsa,po,NULL,oa,1);
   schedule_rtcalc(oa);
+  oa->origrt=0;
 }
 
 void *
@@ -260,6 +268,12 @@ originate_net_lsa(struct ospf_iface *ifa)
   struct proto *p=&po->proto;
   void *body;
 
+  if(ifa->nlsa&&((ifa->nlsa->inst_t+MINLSINTERVAL)>now)) return;
+  /*
+   * It's too early to originate new network LSA. We will
+   * try to do it next tick
+   */
+
   OSPF_TRACE(D_EVENTS, "Originating Net lsa for iface \"%s\".",
     ifa->iface->name);
 
@@ -300,6 +314,7 @@ originate_net_lsa(struct ospf_iface *ifa)
   lsasum_calculate(&lsa,body,po);
   ifa->nlsa=lsa_install_new(&lsa, body, ifa->oa);
   flood_lsa(NULL,NULL,&ifa->nlsa->lsa,po,NULL,ifa->oa,1);
+  ifa->orignet=0;
 }
 
 static void *