Skip to content

client server example in RIOT failed with latest develop branch #20

@pokgak

Description

@pokgak

I encountered this when testing PR #19 with the latest develop branch. Using the RIOT dtls-echo example, sending a packet from a client to a server will fail.

How to reproduce

Apply the diff to the RIOT repository and run the dtls-echo example.

Use latest develop tinydtls branch on RIOT and enable debug by applying this diff:

diff --git a/examples/dtls-echo/Makefile b/examples/dtls-echo/Makefile
index 325078eac..91a51bc93 100644
--- a/examples/dtls-echo/Makefile
+++ b/examples/dtls-echo/Makefile
@@ -42,7 +42,7 @@ CFLAGS += -DDTLS_DEFAULT_PORT=$(DTLS_PORT)
 
 # NOTE: If not cipher suite is selected, DTLS_PSK is used by default.
 # This adds support for TLS_PSK_WITH_AES_128_CCM_8
-# CFLAGS += -DDTLS_PSK
+CFLAGS += -DDTLS_PSK
 # This adds support for TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
 # CFLAGS += -DDTLS_ECC
 
@@ -52,7 +52,7 @@ TINYDTLS_LOG ?= 0
 
 # Enable this line for setting tinyDTLS in debug mode.
 # This overrides TINYDTLS_LOG to 6
-# CFLAGS += -DTINYDTLS_DEBUG
+CFLAGS += -DTINYDTLS_DEBUG
 
 # FIXME: This is a temporary patch
 # TinyDTLS <= 0.8.6 requires around 426 bytes in RAM.
diff --git a/pkg/tinydtls/Makefile b/pkg/tinydtls/Makefile
index e1a8483d0..802c5bc70 100644
--- a/pkg/tinydtls/Makefile
+++ b/pkg/tinydtls/Makefile
@@ -1,6 +1,6 @@
 PKG_NAME=tinydtls
 PKG_URL=https://github.com/eclipse/tinydtls.git
-PKG_VERSION=dcac93f1b38e74f0a57b5df47647943f3df005c2
+PKG_VERSION=494a40dfbb174930ca616e560532d52549736b42
 PKG_LICENSE=EPL-1.0,EDL-1.0
 
 CFLAGS += -Wno-implicit-fallthrough
Server log:

> dtlss start
dtlss start
> Oct 02 15:31:34 DEBG dtls_handle_message: PEER NOT FOUND
Oct 02 15:31:34 DEBG got packet 22 (95 bytes)
Oct 02 15:31:34 DEBG receive header: (13 bytes):
00000000 16 FE FF 00 00 00 00 00 00 00 00 00 52  
Oct 02 15:31:34 DEBG receive unencrypted: (82 bytes):
00000000 01 00 00 46 00 00 00 00 00 00 00 46 FE FD 00 00  
00000010 00 05 E9 CC A0 AC 1C C1 EB E4 52 EB 47 70 CC 83  
00000020 A1 0C C9 D1 C9 69 5E 0D 28 01 1F F1 C6 05 00 00  
00000030 00 02 C0 AE 01 00 00 1A 00 13 00 02 01 02 00 14  
00000040 00 02 01 02 00 0A 00 04 00 02 00 17 00 0B 00 02  
00000050 01 00 
Oct 02 15:31:34 DEBG received handshake packet of type: client_hello (1)
Oct 02 15:31:34 DEBG handle handshake packet of type: client_hello (1)
Oct 02 15:31:34 WARN error in dtls_verify_peer err: -552
Oct 02 15:31:34 WARN error while handling handshake packet
Oct 02 15:33:24 DEBG dtls_handle_message: PEER NOT FOUND
Oct 02 15:33:24 DEBG got packet 21 (15 bytes)
Oct 02 15:33:24 DEBG receive header: (13 bytes):
00000000 15 FE FD 00 00 00 00 00 00 00 01 00 02  
Oct 02 15:33:24 DEBG receive unencrypted: (2 bytes):
00000000 02 00 
Oct 02 15:33:24 INFO ** Alert: level 2, description 0
Oct 02 15:33:24 WARN got an alert for an unknown peer, we probably already removed it, ignore it
Client log:

> dtlsc fe80::2051:47ff:fec8:edcf heyyy
dtlsc fe80::2051:47ff:fec8:edcf heyyy
Oct 02 15:31:34 DEBG DTLSv12: initialize HASH_SHA256
Oct 02 15:31:34 DEBG send handshake packet of type: client_hello (1)
Oct 02 15:31:34 DEBG send header: (13 bytes):
00000000 16 FE FF 00 00 00 00 00 00 00 00 00 52  
Oct 02 15:31:34 DEBG send unencrypted: (12 bytes):
00000000 01 00 00 46 00 00 00 00 00 00 00 46  
Oct 02 15:31:34 DEBG send unencrypted: (70 bytes):
00000000 FE FD 00 00 00 05 E9 CC A0 AC 1C C1 EB E4 52 EB  
00000010 47 70 CC 83 A1 0C C9 D1 C9 69 5E 0D 28 01 1F F1  
00000020 C6 05 00 00 00 02 C0 AE 01 00 00 1A 00 13 00 02  
00000030 01 02 00 14 00 02 01 02 00 0A 00 04 00 02 00 17  
00000040 00 0B 00 02 01 00 
Oct 02 15:33:24 DEBG send header: (13 bytes):
00000000 15 FE FD 00 00 00 00 00 00 00 01 00 02  
Oct 02 15:33:24 DEBG send unencrypted: (2 bytes):
00000000 02 00 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions