]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Many bugfixes. (I added one entry twice to slist.)
authorOndrej Filip <feela@network.cz>
Tue, 9 May 2000 18:17:34 +0000 (18:17 +0000)
committerOndrej Filip <feela@network.cz>
Tue, 9 May 2000 18:17:34 +0000 (18:17 +0000)
Debug cleanup.
Retransmiting of unacknolegded LSAs

proto/ospf/dbdes.c
proto/ospf/hello.c
proto/ospf/lsack.c
proto/ospf/lsreq.c
proto/ospf/lsupd.c
proto/ospf/ospf.h
proto/ospf/topology.c

index ecffbe614d4cd0f2a33c3dec85a530e92e657d8d..4706883a13baf04bd713bfda6de18d4a81d9a73b 100644 (file)
@@ -149,7 +149,7 @@ rxmt_timer_hook(timer *timer)
   n=(struct ospf_neighbor *)timer->data;
   ifa=n->ifa;
   p=(struct proto *)(ifa->proto);
-  debug("%s: RXMT timer fired on interface %s for neigh: %I.\n",
+  DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n",
     p->name, ifa->iface->name, n->rid);
   if(n->state<NEIGHBOR_LOADING) ospf_dbdes_tx(n);
   else
index f3bd3d56bc55f9dd093d8774a1bd5ac4e840536f..4535c5e63c50e0c1491476fde9fc84e19c8b607f 100644 (file)
@@ -183,7 +183,7 @@ hello_timer_hook(timer *timer)
 
   ifa=(struct ospf_iface *)timer->data;
   p=(struct proto *)(ifa->proto);
