summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/lsupdate.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-01-28 22:03:18 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-01-28 22:03:18 +0000
commit9ff3564abe14c7cc7ff83e6c7e298ce273f82ca7 (patch)
tree74fa43f9056b681de0a3afcc332d8a23582b4890 /usr.sbin/ospfd/lsupdate.c
parentfb51d00cd5ee4da971f6c0855a8861b6e3ff8de4 (diff)
When comparing the LSA with the Ack, also check the age field. This
ensures that a LSA withdrawal is not acked by a previous update. From Florian Riehm; OK claudio@
Diffstat (limited to 'usr.sbin/ospfd/lsupdate.c')
-rw-r--r--usr.sbin/ospfd/lsupdate.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/lsupdate.c b/usr.sbin/ospfd/lsupdate.c
index 32708651b75..46ad79e99fa 100644
--- a/usr.sbin/ospfd/lsupdate.c
+++ b/usr.sbin/ospfd/lsupdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsupdate.c,v 1.43 2015/01/22 22:09:39 tedu Exp $ */
+/* $OpenBSD: lsupdate.c,v 1.44 2015/01/28 22:03:17 bluhm Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -329,8 +329,15 @@ ls_retrans_list_del(struct nbr *nbr, struct lsa_hdr *lsa_hdr)
if ((le = ls_retrans_list_get(nbr, lsa_hdr)) == NULL)
return (-1);
+ /*
+ * Compare LSA with the Ack by comparing not only the seq_num and
+ * checksum but also the age field. Since we only care about MAX_AGE
+ * vs. non-MAX_AGE LSA, a simple >= comparison is good enough. This
+ * ensures that a LSA withdrawal is not acked by a previous update.
+ */
if (lsa_hdr->seq_num == le->le_ref->hdr.seq_num &&
- lsa_hdr->ls_chksum == le->le_ref->hdr.ls_chksum) {
+ lsa_hdr->ls_chksum == le->le_ref->hdr.ls_chksum &&
+ ntohs(lsa_hdr->age) >= ntohs(le->le_ref->hdr.age)) {
ls_retrans_list_free(nbr, le);
return (0);
}