From 7ab3ff6a287d6adc8f1d371d9da1504de502c8a6 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Wed, 7 Jun 2000 21:46:22 +0000 Subject: Doc in neighbor.c and some tiny changes related to. --- proto/ospf/neighbor.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'proto/ospf/neighbor.c') diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index ef674a1..ddc2e62 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -1,7 +1,7 @@ /* * BIRD -- OSPF * - * (c) 1999 Ondrej Filip + * (c) 1999 - 2000 Ondrej Filip * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -22,6 +22,15 @@ const char *ospf_inm[]={ "hello received", "neighbor start", "2-way received", "adjacency ok?", "sequence mismatch", "1-way received", "kill neighbor", "inactivity timer", "line down" }; +/** + * neigh_chstate - handles changes related to new or lod state of neighbor + * @n: OSPF neighbor + * @state: new state + * + * Many actions has to be taken acording to state change of neighbor. It + * starts rxmt timers, call interface state machine etc. + */ + void neigh_chstate(struct ospf_neighbor *n, u8 state) { @@ -49,14 +58,14 @@ neigh_chstate(struct ospf_neighbor *n, u8 state) { ifa->fadj--; schedule_rt_lsa(ifa->oa); - originate_net_lsa(ifa,po); + originate_net_lsa(ifa); } if(state==NEIGHBOR_FULL) /* Increase number of adjacencies */ { ifa->fadj++; schedule_rt_lsa(ifa->oa); - originate_net_lsa(ifa,po); + originate_net_lsa(ifa); } if(oldstate>=NEIGHBOR_EXSTART && statenbma_list . + */ void ospf_neigh_sm(struct ospf_neighbor *n, int event) - /* Interface state machine */ { struct proto *p=(struct proto *)(n->ifa->proto); struct proto_ospf *po=n->ifa->proto; @@ -217,7 +237,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event) { case INM_START: neigh_chstate(n,NEIGHBOR_ATTEMPT); - /* FIXME No NBMA now */ + /* NBMA are used different way */ break; case INM_HELLOREC: switch(n->state) @@ -298,14 +318,22 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event) } } +/** + * bdr_election - (Backup) Designed Router election + * @ifa: actual interface + * + * When wait time fires, it time to elect (Backup) Designed Router. + * Structure describing me is added to this list so every electing router + * has the same list. Backup Designed Router is elected before Designed + * Router. This process is described in 9.4 of RFC 2328. + */ void -bdr_election(struct ospf_iface *ifa, struct proto *p) +bdr_election(struct ospf_iface *ifa) { struct ospf_neighbor *neigh,*ndr,*nbdr,me,*tmp; u32 myid, ndrid, nbdrid; int doadj; - - p=(struct proto *)(ifa->proto); + struct proto *p=&ifa->proto->proto; DBG("%s: (B)DR election.\n",p->name); @@ -323,7 +351,7 @@ bdr_election(struct ospf_iface *ifa, struct proto *p) nbdr=electbdr(ifa->neigh_list); ndr=electdr(ifa->neigh_list); - if(ndr==NULL) ndr=nbdr; /* FIXME is this correct? */ + if(ndr==NULL) ndr=nbdr; if(((ifa->drid==myid) && (ndr!=&me)) || ((ifa->drid!=myid) && (ndr==&me)) @@ -511,7 +539,6 @@ ospf_sh_neigh_info(struct ospf_neighbor *n) if(n->rid==ifa->bdrid) pos="bdr "; if(n->ifa->type==OSPF_IT_PTP) pos="ptp "; - cli_msg(-1013,"%-18I\t%3u\t%s/%s\t%-5s\t%-18I\t%-10s",n->rid, n->priority, ospf_ns[n->state], pos, etime, n->ip,ifa->iface->name); } -- cgit v1.2.3