From 5f743d969739d6dca12b51561baac3131e160429 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Tue, 9 May 2000 13:56:47 +0000 Subject: [PATCH] Many bugfixes. Actually, how could this ever work? :-) --- proto/ospf/dbdes.c | 29 ++++++++++------------------- proto/ospf/lsreq.c | 2 ++ proto/ospf/lsupd.c | 2 +- proto/ospf/neighbor.c | 2 +- proto/ospf/topology.c | 2 +- 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 89d0fbbf..ecffbe61 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -38,11 +38,12 @@ ospf_dbdes_tx(struct ospf_neighbor *n) op->length=htons(length); ospf_pkt_finalize(ifa, op); 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; case NEIGHBOR_EXCHANGE: n->myimms.bit.i=0; + if(((n->myimms.bit.ms) && (n->dds==n->ddr+1)) || ((!(n->myimms.bit.ms)) && (n->dds==n->ddr))) { @@ -57,7 +58,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n) pkt->options= ifa->options; 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 */ 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; htonlsah(&(en->lsa), lsa); 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); if(sn==STAIL(n->ifa->oa->lsal)) { break; /* Should set some flag? */ + i--; } sn=sn->next; lsa++; } - i--; if(sn==STAIL(n->ifa->oa->lsal)) { @@ -91,8 +92,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n) DBG("M bit unset.\n"); n->myimms.bit.m=0; /* Unset more bit */ } - - s_put(&(n->dbsi),sn); + else s_put(&(n->dbsi),sn); } pkt->imms.byte=n->myimms.byte; @@ -102,33 +102,24 @@ ospf_dbdes_tx(struct ospf_neighbor *n) op->length=htons(length); ospf_pkt_finalize(ifa, op); + DBG("%s: DB_DES (M) sent to %I.\n", p->name, n->rid); } case NEIGHBOR_LOADING: case NEIGHBOR_FULL: - aa=ifa->ip_sk->tbuf; bb=n->ldbdes; op=n->ldbdes; length=ntohs(op->length); - for(i=0; iiface->mtu; i++) + for(i=0; iip_sk->tbuf; - - for(ii=0;iiname, n->rid); 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); else { diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c index 580fd1db..85d6e39b 100644 --- a/proto/ospf/lsreq.c +++ b/proto/ospf/lsreq.c @@ -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, 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); rfree(upslab); return; diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 1c1b7c42..7ea891e6 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -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); DBG("Sending ID=%I, Type=%u, RT=%I\n", llsh->lsh.id, llsh->lsh.type, 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); op->length=htons(len); diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index e177c987..96449d19 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -177,7 +177,7 @@ can_do_adj(struct ospf_neighbor *n) break; case OSPF_IS_DROTHER: if(((n->rid==ifa->drid) || (n->rid==ifa->bdrid)) - && (n->state==NEIGHBOR_2WAY)) i=1; + && (n->state>=NEIGHBOR_2WAY)) i=1; break; case OSPF_IS_PTP: case OSPF_IS_BACKUP: diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 81d95785..b391be5d 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -504,7 +504,7 @@ ospf_top_dump(struct top_graph *f) struct top_hash_entry *e = f->hash_table[i]; 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 = e->next; }