summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2010-09-25 13:28:43 +0000
committerclaudio <claudio@openbsd.org>2010-09-25 13:28:43 +0000
commitaa8be4a80e2d00fad973aa597b22897d2d7b95bf (patch)
treec300d48f19ce4fc64e3dab0e4a01acaf15f7bba3
parentMake gcvt() better match printf("%g") behavior, it now passes regress. (diff)
downloadwireguard-openbsd-aa8be4a80e2d00fad973aa597b22897d2d7b95bf.tar.xz
wireguard-openbsd-aa8be4a80e2d00fad973aa597b22897d2d7b95bf.zip
When counting the lsa also build the sum of the ls_checksums. This can be
used to quickly verify if two LSDBs are in sync. Other systems do the same. OK dlg@
-rw-r--r--usr.sbin/ospfd/ospfd.h4
-rw-r--r--usr.sbin/ospfd/rde.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 8b77bf0f99c..400b944fa73 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.87 2010/02/19 10:35:52 dlg Exp $ */
+/* $OpenBSD: ospfd.h,v 1.88 2010/09/25 13:28:43 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -505,6 +505,7 @@ struct ctl_sum {
u_int32_t spf_hold_time;
u_int32_t num_ext_lsa;
u_int32_t num_area;
+ u_int32_t ext_lsa_cksum;
time_t uptime;
u_int8_t rfc1583compat;
};
@@ -515,6 +516,7 @@ struct ctl_sum_area {
u_int32_t num_adj_nbr;
u_int32_t num_spf_calc;
u_int32_t num_lsa;
+ u_int32_t lsa_cksum;
};
struct demote_msg {
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c
index 0d7480cb07f..a6429444c72 100644
--- a/usr.sbin/ospfd/rde.c
+++ b/usr.sbin/ospfd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.87 2010/07/19 09:16:30 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.88 2010/09/25 13:28:43 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -794,8 +794,11 @@ rde_send_summary(pid_t pid)
LIST_FOREACH(area, &rdeconf->area_list, entry)
sumctl.num_area++;
- RB_FOREACH(v, lsa_tree, &asext_tree)
+ RB_FOREACH(v, lsa_tree, &asext_tree) {
sumctl.num_ext_lsa++;
+ sumctl.ext_lsa_cksum += ntohs(v->lsa->hdr.ls_chksum);
+
+ }
gettimeofday(&now, NULL);
if (rdeconf->uptime < now.tv_sec)
@@ -830,8 +833,10 @@ rde_send_summary_area(struct area *area, pid_t pid)
if (nbr->state == NBR_STA_FULL && !nbr->self)
sumareactl.num_adj_nbr++;
- RB_FOREACH(v, lsa_tree, tree)
+ RB_FOREACH(v, lsa_tree, tree) {
sumareactl.num_lsa++;
+ sumareactl.lsa_cksum += ntohs(v->lsa->hdr.ls_chksum);
+ }
rde_imsg_compose_ospfe(IMSG_CTL_SHOW_SUM_AREA, 0, pid, &sumareactl,
sizeof(sumareactl));