From a91f9d699cd469aafb3a89d7156f84daaf3a76e5 Mon Sep 17 00:00:00 2001 From: Pat Ruddy Date: Fri, 25 Jun 2021 10:10:31 +0100 Subject: [PATCH] ospf6d: correctly protect packet debugs in ospf6_write Some unprotected debugs need to have macro protection, Split these into the existing covering macro section to remove a check per-packet from the main path. Signed-off-by: Pat Ruddy --- ospf6d/ospf6_message.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 8d74585ec6..7faec0d490 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1927,7 +1927,7 @@ static int ospf6_write(struct thread *thread) flog_err(EC_LIB_DEVELOPMENT, "Could not send entire message"); - if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)) { + if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND_HDR)) { inet_ntop(AF_INET6, &op->dst, dstname, sizeof(dstname)); inet_ntop(AF_INET6, oi->linklocal_addr, srcname, sizeof(srcname)); @@ -1937,6 +1937,27 @@ static int ospf6_write(struct thread *thread) oi->interface->name); zlog_debug(" src: %s", srcname); zlog_debug(" dst: %s", dstname); + switch (oh->type) { + case OSPF6_MESSAGE_TYPE_HELLO: + ospf6_hello_print(oh, OSPF6_ACTION_SEND); + break; + case OSPF6_MESSAGE_TYPE_DBDESC: + ospf6_dbdesc_print(oh, OSPF6_ACTION_SEND); + break; + case OSPF6_MESSAGE_TYPE_LSREQ: + ospf6_lsreq_print(oh, OSPF6_ACTION_SEND); + break; + case OSPF6_MESSAGE_TYPE_LSUPDATE: + ospf6_lsupdate_print(oh, OSPF6_ACTION_SEND); + break; + case OSPF6_MESSAGE_TYPE_LSACK: + ospf6_lsack_print(oh, OSPF6_ACTION_SEND); + break; + default: + zlog_debug("Unknown message"); + assert(0); + break; + } } switch (oh->type) { case OSPF6_MESSAGE_TYPE_HELLO: @@ -1957,19 +1978,15 @@ static int ospf6_write(struct thread *thread) break; case OSPF6_MESSAGE_TYPE_DBDESC: oi->db_desc_out++; - ospf6_dbdesc_print(oh, OSPF6_ACTION_SEND); break; case OSPF6_MESSAGE_TYPE_LSREQ: oi->ls_req_out++; - ospf6_lsreq_print(oh, OSPF6_ACTION_SEND); break; case OSPF6_MESSAGE_TYPE_LSUPDATE: oi->ls_upd_out++; - ospf6_lsupdate_print(oh, OSPF6_ACTION_SEND); break; case OSPF6_MESSAGE_TYPE_LSACK: oi->ls_ack_out++; - ospf6_lsack_print(oh, OSPF6_ACTION_SEND); break; default: zlog_debug("Unknown message");