I will not originate the same lsa before MINLSINTERVAL.

This commit is contained in:
Ondrej Filip 2001-08-11 14:01:54 +00:00
parent 5fc7c5c513
commit 78e2c6ccf1
6 changed files with 34 additions and 4 deletions

View 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;
}

View 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_ */

View 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)
{

View 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;

View 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;
};

View 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 *