TL;DR: The current code (Tinydtls 0.8.6) is not compatible with Contiki 3.0.
This is due a change between the version of TinyDTLS 0.8.2 and 0.8.6 that only affects Contiki (I never had this issue with RIOT).
BUT I was unable to track the problem, is not apparent in the #Define contiki lines.
The main issue I'm having is the following: When the main function generates the destination addresses and stored it in the session_t variable everything is ok. BUT once the session is called from the event (read_peer) the data seems to be wrongly formatted, plus seems that MEMB is returning error. Example :
addresses saved to the session (before dtls_connect) is FE80::200:3 ,
Dst addresses returned at the events: : ::1200:08fe
I have two testing branches: CoAPS (0.8.2) and 6CoAPS (which has an 0.8.6 tested with RIOT).
Both branches present the issue with 0.8.6.
Both branches can work with the 0.8.2 but only with the cipher suite PSK (WTH?) and very inefficient with a lot of retransmission.
I even tried using extern connections with the Linux client's but sadly they died in the translation from Cooja to the tunnel, and my real motes don't have enough memory for my tests.
Possible reason: I have count at least 3 "threads" (2 inside of TinyDTLS, one for the main program). Contiki threads are not real threads and should be a minimum, but this mean re-working your part of Contiki.
This is very probably because is almost a lucky occasion when the dtls-client is able to transmit.
The behavior of Tinydtls 0.3.1 was too different with Contiki 2.6, but those regression testing are too complex and I need to focus on my thesis.