diff options
author | 2015-01-28 22:03:17 +0000 | |
---|---|---|
committer | 2015-01-28 22:03:17 +0000 | |
commit | 8e73b4e25021d2da0f695768cf400bcb6906b516 (patch) | |
tree | 81d942c25e3d86ef7607ad50d99b5bb7911f6167 | |
parent | avoid fatal() calls in packet code (diff) | |
download | wireguard-openbsd-8e73b4e25021d2da0f695768cf400bcb6906b516.tar.xz wireguard-openbsd-8e73b4e25021d2da0f695768cf400bcb6906b516.zip |
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@
-rw-r--r-- | usr.sbin/ospf6d/lsupdate.c | 11 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsupdate.c | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/usr.sbin/ospf6d/lsupdate.c b/usr.sbin/ospf6d/lsupdate.c index c635cf3f780..6e40d0da65b 100644 --- a/usr.sbin/ospf6d/lsupdate.c +++ b/usr.sbin/ospf6d/lsupdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsupdate.c,v 1.12 2015/01/22 22:09:39 tedu Exp $ */ +/* $OpenBSD: lsupdate.c,v 1.13 2015/01/28 22:03:17 bluhm Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -332,8 +332,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); } 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); } |