Connection-ID: Only change source port when CID has been negotiated

Only support changing the client's source port if the DTLS library
has support / configured for CID.

Used when debugging server handling source address changes and CID
is in use.

Add in support for TinyDTLS (Client only) if TinyDTLS is patched
appropriately (not currently available on TinyDTLS main branch).

Add in new function coap_dtls_cid_is_supported().
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2024-08-07 09:13:52 +01:00
1 parent 83718a6d2f
commit af024f9138
18 files changed
+351 -23

No files matched your search

+2
View File
@@ -29,6 +29,8 @@
* @{
*/
int coap_dtls_cid_is_supported(void);
typedef struct coap_dtls_pki_t coap_dtls_pki_t;
#ifndef COAP_DTLS_HINT_LENGTH
+11
View File
@@ -481,6 +481,17 @@ int coap_dtls_define_issue(coap_define_issue_key_t type,
coap_dtls_key_t *key,
const coap_dtls_role_t role,
int ret);
/**
* Set the Connection ID client tuple frequency change for testing CIDs.
*
* @param context The coap_context_t object.
* @param every Change the client's source port @p every packets sent.
*
* @return @c 1 if frequency change set (CID supported), else @c 0.
*/
int coap_dtls_set_cid_tuple_change(coap_context_t *context, uint8_t every);
/** @} */
#endif /* COAP_DTLS_INTERNAL_H */
+3 -1
View File
@@ -235,8 +235,10 @@ void coap_context_set_keepalive(coap_context_t *context, unsigned int seconds);
*
* @param context The coap_context_t object.
* @param every Change the client's source port @p every packets sent.
*
* @return @c 1 if frequency change set (CID supported), else @c 0.
*/
void coap_context_set_cid_tuple_change(coap_context_t *context, uint8_t every);
int coap_context_set_cid_tuple_change(coap_context_t *context, uint8_t every);
/**
* Set the maximum token size (RFC8974).
+4
View File
@@ -203,6 +203,10 @@ struct coap_session_t {
#endif /* COAP_OSCORE_SUPPORT */
volatile uint8_t max_token_checked; /**< Check for max token size
coap_ext_token_check_t */
#if COAP_CLIENT_SUPPORT
uint8_t negotiated_cid; /**< Set for a client if CID negotiated */
#endif /* COAP_CLIENT_SUPPORT */
uint8_t is_dtls13; /**< Set if session is DTLS1.3 */
coap_mid_t remote_test_mid; /**< mid used for checking remote
support */
uint32_t max_token_size; /**< Largest token size supported RFC8974 */