diff options
author | Ondrej Filip <feela@network.cz> | 2000-05-02 22:19:41 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-05-02 22:19:41 +0000 |
commit | c45f48fba5a0904f9c3512c3b42c38183fef348b (patch) | |
tree | 3679fc0a54a1bc3f316d6024d4c90d4997d065ff /proto/ospf/topology.c | |
parent | a92847e78fabd637938f324c78d5eb41538a5692 (diff) |
Aging of lsa database added.
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r-- | proto/ospf/topology.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index b448f51f..a69c01a2 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -150,17 +150,33 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length, struct proto_ospf *p) sizeof(struct ospf_lsa_header); return rt; } + +void +age_timer_hook(timer *timer) +{ + struct ospf_area *oa=timer->data; + bird_clock_t delta; + struct top_hash_entry *en,*nxt; + int flush=0; + + /* FIXME Fill flush! */ + + if((delta=now-oa->lage)>=AGINGDELTA) + { + WALK_SLIST_DELSAFE(en,nxt,oa->lsal) ospf_age(en,delta,flush,&oa->po->proto); + oa->lage=now; + } +} void addifa_rtlsa(struct ospf_iface *ifa) { struct ospf_area *oa; - struct proto_ospf *po; + struct proto_ospf *po=ifa->proto; u32 rtid; struct top_graph_rtlsa_link *li, *lih; - po=ifa->proto; rtid=po->proto.cf->global->router_id; DBG("%s: New OSPF area \"%d\" adding.\n", po->proto.name, ifa->an); oa=NULL; @@ -181,6 +197,14 @@ addifa_rtlsa(struct ospf_iface *ifa) oa->gr=ospf_top_new(po); s_init_list(&(oa->lsal)); oa->rt=NULL; + oa->lage=now; + oa->po=po; + oa->age_timer=tm_new(po->proto.pool); + oa->age_timer->data=oa; + oa->age_timer->randomize=0; + oa->age_timer->hook=age_timer_hook; + oa->age_timer->recurrent=AGINGDELTA; + tm_start(oa->age_timer,AGINGDELTA); po->areano++; DBG("%s: New OSPF area \"%d\" added.\n", po->proto.name, ifa->an); } |