-  debug("%s: Hello timer fired on interface %s.\n",
+  DBG("%s: Hello timer fired on interface %s.\n",
     p->name, ifa->iface->name);
   /* Now we should send a hello packet */
   /* First a common packet header */
index 764df62231075bdcd918bcd124471f8fecb7008f..3479f3afc4cb38a1fd85a4ddecc956959f203f28 100644 (file)
@@ -15,6 +15,7 @@ ospf_lsack_direct_tx(struct ospf_neighbor *n,struct ospf_lsa_header *h)
   struct ospf_packet *op;
   struct ospf_lsack_packet *pk;
   sock *sk=n->ifa->ip_sk;
+  struct proto *p=&n->ifa->proto->proto;
   u16 len;
 
   DBG("Sending direct ACK to %I for Type: %u, ID: %I, RT: %I\n",n->rid,
@@ -30,6 +31,7 @@ ospf_lsack_direct_tx(struct ospf_neighbor *n,struct ospf_lsa_header *h)
   op->length=htons(len);
   ospf_pkt_finalize(n->ifa, op);
   sk_send_to(sk,len, n->ip, OSPF_PROTO);
+  debug("%s: LS ack sent to %I\n", p->name, n->ip);
 }
 
 void
@@ -160,13 +162,16 @@ ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p,
 
   if((n=find_neigh(ifa, nrid))==NULL)
   {
-    debug("%s: Received lsack from unknown neigbor! (%I)\n", p->name,
+    debug("%s: Received LS ack from unknown neigbor! (%I)\n", p->name,
       nrid);
     return ;
   }
 
   if(n->state<NEIGHBOR_EXCHANGE) return;
-  
+
+  debug("%s: Received LS ack from %I\n", p->name,
+      n->ip);
+
   nolsa=(ntohs(ps->ospf_packet.length)-sizeof(struct ospf_lsack_packet))/
     sizeof(struct ospf_lsa_header);
   DBG("Received %d lsa ack(s)\n",nolsa);
@@ -180,6 +185,9 @@ ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p,
     if(lsa_comp(&lsa,&en->lsa)!=CMP_SAME)
     {
       log("Strange LS acknoledgement from %I",n->rid);
+      log("Id: %I, Rt: %I, Type: %u",lsa.id, lsa.rt, lsa.type);
+      log("I have: Age: %u, Seqno: %u", en->lsa.age, en->lsa.sn);
+      log("He has: Age: %u, Seqno: %u", lsa.age, lsa.sn);
       continue;
     }
 
index 85d6e39bdce5264131c268c54872c3135454f2f6..4a78d06a4b1c4ce2710a37f33795c550730bc122 100644 (file)
@@ -18,6 +18,7 @@ ospf_lsreq_tx(struct ospf_neighbor *n)
   struct ospf_lsreq_header *lsh;
   u16 length;
   int i,j;
+  struct proto *p=&n->ifa->proto->proto;
 
   pk=(struct ospf_lsreq_packet *)n->ifa->ip_sk->tbuf;
   op=(struct ospf_packet *)n->ifa->ip_sk->tbuf;
@@ -54,7 +55,7 @@ ospf_lsreq_tx(struct ospf_neighbor *n)
   op->length=htons(length);
   ospf_pkt_finalize(n->ifa, op);
   sk_send_to(n->ifa->ip_sk,length, n->ip, OSPF_PROTO);
-  DBG("Lsreq send to: %I\n", n->rid);
+  debug("%s: LS request sent to: %I\n", p->name, n->rid);
 }
 
 void
@@ -63,16 +64,39 @@ lsrr_timer_hook(timer *timer)
   struct ospf_iface *ifa;
   struct proto *p;
   struct ospf_neighbor *n;
+  struct top_hash_entry *en;
 
   n=(struct ospf_neighbor *)timer->data;
   ifa=n->ifa;
   p=(struct proto *)(ifa->proto);
-  debug("%s: LSRR timer fired on interface %s for neigh: %I.\n",
+
+  DBG("%s: LSRR timer fired on interface %s for neigh: %I.\n",
     p->name, ifa->iface->name, n->rid);
   if(n->state<NEIGHBOR_FULL) ospf_lsreq_tx(n);
   else
   {
-    int i;     /* FIXME Retransmit lsupd again */
+    if(!EMPTY_SLIST(n->lsrtl))
+    {
+      list uplist;
+      slab *upslab;
+      struct l_lsr_head *llsh;
+
+      init_list(&uplist);
+      upslab=sl_new(p->pool,sizeof(struct l_lsr_head));
+
+      WALK_SLIST(SNODE en,n->lsrtl)
+      {
+       if((SNODE en)->next==(SNODE en)) die("BUGGGGGG");
+        llsh=sl_alloc(upslab);
+        llsh->lsh.id=en->lsa.id;
+        llsh->lsh.rt=en->lsa.rt;
+        llsh->lsh.type=en->lsa.type;
+       DBG("Working on ID: %I, RT: %I, Type: %u\n",en->lsa.id,en->lsa.rt,en->lsa.type);
+        add_tail(&uplist, NODE llsh);
+      }
+      ospf_lsupd_tx_list(n, &uplist);
+      rfree(upslab);
+    }
   }
 }
 
@@ -95,11 +119,13 @@ ospf_lsreq_rx(struct ospf_lsreq_packet *ps, struct proto *p,
 
   if((n=find_neigh(ifa, nrid))==NULL)
   {
-    debug("%s: Received lsreq from unknown neigbor! (%I)\n", p->name,
+    debug("%s: Received lsreq from unknown neighbor! (%I)\n", p->name,
       nrid);
     return ;
   }
-  if(n->state<NEIGHBOR_EXCHANGE) debug("%s: Ignoring it.\n", p->name);
+  if(n->state<NEIGHBOR_EXCHANGE) return;
+
+  debug("%s: Received LS req from neighbor: %I\n",p->name, n->ip);
 
   length=htons(ps->ospf_packet.length);
   lsh=(void *)(ps+1);
index 7ea891e6ae69e7686409c0d7cca346b59218504a..9009b17d2a81abfe2458dc8c79b38e4fbe06dc4a 100644 (file)
@@ -69,9 +69,18 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
        }
       }
       if(nn==n) continue;
-      en=ospf_hash_get_header(nn->lsrth, hh);
+      if((en=ospf_hash_find_header(nn->lsrth, hh))==NULL)
+      {
+        en=ospf_hash_get_header(nn->lsrth, hh);
+      }
+      else
+      {
+        s_rem_node(SNODE en);
+      }
       s_add_tail(&nn->lsrtl, SNODE en);
       ret=1;
+      DBG("Adding LSA lsrt RT: %I, Id: %I, Type: %u for n: %I\n",
+        en->lsa.rt,en->lsa.id, en->lsa.type, nn->ip);
     }
     if(ret==0) continue;
     if(ifa==iff)
