]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
And finally, Premature aging works. :-)
authorOndrej Filip <feela@network.cz>
Wed, 31 May 2000 18:21:42 +0000 (18:21 +0000)
committerOndrej Filip <feela@network.cz>
Wed, 31 May 2000 18:21:42 +0000 (18:21 +0000)
proto/ospf/lsack.c
proto/ospf/lsalib.c
proto/ospf/lsupd.c

index 8939728819c5f87639271636c9684a59b0e7fb87..8b6b280c71aed432f02d26c0321e4ee8f79fb786 100644 (file)
@@ -191,6 +191,8 @@ ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p,
 
     if(lsa_comp(&lsa,&en->lsa)!=CMP_SAME)
     {
+      if((lsa.sn==LSA_MAXSEQNO)&&(lsa.age==LSA_MAXAGE)) continue;
+
       debug("%s: Strange LS acknoledgement from %I\n",p->name,n->ip);
       debug("%s: Id: %I, Rt: %I, Type: %u\n",p->name,lsa.id,lsa.rt,lsa.type);
       debug("%s: I have: Age: %4u, Seqno: 0x%08x\n",p->name,en->lsa.age,
index 62ea0b86165ae04334c2861a164488043e5c6fde..d6317125fbf8c143be273e935cae1774f46ae632 100644 (file)
@@ -349,8 +349,13 @@ int
 lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2)
                        /* Return codes from point of view of l1 */
 {
-  if(l1->sn>l2->sn) return CMP_NEWER;
-  if(l1->sn<l2->sn) return CMP_OLDER;
+  u32 sn1,sn2;
+
+  sn1=l1->sn-LSA_INITSEQNO+1;
+  sn2=l2->sn-LSA_INITSEQNO+1;
+
+  if(sn1>sn2) return CMP_NEWER;
+  if(sn1<sn2) return CMP_OLDER;
 
   if(l1->checksum=!l2->checksum)
     return l1->checksum<l2->checksum ? CMP_OLDER : CMP_NEWER;
index 19a663b81a5887c84e06173333f545029781e387..798aa1e39f8413d621b04dd0072fd34ab703c357 100644 (file)
@@ -44,7 +44,6 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
       if(nn->state<NEIGHBOR_EXCHANGE) continue;
       if(nn->state<NEIGHBOR_FULL)
       {
-
         if((en=ospf_hash_find_header(nn->lsrqh,hh))!=NULL)
        {
          switch(lsa_comp(hh,&en->lsa))
@@ -93,9 +92,12 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
           s_rem_node(SNODE en);
           ospf_hash_delete(nn->lsrth, en);
         }
+        ret=1;
       }
     }
+
     if(ret==0) continue;
+
     if(ifa==iff)
     {
       if((n->rid==iff->drid)||n->rid==iff->bdrid) continue;
@@ -307,8 +309,8 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
       continue;
     }
     ntohlsah(lsa,&lsatmp);
-    DBG("Processing update Type: %u ID: %I RT: %I\n",lsatmp.type,
-        lsatmp.id, lsatmp.rt);
+    DBG("Processing update Type: %u ID: %I RT: %I, Sn: 0x%08x\n",lsatmp.type,
+      lsatmp.id, lsatmp.rt, lsatmp.sn);
     lsadb=ospf_hash_find_header(oa->gr, &lsatmp);
 
     /* pg 143 (4) */
@@ -358,14 +360,15 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
        {
          struct top_hash_entry *en;
 
+         if((lsatmp.age==LSA_MAXAGE)&&(lsatmp.sn==LSA_MAXSEQNO)) continue;
+
         lsatmp.age=LSA_MAXAGE;
         lsatmp.sn=LSA_MAXSEQNO;
+         lsa->age=htons(LSA_MAXAGE);
+         lsa->sn=htonl(LSA_MAXSEQNO);
         debug("%s: Premature aging self originated lsa.\n",p->name);
          debug("%s: Type: %d, Id: %I, Rt: %I\n", p->name, lsatmp.type,
            lsatmp.id, lsatmp.rt);
-         body=mb_alloc(p->pool,lsatmp.length-sizeof(struct ospf_lsa_header));
-         ntohlsab(lsa+1,body,lsatmp.type,
-           lsatmp.length-sizeof(struct ospf_lsa_header));
         lsasum_check(lsa,(lsa+1),po);
         lsatmp.checksum=ntohs(lsa->checksum);
          flood_lsa(NULL,lsa,&lsatmp,po,NULL,oa,0);