summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2005-10-12 09:08:25 +0000
committerclaudio <claudio@openbsd.org>2005-10-12 09:08:25 +0000
commit16d644a961ef30eae12633171c1ca910f56d1582 (patch)
tree08f0b51c09ec9610fb51a6f253152de455fbfd8b
parentUse queue macros instead of directly accessing fields. ok millert@ (diff)
downloadwireguard-openbsd-16d644a961ef30eae12633171c1ca910f56d1582.tar.xz
wireguard-openbsd-16d644a961ef30eae12633171c1ca910f56d1582.zip
In one special condition ospfd sent out ls updates without updating the
checksum. Because of the invalid checksum the other routers dropped it and so the update was retransmitted over and over again. Now we update the checksum in lsa_merge() after bumping the sequence number instead of hoping that lsa_timeout() -> lsa_refresh() will do it for us. OK norby@
-rw-r--r--usr.sbin/ospfd/rde_lsdb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/rde_lsdb.c b/usr.sbin/ospfd/rde_lsdb.c
index 6b63afd5cbf..08b806b880c 100644
--- a/usr.sbin/ospfd/rde_lsdb.c
+++ b/usr.sbin/ospfd/rde_lsdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_lsdb.c,v 1.20 2005/10/06 17:06:44 claudio Exp $ */
+/* $OpenBSD: rde_lsdb.c,v 1.21 2005/10/12 09:08:25 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -578,6 +578,7 @@ lsa_merge(struct rde_nbr *nbr, struct lsa *lsa, struct vertex *v)
{
struct timeval tv;
time_t now;
+ u_int16_t len;
if (v == NULL) {
lsa_add(nbr, lsa);
@@ -588,6 +589,10 @@ lsa_merge(struct rde_nbr *nbr, struct lsa *lsa, struct vertex *v)
/* set the seq_num to the current one. lsa_refresh() will do the ++ */
lsa->hdr.seq_num = v->lsa->hdr.seq_num;
+ /* recalculate checksum */
+ len = ntohs(lsa->hdr.len);
+ lsa->hdr.ls_chksum = 0;
+ lsa->hdr.ls_chksum = htons(iso_cksum(lsa, len, LS_CKSUM_OFFSET));
/* compare LSA most header fields are equal so don't check them */
if (lsa_equal(lsa, v->lsa)) {