@@ -147,6 +156,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
   struct top_hash_entry *en;
   struct ospf_lsupd_packet *pk;
   struct ospf_packet *op;
+  struct proto *p=&n->ifa->oa->po->proto;
   void *pktpos;
   u8 ii;
   u8 *jj=n->ifa->ip_sk->tbuf;
@@ -174,10 +184,8 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
       op->length=htons(len);
       ospf_pkt_finalize(n->ifa, op);
                       
-      for(ii=0;ii<(len-SIPH);ii+=4)
-        DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3));
-
       sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO);
+      debug("%s: LS upd sent to %I\n", p->name, n->ip);
 
       DBG("LSupd: next packet\n");
       fill_ospf_pkt_hdr(n->ifa, pk, LSUPD);
@@ -201,7 +209,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
     DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3));
 
   sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO);
-  DBG("LSupd: sent\n");
+  debug("%s: LS upd sent to %I\n", p->name, n->ip);
 }
 
 void
@@ -233,6 +241,8 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
     return;
   }
 
+  debug("%s: Received LS upd from (%I)\n", p->name, n->ip); 
+
   lsa=(struct ospf_lsa_header *)(ps+1);
   area=htonl(ps->ospf_packet.areaid);
   oa=ospf_find_area((struct proto_ospf *)p,area);
index e761bdf1912096bc97cd4651546979f5148e224a..614032f784e392c602f942cb6f7f5a5c7d093f43 100644 (file)
@@ -27,8 +27,6 @@
 #include "conf/conf.h"
 #include "lib/string.h"
 
-#define LOCAL_DEBUG
-
 #define OSPF_PROTO 89
 #ifndef IPV6
 #define OSPF_VERSION 2
index b391be5d69ebb7d9bfd8a00252ff4b51650471da..2fc74d4d1b959abe4ba11ca05a100e834f301c3b 100644 (file)
@@ -7,8 +7,6 @@
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
-#define LOCAL_DEBUG
-
 #include "nest/bird.h"
 #include "lib/string.h"
 
@@ -34,9 +32,10 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length, struct proto_ospf *p)
   struct top_hash_entry *old;
   struct proto_ospf *po=(struct proto_ospf *)p;
 
-  DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name, oa->areaid);
+  DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name,
+    oa->areaid);
 
-  WALK_LIST (ifa, p->iface_list) i++;
+  WALK_LIST (ifa, p->iface_list)
   {
     if((ifa->an==oa->areaid) && (ifa->state!=OSPF_IS_DOWN))
     {
@@ -226,7 +225,7 @@ originate_rt_lsa(struct ospf_area *oa, struct proto_ospf *po)
   struct top_hash_entry *en;
   void *body;
 
-  DBG("%s: Originating RT_lsa for area \"%I\".\n", po->proto.name, oa->areaid);
+  debug("%s: Originating RT_lsa for area \"%I\".\n",po->proto.name,oa->areaid);
 
   lsa.age=0;
   lsa.id=rtid;
@@ -287,7 +286,8 @@ originate_net_lsa(struct ospf_iface *ifa, struct proto_ospf *po)
 
   if(ifa->state!=OSPF_IS_DR) return;
 
-  DBG("%s: Originating Net lsa for iface \"%s\".\n", po->proto.name, ifa->iface->name);
+  debug("%s: Originating Net lsa for iface \"%s\".\n", po->proto.name,
+    ifa->iface->name);
 
   if(ifa->fadj==0)
   {