Minor bug fix in neighbor state machine.
This commit is contained in:
parent
de259a41e3
commit
781aa475aa
4 changed files with 24 additions and 11 deletions
|
@ -39,6 +39,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
|
||||||
switch(n->state)
|
switch(n->state)
|
||||||
{
|
{
|
||||||
case NEIGHBOR_EXSTART: /* Send empty packets */
|
case NEIGHBOR_EXSTART: /* Send empty packets */
|
||||||
|
n->myimms.bit.i=1;
|
||||||
pkt=(struct ospf_dbdes_packet *)(ifa->ip_sk->tbuf);
|
pkt=(struct ospf_dbdes_packet *)(ifa->ip_sk->tbuf);
|
||||||
op=(struct ospf_packet *)pkt;
|
op=(struct ospf_packet *)pkt;
|
||||||
fill_ospf_pkt_hdr(ifa, pkt, DBDES_P);
|
fill_ospf_pkt_hdr(ifa, pkt, DBDES_P);
|
||||||
|
@ -55,6 +56,8 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NEIGHBOR_EXCHANGE:
|
case NEIGHBOR_EXCHANGE:
|
||||||
|
n->myimms.bit.i=0;
|
||||||
|
|
||||||
if(((n->myimms.bit.ms) && (n->dds==n->ddr+1)) ||
|
if(((n->myimms.bit.ms) && (n->dds==n->ddr+1)) ||
|
||||||
((!(n->myimms.bit.ms)) && (n->dds==n->ddr)))
|
((!(n->myimms.bit.ms)) && (n->dds==n->ddr)))
|
||||||
{
|
{
|
||||||
|
@ -139,6 +142,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
|
||||||
{
|
{
|
||||||
ospf_neigh_sm(n, INM_EXDONE);
|
ospf_neigh_sm(n, INM_EXDONE);
|
||||||
if(n->myimms.bit.ms) tm_stop(n->rxmt_timer);
|
if(n->myimms.bit.ms) tm_stop(n->rxmt_timer);
|
||||||
|
else tm_start(n->rxmt_timer,ifa->rxmtint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -277,7 +281,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(ps->imms.bit.i) break;
|
||||||
case NEIGHBOR_EXCHANGE:
|
case NEIGHBOR_EXCHANGE:
|
||||||
if((ps->imms.byte==n->imms.byte) && (ps->options==n->options) &&
|
if((ps->imms.byte==n->imms.byte) && (ps->options==n->options) &&
|
||||||
(ntohl(ps->ddseq)==n->ddr))
|
(ntohl(ps->ddseq)==n->ddr))
|
||||||
|
@ -295,14 +299,14 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
|
||||||
|
|
||||||
if(ps->imms.bit.ms!=n->imms.bit.ms) /* M/S bit differs */
|
if(ps->imms.bit.ms!=n->imms.bit.ms) /* M/S bit differs */
|
||||||
{
|
{
|
||||||
DBG("SEQMIS-BIT-MS\n");
|
log("SEQMIS-BIT-MS\n");
|
||||||
ospf_neigh_sm(n, INM_SEQMIS);
|
ospf_neigh_sm(n, INM_SEQMIS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ps->imms.bit.i) /* I bit is set */
|
if(ps->imms.bit.i) /* I bit is set */
|
||||||
{
|
{
|
||||||
DBG("SEQMIS-BIT-I\n");
|
log("SEQMIS-BIT-I\n");
|
||||||
ospf_neigh_sm(n, INM_SEQMIS);
|
ospf_neigh_sm(n, INM_SEQMIS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +315,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
|
||||||
|
|
||||||
if(ps->options!=n->options) /* Options differs */
|
if(ps->options!=n->options) /* Options differs */
|
||||||
{
|
{
|
||||||
DBG("SEQMIS-OPT\n");
|
log("SEQMIS-OPT\n");
|
||||||
ospf_neigh_sm(n, INM_SEQMIS);
|
ospf_neigh_sm(n, INM_SEQMIS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -320,7 +324,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
|
||||||
{
|
{
|
||||||
if(ntohl(ps->ddseq)!=n->dds) /* MASTER */
|
if(ntohl(ps->ddseq)!=n->dds) /* MASTER */
|
||||||
{
|
{
|
||||||
DBG("SEQMIS-MASTER\n");
|
log("SEQMIS-MASTER\n");
|
||||||
ospf_neigh_sm(n, INM_SEQMIS);
|
ospf_neigh_sm(n, INM_SEQMIS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +345,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
|
||||||
{
|
{
|
||||||
if(ntohl(ps->ddseq)!=(n->dds+1)) /* SLAVE */
|
if(ntohl(ps->ddseq)!=(n->dds+1)) /* SLAVE */
|
||||||
{
|
{
|
||||||
DBG("SEQMIS-SLAVE\n");
|
log("SEQMIS-SLAVE\n");
|
||||||
ospf_neigh_sm(n, INM_SEQMIS);
|
ospf_neigh_sm(n, INM_SEQMIS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -362,7 +366,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBG("SEQMIS-FULL\n");
|
log("SEQMIS-FULL\n");
|
||||||
ospf_neigh_sm(n, INM_SEQMIS);
|
ospf_neigh_sm(n, INM_SEQMIS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ospf.h"
|
#include "ospf.h"
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include "lib/sysio.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
install_inactim(struct ospf_neighbor *n)
|
install_inactim(struct ospf_neighbor *n)
|
||||||
|
@ -59,8 +61,7 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
|
||||||
{
|
{
|
||||||
u32 nrid, *pnrid;
|
u32 nrid, *pnrid;
|
||||||
struct ospf_neighbor *neigh,*n;
|
struct ospf_neighbor *neigh,*n;
|
||||||
u8 twoway,oldpriority;
|
u8 i,twoway,oldpriority;
|
||||||
u32 i;
|
|
||||||
ip_addr olddr,oldbdr;
|
ip_addr olddr,oldbdr;
|
||||||
ip_addr mask;
|
ip_addr mask;
|
||||||
char *beg=": Bad OSPF hello packet from ", *rec=" received: ";
|
char *beg=": Bad OSPF hello packet from ", *rec=" received: ";
|
||||||
|
|
|
@ -47,8 +47,9 @@ iface_chstate(struct ospf_iface *ifa, u8 state)
|
||||||
DBG("%s: Adding new multicast socket for (B)DR\n", p->name);
|
DBG("%s: Adding new multicast socket for (B)DR\n", p->name);
|
||||||
ifa->dr_sk=sk_new(p->pool);
|
ifa->dr_sk=sk_new(p->pool);
|
||||||
ifa->dr_sk->type=SK_IP_MC;
|
ifa->dr_sk->type=SK_IP_MC;
|
||||||
|
ifa->dr_sk->sport=0;
|
||||||
ifa->dr_sk->dport=OSPF_PROTO;
|
ifa->dr_sk->dport=OSPF_PROTO;
|
||||||
ifa->dr_sk->saddr=AllDRouters;
|
ifa->dr_sk->saddr=ipa_from_u32(0);
|
||||||
ifa->dr_sk->daddr=AllDRouters;
|
ifa->dr_sk->daddr=AllDRouters;
|
||||||
ifa->dr_sk->tos=IP_PREC_INTERNET_CONTROL;
|
ifa->dr_sk->tos=IP_PREC_INTERNET_CONTROL;
|
||||||
ifa->dr_sk->ttl=1;
|
ifa->dr_sk->ttl=1;
|
||||||
|
@ -222,8 +223,9 @@ ospf_open_mc_socket(struct ospf_iface *ifa)
|
||||||
|
|
||||||
mcsk=sk_new(p->pool);
|
mcsk=sk_new(p->pool);
|
||||||
mcsk->type=SK_IP_MC;
|
mcsk->type=SK_IP_MC;
|
||||||
|
mcsk->sport=0;
|
||||||
mcsk->dport=OSPF_PROTO;
|
mcsk->dport=OSPF_PROTO;
|
||||||
mcsk->saddr=AllSPFRouters;
|
mcsk->saddr=ipa_from_u32(0);
|
||||||
mcsk->daddr=AllSPFRouters;
|
mcsk->daddr=AllSPFRouters;
|
||||||
mcsk->tos=IP_PREC_INTERNET_CONTROL;
|
mcsk->tos=IP_PREC_INTERNET_CONTROL;
|
||||||
mcsk->ttl=1;
|
mcsk->ttl=1;
|
||||||
|
|
|
@ -67,6 +67,11 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
|
||||||
schedule_rt_lsa(ifa->oa);
|
schedule_rt_lsa(ifa->oa);
|
||||||
schedule_net_lsa(ifa);
|
schedule_net_lsa(ifa);
|
||||||
}
|
}
|
||||||
|
if(oldstate>=NEIGHBOR_EXSTART && state<NEIGHBOR_EXSTART)
|
||||||
|
{
|
||||||
|
/* Stop RXMT timer */
|
||||||
|
tm_stop(n->rxmt_timer);
|
||||||
|
}
|
||||||
if(state==NEIGHBOR_EXSTART)
|
if(state==NEIGHBOR_EXSTART)
|
||||||
{
|
{
|
||||||
if(n->adj==0) /* First time adjacency */
|
if(n->adj==0) /* First time adjacency */
|
||||||
|
@ -294,6 +299,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INM_SEQMIS:
|
case INM_SEQMIS:
|
||||||
|
OSPF_TRACE(D_EVENTS, "Seq mis!");
|
||||||
case INM_BADLSREQ:
|
case INM_BADLSREQ:
|
||||||
OSPF_TRACE(D_EVENTS, "Bad LS req!");
|
OSPF_TRACE(D_EVENTS, "Bad LS req!");
|
||||||
if(n->state>=NEIGHBOR_EXCHANGE)
|
if(n->state>=NEIGHBOR_EXCHANGE)
|
||||||
|
|
Loading…
Reference in a new issue