From 15c4dd82dba35467c598d48407dc1238983bb31b Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Thu, 27 Oct 2022 19:12:23 +0000 Subject: [PATCH 1/2] ospfd: remove assert on zero length LSA - which is permitted by spec Signed-off-by: Lou Berger --- ospfd/ospf_lsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index c67181cba6..ade75ad5e3 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -3596,7 +3596,8 @@ int ospf_lsa_different(struct ospf_lsa *l1, struct ospf_lsa *l2, && CHECK_FLAG((l1->flags ^ l2->flags), OSPF_LSA_RECEIVED)) return 1; /* May be a stale LSA in the LSBD */ - assert(l1->size > OSPF_LSA_HEADER_SIZE); + if (l1->size == OSPF_LSA_HEADER_SIZE) + return 0; /* nothing to compare */ p1 = (char *)l1->data; p2 = (char *)l2->data; From 53674eaba6a34f42f322f79449c2ab667884fb82 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Fri, 28 Oct 2022 16:06:04 +0000 Subject: [PATCH 2/2] ospfd: catch and report runt LSAs Signed-off-by: Lou Berger --- ospfd/ospf_packet.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 466b5fa2a2..8c87a568c0 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -1716,6 +1716,12 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr, break; } + if (length < OSPF_LSA_HEADER_SIZE) { + flog_warn(EC_OSPF_PACKET, + "Link State Update: LSA length too small."); + break; + } + /* Validate the LSA's LS checksum. */ sum = lsah->checksum; if (!ospf_lsa_checksum_valid(lsah)) {