]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Many bugfixes. Actually, how could this ever work? :-)
authorOndrej Filip <feela@network.cz>
Tue, 9 May 2000 13:56:47 +0000 (13:56 +0000)
committerOndrej Filip <feela@network.cz>
Tue, 9 May 2000 13:56:47 +0000 (13:56 +0000)
proto/ospf/dbdes.c
proto/ospf/lsreq.c
proto/ospf/lsupd.c
proto/ospf/neighbor.c
proto/ospf/topology.c

index 89d0fbbf576db44a630583c781f185ef1679b7d6..ecffbe614d4cd0f2a33c3dec85a530e92e657d8d 100644 (file)
@@ -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; i<ifa->iface->mtu; i++)
+      for(i=0; i<length; i++)
       {
         *(aa+i)=*(bb+i);       /* Copy last sent packet again */
       }
 
-      {
-        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));
-       }
-      }
-
+      DBG("%s: DB_DES sending to %I.\n", p->name, 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
       {
index 580fd1dba17000e43bf48dfc2b12ed5887d9ac8d..85d6e39bdce5264131c268c54872c3135454f2f6 100644 (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,
       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;
index 1c1b7c4281a97a7f831756983ca898b17e1702ba..7ea891e6ae69e7686409c0d7cca346b59218504a 100644 (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);
     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);
index e177c987cea5bd8d15c04eb0722a5c6d2c731df4..96449d19337c90ca0f1effa60de02e08f0f0cfb0 100644 (file)
@@ -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:
index 81d95785699ec6610c487797e79e97fb4509910f..b391be5d69ebb7d9bfd8a00252ff4b51650471da 100644 (file)
@@ -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;
        }