From 78e2c6ccf16b41bc19a4cd69f959c8ae47e68b9d Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sat, 11 Aug 2001 14:01:54 +0000 Subject: I will not originate the same lsa before MINLSINTERVAL. --- proto/ospf/iface.c | 5 +++++ proto/ospf/iface.h | 1 + proto/ospf/neighbor.c | 4 ++-- proto/ospf/ospf.c | 12 ++++++++++-- proto/ospf/ospf.h | 1 + proto/ospf/topology.c | 15 +++++++++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) (limited to 'proto') diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 9cd4692..ac34d63 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -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; +} diff --git a/proto/ospf/iface.h b/proto/ospf/iface.h index 99a32bf..350f531 100644 --- a/proto/ospf/iface.h +++ b/proto/ospf/iface.h @@ -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_ */ diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index ca92e9d..cbb3e5e 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -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 && statetick 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; diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 3eb4659..11283a7 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -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; }; diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index a0dd18a..c07b1a7 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -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 * -- cgit v1.2.3