From d15dd81e96d0142a14287cf3f01997cd18095ab9 Mon Sep 17 00:00:00 2001 From: lynne Date: Fri, 11 Jun 2021 10:38:42 -0400 Subject: [PATCH] ospf6: Drop LSA with bad seqnumber In RFC 2328 seqnumber 0x80000000 is reserved and not used. If an LSA is received with seqnumber the LSA is now dropped and a debug error log is printed. Signed-off-by: Lynne Morrison (cherry picked from commit c5467a12ea002f4fbedf179e826445d9e3dbd4b8) --- ospf6d/ospf6_flood.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 76e81aab7b..40978e89bd 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -775,6 +775,18 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, ismore_recent = 1; assert(from); + /* if we receive a LSA with invalid seqnum drop it */ + if (ntohl(lsa_header->seqnum) - 1 == OSPF_MAX_SEQUENCE_NUMBER) { + if (IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa_header->type)) { + zlog_debug( + "received lsa [%s Id:%pI4 Adv:%pI4] with invalid seqnum 0x%x, ignore", + ospf6_lstype_name(lsa_header->type), + &lsa_header->id, &lsa_header->adv_router, + ntohl(lsa_header->seqnum)); + } + return; + } + /* make lsa structure for received lsa */ new = ospf6_lsa_create(lsa_header); -- 2.39.5