From 2f30cb25747dc9657046c59ca1f378203192de26 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 16 Oct 2022 15:19:37 +0000 Subject: ospfd/ospfclient: add option to flush/withdrawal with zero length default behavior is unchanged, i.e., to not zero Signed-off-by: Lou Berger --- ospfd/ospf_opaque.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ospfd/ospf_opaque.c') diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 261d69df3..ab647625f 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -2050,6 +2050,17 @@ void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0) goto out; } + if (lsa->opaque_zero_len_delete && + lsa->data->length != htons(sizeof(struct lsa_header))) { + /* minimize the size of the withdrawal: */ + /* increment the sequence number and make len just header */ + /* and update checksum */ + lsa->data->ls_seqnum = lsa_seqnum_increment(lsa); + lsa->data->length = htons(sizeof(struct lsa_header)); + lsa->data->checksum = 0; + lsa->data->checksum = ospf_lsa_checksum(lsa->data); + } + /* Delete this lsa from neighbor retransmit-list. */ switch (lsa->data->type) { case OSPF_OPAQUE_LINK_LSA: -- cgit v1.2.3