Small cleanup.
This commit is contained in:
parent
551d444382
commit
4057093fa4
1 changed files with 16 additions and 14 deletions
|
@ -19,41 +19,43 @@ const char *ospf_inm[]={ "hello received", "neighbor start", "2-way received",
|
||||||
void
|
void
|
||||||
neigh_chstate(struct ospf_neighbor *n, u8 state)
|
neigh_chstate(struct ospf_neighbor *n, u8 state)
|
||||||
{
|
{
|
||||||
struct ospf_iface *ifa;
|
|
||||||
struct proto *p;
|
|
||||||
u8 oldstate;
|
u8 oldstate;
|
||||||
|
|
||||||
oldstate=n->state;
|
oldstate=n->state;
|
||||||
|
|
||||||
if(oldstate!=state)
|
if(oldstate!=state)
|
||||||
{
|
{
|
||||||
ifa=n->ifa;
|
struct ospf_iface *ifa=n->ifa;
|
||||||
|
struct proto_ospf *po=ifa->oa->po;
|
||||||
|
struct proto *p=&po->proto;
|
||||||
|
|
||||||
n->state=state;
|
n->state=state;
|
||||||
|
|
||||||
|
debug("%s: Neighbor %I changes state from \"%s\" to \"%s\".\n",
|
||||||
|
p->name, n->ip, ospf_ns[oldstate], ospf_ns[state]);
|
||||||
|
|
||||||
if((state==NEIGHBOR_2WAY) && (oldstate<NEIGHBOR_2WAY))
|
if((state==NEIGHBOR_2WAY) && (oldstate<NEIGHBOR_2WAY))
|
||||||
ospf_int_sm(n->ifa, ISM_NEICH);
|
ospf_int_sm(ifa, ISM_NEICH);
|
||||||
if((state<NEIGHBOR_2WAY) && (oldstate>=NEIGHBOR_2WAY))
|
if((state<NEIGHBOR_2WAY) && (oldstate>=NEIGHBOR_2WAY))
|
||||||
ospf_int_sm(n->ifa, ISM_NEICH);
|
ospf_int_sm(ifa, ISM_NEICH);
|
||||||
|
|
||||||
if(oldstate==NEIGHBOR_FULL) /* Decrease number of adjacencies */
|
if(oldstate==NEIGHBOR_FULL) /* Decrease number of adjacencies */
|
||||||
{
|
{
|
||||||
ifa->fadj--;
|
ifa->fadj--;
|
||||||
n->state=state;
|
originate_rt_lsa(ifa->oa,po);
|
||||||
originate_rt_lsa(ifa->oa,ifa->oa->po);
|
originate_net_lsa(ifa,po);
|
||||||
originate_net_lsa(ifa,ifa->oa->po);
|
|
||||||
}
|
}
|
||||||
p=(struct proto *)(ifa->proto);
|
|
||||||
|
|
||||||
debug("%s: Neighbor %I changes state from \"%s\" to \"%s\".\n",
|
|
||||||
p->name, n->ip, ospf_ns[oldstate], ospf_ns[state]);
|
|
||||||
if(state==NEIGHBOR_FULL) /* Increase number of adjacencies */
|
if(state==NEIGHBOR_FULL) /* Increase number of adjacencies */
|
||||||
{
|
{
|
||||||
ifa->fadj++;
|
ifa->fadj++;
|
||||||
originate_rt_lsa(n->ifa->oa,n->ifa->oa->po);
|
originate_rt_lsa(ifa->oa,po);
|
||||||
originate_net_lsa(ifa,ifa->oa->po);
|
originate_net_lsa(ifa,po);
|
||||||
}
|
}
|
||||||
if(oldstate>=NEIGHBOR_EXSTART && state<NEIGHBOR_EXSTART)
|
if(oldstate>=NEIGHBOR_EXSTART && state<NEIGHBOR_EXSTART)
|
||||||
{
|
{
|
||||||
|
/* Stop RXMT timer */
|
||||||
tm_stop(n->rxmt_timer);
|
tm_stop(n->rxmt_timer);
|
||||||
/* Stop RXMT timers */
|
|
||||||
}
|
}
|
||||||
if(state==NEIGHBOR_EXSTART)
|
if(state==NEIGHBOR_EXSTART)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue