Fixed bug receiving dbdes packets in EXSTART state.

This commit is contained in:
Ondrej Filip 1999-11-17 13:15:01 +00:00
parent 62a4639548
commit e17baa3108

View file

@ -57,7 +57,8 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
(pkt+1),ntohs(pkt->length)-sizeof(struct ospf_packet),NULL); (pkt+1),ntohs(pkt->length)-sizeof(struct ospf_packet),NULL);
} }
void ospf_dbdes_tx(struct ospf_iface *ifa) void
ospf_dbdes_tx(struct ospf_iface *ifa)
{ {
struct ospf_dbdes_packet *pkt; struct ospf_dbdes_packet *pkt;
struct ospf_packet *op; struct ospf_packet *op;
@ -123,6 +124,8 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct proto *p; struct proto *p;
if(n->state!=state)
{
ifa=n->ifa; ifa=n->ifa;
p=(struct proto *)(ifa->proto); p=(struct proto *)(ifa->proto);
@ -130,6 +133,7 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
n->state, state); n->state, state);
n->state=state; n->state=state;
} }
}
/* Try to build neighbor adjacency (if does not exists) */ /* Try to build neighbor adjacency (if does not exists) */
@ -410,6 +414,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event)
break; break;
case INM_SEQMIS: case INM_SEQMIS:
case INM_BADLSREQ: case INM_BADLSREQ:
debug("%s: Bad LS req!\n", p->name);
if(n->state>=NEIGHBOR_EXCHANGE) if(n->state>=NEIGHBOR_EXCHANGE)
{ {
neigh_chstate(n,NEIGHBOR_EXSTART); neigh_chstate(n,NEIGHBOR_EXSTART);
@ -615,13 +620,6 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
ospf_neigh_sm(n, INM_2WAYREC); ospf_neigh_sm(n, INM_2WAYREC);
if(n->state!=NEIGHBOR_EXSTART) return; if(n->state!=NEIGHBOR_EXSTART) return;
case NEIGHBOR_EXSTART: case NEIGHBOR_EXSTART:
if(size!=sizeof(struct ospf_dbdes_packet))
{
debug("%s: Received bad dbdes from %u in exstart state.\n",
p->name, nrid);
return;
}
if(ps->imms==(DBDES_I|DBDES_M|DBDES_MS) && (n->rid > myrid) && if(ps->imms==(DBDES_I|DBDES_M|DBDES_MS) && (n->rid > myrid) &&
(size == sizeof(struct ospf_dbdes_packet))) (size == sizeof(struct ospf_dbdes_packet)))
{ {
@ -650,10 +648,11 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
{ {
debug("%s: Nothing happend to %u (imms=%u)", p->name, nrid, debug("%s: Nothing happend to %u (imms=%u)", p->name, nrid,
ps->imms); ps->imms);
}
}
break; break;
}
}
break; /* I should probably continue processing packet */
case NEIGHBOR_EXCHANGE: case NEIGHBOR_EXCHANGE:
if((ps->imms==n->imms) && (ps->options=n->options) && if((ps->imms==n->imms) && (ps->options=n->options) &&
(ps->ddseq==n->dds)) (ps->ddseq==n->dds))
@ -667,6 +666,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
else else
{ {
/* FIXME: Send response! */ /* FIXME: Send response! */
return;
} }
} }