0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

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); 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_if_notify(struct proto *p, unsigned flags, struct iface *iface);
void ospf_iface_info(struct ospf_iface *ifa); void ospf_iface_info(struct ospf_iface *ifa);
void ospf_ifa_add(struct object_lock *lock); void ospf_ifa_add(struct object_lock *lock);
void schedule_net_lsa(struct ospf_iface *ifa);
#endif /* _BIRD_OSPF_IFACE_H_ */ #endif /* _BIRD_OSPF_IFACE_H_ */

View File

@ -58,14 +58,14 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
{ {
ifa->fadj--; ifa->fadj--;
schedule_rt_lsa(ifa->oa); schedule_rt_lsa(ifa->oa);
originate_net_lsa(ifa); schedule_net_lsa(ifa);
} }
if(state==NEIGHBOR_FULL) /* Increase number of adjacencies */ if(state==NEIGHBOR_FULL) /* Increase number of adjacencies */
{ {
ifa->fadj++; ifa->fadj++;
schedule_rt_lsa(ifa->oa); schedule_rt_lsa(ifa->oa);
originate_net_lsa(ifa); schedule_net_lsa(ifa);
} }
if(oldstate>=NEIGHBOR_EXSTART && state<NEIGHBOR_EXSTART) 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 * @timer: it's called every @ospf_area->tick seconds
* *
* It ivokes aging and when @ospf_area->origrt is set to 1, start * 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. * table calculation when @ospf_area->calcrt is set.
*/ */
void void
@ -273,13 +274,20 @@ area_disp(timer *timer)
{ {
struct ospf_area *oa=timer->data; struct ospf_area *oa=timer->data;
struct top_hash_entry *en,*nxt; struct top_hash_entry *en,*nxt;
struct proto_ospf *po=oa->po;
struct ospf_iface *ifa;
/* First of all try to age LSA DB */ /* First of all try to age LSA DB */
ospf_age(oa); ospf_age(oa);
/* Now try to originage rt_lsa */ /* Now try to originage rt_lsa */
if(oa->origrt) originate_rt_lsa(oa); 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); if(oa->calcrt) ospf_rt_spfa(oa);
oa->calcrt=0; oa->calcrt=0;

View File

@ -136,6 +136,7 @@ struct ospf_iface {
* - using 4*HELLO * - using 4*HELLO
*/ */
struct top_hash_entry *nlsa; /* Originated net lsa */ struct top_hash_entry *nlsa; /* Originated net lsa */
int orignet; /* Schedule network LSA origination */
int fadj; /* Number of full adjacent neigh */ int fadj; /* Number of full adjacent neigh */
list nbma_list; list nbma_list;
}; };

View File

@ -189,6 +189,13 @@ originate_rt_lsa(struct ospf_area *oa)
struct top_hash_entry *en; struct top_hash_entry *en;
void *body; 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); OSPF_TRACE(D_EVENTS, "Originating RT_lsa for area \"%I\".",oa->areaid);
lsa.age=0; lsa.age=0;
@ -210,6 +217,7 @@ originate_rt_lsa(struct ospf_area *oa)
oa->rt=en; oa->rt=en;
flood_lsa(NULL,NULL,&oa->rt->lsa,po,NULL,oa,1); flood_lsa(NULL,NULL,&oa->rt->lsa,po,NULL,oa,1);
schedule_rtcalc(oa); schedule_rtcalc(oa);
oa->origrt=0;
} }
void * void *
@ -260,6 +268,12 @@ originate_net_lsa(struct ospf_iface *ifa)
struct proto *p=&po->proto; struct proto *p=&po->proto;
void *body; 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\".", OSPF_TRACE(D_EVENTS, "Originating Net lsa for iface \"%s\".",
ifa->iface->name); ifa->iface->name);
@ -300,6 +314,7 @@ originate_net_lsa(struct ospf_iface *ifa)
lsasum_calculate(&lsa,body,po); lsasum_calculate(&lsa,body,po);
ifa->nlsa=lsa_install_new(&lsa, body, ifa->oa); ifa->nlsa=lsa_install_new(&lsa, body, ifa->oa);
flood_lsa(NULL,NULL,&ifa->nlsa->lsa,po,NULL,ifa->oa,1); flood_lsa(NULL,NULL,&ifa->nlsa->lsa,po,NULL,ifa->oa,1);
ifa->orignet=0;
} }
static void * static void *