Skip to content

Commit

Permalink
Update for primary commit obgm#5 (to be squashed later)
Browse files Browse the repository at this point in the history
Re-order when coap_show_pdu() is called in coap_dispatch() to aid
debugging when there are critical options.
  • Loading branch information
mrdeep1 committed Dec 9, 2022
1 parent 5a41d35 commit ccad9a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/coap_oscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,6 @@ coap_oscore_decrypt_pdu(coap_session_t *session,
if (opt == NULL)
return NULL;

coap_log(LOG_DEBUG, "PDU to decrypt\n");
coap_show_pdu(LOG_DEBUG, pdu);
if (session->context->p_osc_ctx == NULL) {
coap_log(LOG_WARNING, "OSCORE: Not enabled\n");
if (!coap_request)
Expand Down
9 changes: 5 additions & 4 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -3273,15 +3273,14 @@ coap_dispatch(coap_context_t *context, coap_session_t *session,
#endif /* HAVE_OSCORE */

coap_show_pdu(LOG_DEBUG, pdu);

memset(&opt_filter, 0, sizeof(coap_opt_filter_t));

#if HAVE_OSCORE
if (coap_option_check_critical(session, pdu, &opt_filter) == 0) {
if (pdu->type == COAP_MESSAGE_NON) {
if (coap_option_check_critical(session, pdu, &opt_filter) == 0) {
coap_send_rst(session, pdu);
goto cleanup;
}
coap_send_rst(session, pdu);
goto cleanup;
} else if (pdu->type == COAP_MESSAGE_CON) {
if (COAP_PDU_IS_REQUEST(pdu)) {
response =
Expand Down Expand Up @@ -3351,6 +3350,8 @@ coap_dispatch(coap_context_t *context, coap_session_t *session,
session->oscore_encryption = 1;
pdu = dec_pdu;
}
coap_log_debug("Decrypted PDU\n");
coap_show_pdu(LOG_DEBUG, pdu);
}
}
#endif /* HAVE_OSCORE */
Expand Down

0 comments on commit ccad9a2

Please sign in to comment.