Skip to content

Commit 8596269

Browse files
committed
Merge branch 'tinydtls-defaults' into stdio-coap
2 parents 4fa0928 + d4f1079 commit 8596269

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

pkg/tinydtls/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ config DTLS_CONTEXT_MAX
3838

3939
config DTLS_PEER_MAX
4040
int "Max number of peers"
41+
default 2 if KCONFIG_USEMODULE_GCOAP_DTLS
4142
default 1
4243
help
4344
The maximum number of DTLS peers.

pkg/tinydtls/Makefile.include

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ endif
6363
PEER_MAX := $(or $(CONFIG_DTLS_PEER_MAX),$(patsubst -DCONFIG_DTLS_PEER_MAX=%,%,$(filter -DCONFIG_DTLS_PEER_MAX=%,$(CFLAGS))))
6464
ifneq (,$(PEER_MAX))
6565
CFLAGS += -DDTLS_PEER_MAX=$(PEER_MAX)
66+
else ifneq (,$(filter gcoap_dtls,$(USEMODULE)))
67+
# The default value in sys/include/net/dtls.h for CONFIG_DTLS_PEER_MAX is 2
68+
# when gcoap_dtls is active, otherwise 1. As the default in tinydtls is 1,
69+
# we need to set it explicitly if the dtls.h default value deviates from
70+
# the tinydtls default.
71+
CFLAGS += -DDTLS_PEER_MAX=2
6672
endif
6773

6874
HANDSHAKE_MAX := $(or $(CONFIG_DTLS_HANDSHAKE_MAX),$(patsubst -DCONFIG_DTLS_HANDSHAKE_MAX=%,%,$(filter -DCONFIG_DTLS_HANDSHAKE_MAX=%,$(CFLAGS))))

sys/include/net/dtls.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#ifndef NET_DTLS_H
3737
#define NET_DTLS_H
3838

39+
#include "modules.h"
40+
3941
#ifdef __cplusplus
4042
extern "C" {
4143
#endif
@@ -44,8 +46,12 @@ extern "C" {
4446
* @brief The maximum number DTLS peers (i.e. sessions)
4547
*/
4648
#ifndef CONFIG_DTLS_PEER_MAX
49+
#if IS_USED(MODULE_GCOAP_DTLS)
50+
#define CONFIG_DTLS_PEER_MAX (2)
51+
#else
4752
#define CONFIG_DTLS_PEER_MAX (1)
4853
#endif
54+
#endif
4955

5056
#ifdef __cplusplus
5157
}

0 commit comments

Comments
 (0)