0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Many bugfixes. Actually, how could this ever work? :-)

This commit is contained in:
Ondrej Filip 2000-05-09 13:56:47 +00:00
parent 5d608eba16
commit 5f743d9697
5 changed files with 15 additions and 22 deletions

View File

@ -38,11 +38,12 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
op->length=htons(length); op->length=htons(length);
ospf_pkt_finalize(ifa, op); ospf_pkt_finalize(ifa, op);
sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO); sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO);
debug("%s: DB_DES (I) sent for %I.\n", p->name, n->rid); debug("%s: DB_DES (I) sent to %I.\n", p->name, n->rid);
break; break;
case NEIGHBOR_EXCHANGE: case NEIGHBOR_EXCHANGE:
n->myimms.bit.i=0; 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)))
{ {
@ -57,7 +58,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
pkt->options= ifa->options; pkt->options= ifa->options;
pkt->ddseq=htonl(n->dds); pkt->ddseq=htonl(n->dds);
j=i=(ifa->iface->mtu-sizeof(struct ospf_dbdes_packet))/ j=i=(ifa->iface->mtu-sizeof(struct ospf_dbdes_packet)-SIPH)/
sizeof(struct ospf_lsa_header); /* Number of lsaheaders */ sizeof(struct ospf_lsa_header); /* Number of lsaheaders */
lsa=(n->ldbdes+sizeof(struct ospf_dbdes_packet)); lsa=(n->ldbdes+sizeof(struct ospf_dbdes_packet));
@ -73,17 +74,17 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
en=(struct top_hash_entry *)sn; en=(struct top_hash_entry *)sn;
htonlsah(&(en->lsa), lsa); htonlsah(&(en->lsa), lsa);
DBG("Working on: %d\n", i); DBG("Working on: %d\n", i);
debug("\t%04x %08x %08x %p\n", en->lsa.type, en->lsa.id, DBG("\tX%01x %08I %08I %p\n", en->lsa.type, en->lsa.id,
en->lsa.rt, en->lsa_body); en->lsa.rt, en->lsa_body);
if(sn==STAIL(n->ifa->oa->lsal)) if(sn==STAIL(n->ifa->oa->lsal))
{ {
break; /* Should set some flag? */ break; /* Should set some flag? */
i--;
} }
sn=sn->next; sn=sn->next;
lsa++; lsa++;
} }
i--;
if(sn==STAIL(n->ifa->oa->lsal)) if(sn==STAIL(n->ifa->oa->lsal))
{ {
@ -91,8 +92,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
DBG("M bit unset.\n"); DBG("M bit unset.\n");
n->myimms.bit.m=0; /* Unset more bit */ n->myimms.bit.m=0; /* Unset more bit */
} }
else s_put(&(n->dbsi),sn);
s_put(&(n->dbsi),sn);
} }
pkt->imms.byte=n->myimms.byte; pkt->imms.byte=n->myimms.byte;
@ -102,33 +102,24 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
op->length=htons(length); op->length=htons(length);
ospf_pkt_finalize(ifa, op); ospf_pkt_finalize(ifa, op);
DBG("%s: DB_DES (M) sent to %I.\n", p->name, n->rid);
} }
case NEIGHBOR_LOADING: case NEIGHBOR_LOADING:
case NEIGHBOR_FULL: case NEIGHBOR_FULL:
aa=ifa->ip_sk->tbuf; aa=ifa->ip_sk->tbuf;
bb=n->ldbdes; bb=n->ldbdes;
op=n->ldbdes; op=n->ldbdes;
length=ntohs(op->length); length=ntohs(op->length);
for(i=0; i<ifa->iface->mtu; i++) for(i=0; i<length; i++)
{ {
*(aa+i)=*(bb+i); /* Copy last sent packet again */ *(aa+i)=*(bb+i); /* Copy last sent packet again */
} }
{ DBG("%s: DB_DES sending to %I.\n", p->name, n->rid);
u8 ii;
u8 *jj=ifa->ip_sk->tbuf;
for(ii=0;ii<length;ii+=4)
{
DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3));
}
}
sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO); sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO);
DBG("%s: DB_DES sent to %I.\n", p->name, n->rid); debug("%s: DB_DES (M) sent to %I.\n", p->name, n->rid);
if(n->myimms.bit.ms) tm_start(n->rxmt_timer,ifa->rxmtint); if(n->myimms.bit.ms) tm_start(n->rxmt_timer,ifa->rxmtint);
else else
{ {

View File

@ -119,6 +119,8 @@ ospf_lsreq_rx(struct ospf_lsreq_packet *ps, struct proto *p,
if(ospf_hash_find(n->ifa->oa->gr, llsh->lsh.id, llsh->lsh.rt, if(ospf_hash_find(n->ifa->oa->gr, llsh->lsh.id, llsh->lsh.rt,
llsh->lsh.type)==NULL) llsh->lsh.type)==NULL)
{ {
debug("Received bad LS req from: %I looking: RT: %I, ID: %I, Type: %u",
n->ip, lsh->rt, lsh->id, lsh->type);
ospf_neigh_sm(n,INM_BADLSREQ); ospf_neigh_sm(n,INM_BADLSREQ);
rfree(upslab); rfree(upslab);
return; return;

View File

@ -168,7 +168,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
en=ospf_hash_find(n->ifa->oa->gr,llsh->lsh.id,llsh->lsh.rt,llsh->lsh.type); en=ospf_hash_find(n->ifa->oa->gr,llsh->lsh.id,llsh->lsh.rt,llsh->lsh.type);
DBG("Sending ID=%I, Type=%u, RT=%I\n", llsh->lsh.id, llsh->lsh.type, DBG("Sending ID=%I, Type=%u, RT=%I\n", llsh->lsh.id, llsh->lsh.type,
llsh->lsh.rt); llsh->lsh.rt);
if((len+sizeof(struct ospf_lsa_header)+en->lsa.length)>n->ifa->iface->mtu) if((len+en->lsa.length)>n->ifa->iface->mtu)
{ {
pk->lsano=htonl(lsano); pk->lsano=htonl(lsano);
op->length=htons(len); op->length=htons(len);

View File

@ -177,7 +177,7 @@ can_do_adj(struct ospf_neighbor *n)
break; break;
case OSPF_IS_DROTHER: case OSPF_IS_DROTHER:
if(((n->rid==ifa->drid) || (n->rid==ifa->bdrid)) if(((n->rid==ifa->drid) || (n->rid==ifa->bdrid))
&& (n->state==NEIGHBOR_2WAY)) i=1; && (n->state>=NEIGHBOR_2WAY)) i=1;
break; break;
case OSPF_IS_PTP: case OSPF_IS_PTP:
case OSPF_IS_BACKUP: case OSPF_IS_BACKUP:

View File

@ -504,7 +504,7 @@ ospf_top_dump(struct top_graph *f)
struct top_hash_entry *e = f->hash_table[i]; struct top_hash_entry *e = f->hash_table[i];
while (e) while (e)
{ {
debug("\t%04x %08I %08I %p\n", e->lsa.type, e->lsa.id, debug("\t%01x %08I %08I %p\n", e->lsa.type, e->lsa.id,
e->lsa.rt, e->lsa_body); e->lsa.rt, e->lsa_body);
e = e->next; e = e->next;
} }