]> git.puffer.fish Git - mirror/frr.git/commitdiff
* ospf_lsdb.c: Fix sum of checksums calculation.
authorhasso <hasso>
Fri, 11 Feb 2005 08:31:54 +0000 (08:31 +0000)
committerhasso <hasso>
Fri, 11 Feb 2005 08:31:54 +0000 (08:31 +0000)
[backport candidate]

ospfd/ChangeLog
ospfd/ospf_lsdb.c

index c530a98d57646edb4fdb05a48776b86126829e8f..f3becf4aa71ccc713c027d438092ddaf95208b56 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-11 Hasso Tepper <hasso at quagga.net>
+
+       * ospf_lsdb.c: Fix sum of checksums calculation.
+
 2005-02-09 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * ospf_packet.c: (ospf_write) If sendmsg fails, give more info in the
index 4c6ed64ebe0a8e0012ebde73e71b8d64ceaba0f1..94d839f2d7a2dc0342acc8c6c13d44a0f6b213a9 100644 (file)
@@ -88,6 +88,7 @@ ospf_lsdb_add (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
   struct route_table *table;
   struct prefix_ls lp;
   struct route_node *rn;
+  struct ospf_lsa *old;
 
   table = lsdb->type[lsa->data->type].db;
   lsdb_prefix_set (&lp, lsa);
@@ -97,7 +98,6 @@ ospf_lsdb_add (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
       if (IS_LSA_SELF (lsa))
        lsdb->type[lsa->data->type].count_self++;
       lsdb->type[lsa->data->type].count++;
-      lsdb->type[lsa->data->type].checksum += ntohs(lsa->data->checksum);
       lsdb->total++;
     }
   else
@@ -105,6 +105,9 @@ ospf_lsdb_add (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
       if (rn->info == lsa)
        return;
       
+      old = rn->info;
+      lsdb->type[old->data->type].checksum -= ntohs(old->data->checksum);
+
       ospf_lsa_unlock (rn->info);
       route_unlock_node (rn);
     }
@@ -113,6 +116,7 @@ ospf_lsdb_add (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
   if (lsdb->new_lsa_hook != NULL)
     (* lsdb->new_lsa_hook)(lsa);
 #endif /* MONITOR_LSDB_CHANGE */
+  lsdb->type[lsa->data->type].checksum += ntohs(lsa->data->checksum);
   rn->info = ospf_lsa_lock (lsa);
 }