diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/ospf/iface.c | 3 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 5 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 1 | ||||
-rw-r--r-- | proto/ospf/topology.c | 34 | ||||
-rw-r--r-- | proto/ospf/topology.h | 1 |
5 files changed, 43 insertions, 1 deletions
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 0ee5e685..cd8b035d 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -40,6 +40,7 @@ ospf_int_sm(struct ospf_iface *ifa, int event) case ISM_UP: if(ifa->state==OSPF_IS_DOWN) { + /* Now, nothing should be adjacent */ restart_hellotim(ifa); if((ifa->type==OSPF_IT_PTP) || (ifa->type==OSPF_IT_VLINK)) { @@ -57,6 +58,7 @@ ospf_int_sm(struct ospf_iface *ifa, int event) restart_waittim(ifa); } } + addifa_rtlsa(ifa); } break; case ISM_BACKS: @@ -307,6 +309,7 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface) ifa->waitint=0; ospf_add_timers(ifa,p->pool); add_tail(&((struct proto_ospf *)p)->iface_list, NODE ifa); + ifa->state=OSPF_IS_DOWN; ospf_int_sm(ifa, ISM_UP); } diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 1805ac3f..1cf6175a 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -22,7 +22,10 @@ ospf_start(struct proto *p) po->firstarea->gr=ospf_top_new(po); po->firstarea->next=NULL; po->firstarea->areaid=0; - + + po->areano=0; /* Waiting for interfaces comming up */ + po->firstarea=NULL; + po->areaslab=sl_new(p->pool, sizeof(struct ospf_area)); return PS_UP; } diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 647debad..05e79e73 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -220,6 +220,7 @@ struct proto_ospf { list iface_list; /* Interfaces we really use */ int areano; /* Number of area I belong to */ struct ospf_area *firstarea; + slab *areaslab; }; static int ospf_start(struct proto *p); diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index db2065bb..60dbd4f9 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -23,6 +23,40 @@ #define HASH_LO_STEP 2 #define HASH_LO_MIN 8 +void +addifa_rtlsa(struct ospf_iface *ifa) +{ + struct ospf_area *oa; + struct proto_ospf *po; + + po=ifa->proto; + oa=po->firstarea; + + while(oa!=NULL) + { + if(oa->areaid==ifa->area) break; + oa=oa->next; + } + + if(oa!=NULL) /* Known area */ + { + /**/; + } + else /* New area */ + { + po->areano++; + oa=po->firstarea; + po->firstarea=sl_alloc(po->areaslab); + po->firstarea->next=oa; + po->firstarea->areaid=ifa->area; + po->firstarea->gr=ospf_top_new(po); + } + + /* FIXME Go on, change router lsa, bits and so on... */ +} + + + static void ospf_top_ht_alloc(struct top_graph *f) { diff --git a/proto/ospf/topology.h b/proto/ospf/topology.h index f102851a..ec0704cd 100644 --- a/proto/ospf/topology.h +++ b/proto/ospf/topology.h @@ -36,6 +36,7 @@ void ospf_top_dump(struct top_graph *); struct top_hash_entry *ospf_hash_find(struct top_graph *, u32 lsa, u32 rtr, u32 type); struct top_hash_entry *ospf_hash_get(struct top_graph *, u32 lsa, u32 rtr, u32 type); void ospf_hash_delete(struct top_graph *, struct top_hash_entry *); +void addifa_rtlsa(struct ospf_iface *ifa); struct top_graph_rtlsa { u8 Vbit; |