diff options
author | Ondrej Filip <feela@network.cz> | 2000-06-06 01:46:32 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-06-06 01:46:32 +0000 |
commit | 51cff78b2571e24963d3a81694f854605eb75eac (patch) | |
tree | fdf920c4632beac7809cb954268408c679445ad7 /proto/ospf/ospf.c | |
parent | c1824c4d4c7753246ba26d27c7a3b7be3006d46b (diff) |
Allocate OSPF areas before interfaces.
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r-- | proto/ospf/ospf.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 2c898288..c20ff6cc 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -12,13 +12,44 @@ static int ospf_start(struct proto *p) { struct proto_ospf *po=(struct proto_ospf *)p; + struct ospf_config *c=(struct ospf_config *)(p->cf); + struct ospf_area_config *ac; + struct ospf_area *oa; debug("%s: Start\n",p->name); fib_init(&po->efib,p->pool,sizeof(struct extfib),16,init_efib); init_list(&(po->iface_list)); init_list(&(po->area_list)); po->areano=0; + if(EMPTY_LIST(c->area_list)) + { + log("%s: Cannot start, no OSPF areas configured", p->name); + return PS_DOWN; + } + WALK_LIST(ac,c->area_list) + { + oa=mb_allocz(po->proto.pool, sizeof(struct ospf_area)); + add_tail(&po->area_list,NODE oa); + po->areano++; + oa->stub=ac->stub; + oa->tick=ac->tick; + oa->areaid=ac->areaid; + oa->gr=ospf_top_new(po); + s_init_list(&(oa->lsal)); + oa->rt=NULL; + oa->po=po; + oa->disp_timer=tm_new(po->proto.pool); + oa->disp_timer->data=oa; + oa->disp_timer->randomize=0; + oa->disp_timer->hook=area_disp; + oa->disp_timer->recurrent=oa->tick; + oa->lage=now; + tm_start(oa->disp_timer,oa->tick); + oa->calcrt=0; + oa->origrt=0; + fib_init(&oa->infib,po->proto.pool,sizeof(struct infib),16,init_infib); + } return PS_UP; } |