OSCORE: Treat CoAP pings as requests

This commit is contained in:
kkrentz authored and Jon Shallow committed 2023-11-07 16:18:07 +00:00
1 parent 1456d9aa0d
commit 3b246dfe73
2 files changed
+4 -1

No files matched your search

+3
View File
@@ -102,6 +102,9 @@
#define COAP_PDU_IS_REQUEST(pdu) (!COAP_PDU_IS_EMPTY(pdu) && (pdu)->code < 32)
#define COAP_PDU_IS_RESPONSE(pdu) ((pdu)->code >= 64 && (pdu)->code < 224)
#define COAP_PDU_IS_SIGNALING(pdu) ((pdu)->code >= 224)
#define COAP_PDU_IS_PING(pdu) ((COAP_PDU_IS_EMPTY(pdu) && \
((pdu)->type == COAP_MESSAGE_CON)) || \
((pdu)->code == COAP_SIGNALING_CODE_PING))
#define COAP_PDU_MAX_UDP_HEADER_SIZE 4
#define COAP_PDU_MAX_TCP_HEADER_SIZE 6
+1 -1
View File
@@ -271,7 +271,7 @@ coap_oscore_new_pdu_encrypted(coap_session_t *session,
coap_pdu_t *pdu,
coap_bin_const_t *kid_context,
oscore_partial_iv_t send_partial_iv) {
uint8_t coap_request = COAP_PDU_IS_REQUEST(pdu);
uint8_t coap_request = COAP_PDU_IS_REQUEST(pdu) || COAP_PDU_IS_PING(pdu);
coap_pdu_code_t code =
coap_request ? COAP_REQUEST_CODE_POST : COAP_RESPONSE_CODE(204);
coap_pdu_t *osc_pdu;