summaryrefslogtreecommitdiff
path: root/ospfd/ospf_lsdb.c
diff options
context:
space:
mode:
authorhasso <hasso>2005-02-11 08:31:54 +0000
committerhasso <hasso>2005-02-11 08:31:54 +0000
commit082253f5d08577e2c7b61ed2302be88295b459eb (patch)
tree4a359027a29c673844f89bd36e706baaa5326db4 /ospfd/ospf_lsdb.c
parent5d6191ee84cc4b292f19f287a5c4fc45f7dd9b84 (diff)
* ospf_lsdb.c: Fix sum of checksums calculation.
[backport candidate]
Diffstat (limited to 'ospfd/ospf_lsdb.c')
-rw-r--r--ospfd/ospf_lsdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c
index 4c6ed64e..94d839f2 100644
--- a/ospfd/ospf_lsdb.c
+++ b/ospfd/ospf_lsdb.c
@@ -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);
}