diff options
| author | Pat Ruddy <pat@voltanet.io> | 2021-06-25 10:10:31 +0100 |
|---|---|---|
| committer | Pat Ruddy <pat@voltanet.io> | 2021-06-26 11:16:19 +0100 |
| commit | a91f9d699cd469aafb3a89d7156f84daaf3a76e5 (patch) | |
| tree | 97dbc295e28e8d217c2198bec38ce8d3dc8a7137 /ospf6d/ospf6_message.c | |
| parent | 0dd5ec1297fc60c6264213e61defa5164717701d (diff) | |
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 <pat@voltanet.io>
Diffstat (limited to 'ospf6d/ospf6_message.c')
| -rw-r--r-- | ospf6d/ospf6_message.c | 27 |
1 files 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"); |
