[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [tinydtls-dev] Feedback trying to use tinyDTLS with Contiki 2.7
|
Hello,
I have new feedback. When sending, the node was crashing because of the
watchdog because netq send_queue got corrupted.
This was because a node was added many times which made the queue being
an infinite loop.
I added a sanity check in netq for this so dtls does not crash.
https://github.com/iot-lab/armour-tinydtls/commit/b276a3b6cafa82ace11bcfae170cc8378890d0d5
Now the reason why it was added twice, is because the contiki
'dtls_retransmit_process' implementation does not mimic the basic
'dtls_check_retransmit'.
It was not removing the node of the queue but dtls_transmit is always
re-adding it.
I just duplicated the implementation, thinking of how to factorize it
could prevent this problem.
https://github.com/iot-lab/armour-tinydtls/commit/99ba634a03ebbb1692d5543569173a48643e2223
Also the node was freed while still in the queue. (this may be
detectable by checking '->next' for null and setting next to null in
'netq_remove' or 'netq_pop_first')
Also 'node_free' could memset the node to 0 to detect cases where its
reused.
I think it only happen in my case because I'm currently loosing a lot of
packets.
If the packets always arrive, it must solve itself in some way.
Now after some time, the client and server get stuck I will try to see why.
Please let me know what you think of the changes.
I would better have them integrated in the main repository.
Regards,
Gaëtan
On 11/28/2016 05:26 PM, Gaëtan Harter wrote:
Hello,
for a research project, I need to make coap+dtls work on our hardware.
We already have a working Contiki port and I start by integrating
tinyDTLS and validate as much as possible.
I started from a direct clone of the repository, added a shell app in
my contiki repo to allow running test commands.
My first goal was to run the unit tests provided in tinydtls/sha2 and
tinydtls/ecc with every tests packaged in the same firmware.
The first issues I encountered were:
* 'Makefile.tinydtls' still references 'debug.c' instead of
'dtls_debug.c'
* Contiki 2.7 has different path for 'uip.h' and 'uip_debug.h' so I
added a custom CONTIKI_2_7 define to know which one to use.
* Name conflicts in 'testecc.c' and 'testfield.c'
* A boggus name: 'testfiled' instead of 'testfield'
* Some compilation warning
I fixed all of them here for the moment:
https://github.com/iot-lab/armour-tinydtls/compare/0016138fe3998552eee3987a1c09da43a23c9fb5...master
These were really easily fixed.
I will contribute that back to the main repository, but wanted to get
some feedback here before going to gerrit.
Now two other problems that occured:
Testing takes time on slow hardware
-----------------------------------
I execute the tests from testecc in another C file, (just call the
test functions from another app).
It crashed in edcsaTest, adding some prints showed it never crashed at
the same time.
After a lot of debugging I found that the watchdog was triggered and
was rebooting the node.
It could be a good idea to add some `watchdog_periodic();` calls
between each test.
It's not in my clone as I am calling the function from another file.
After that, all tests are ok and working.
Include mess
------------
There is a bigger problem I have not written a solution to, I just
fell on it right now.
I'm now at the level of trying to run a client and a server. I took
the example files from here:
https://github.com/spark/tinydtls/tree/master/examples/contiki
The client was crashing because it accesses invalid addresses when
using "dtls_security_params(peer)".
I tried to print, its value was changing between 'dtls_new_peer' and
just after returning its value to 'dtls_connect'.
Using gdb I saw that in these two functions, the definition of a peer
was different. One was built with UTASH support and not the other.
And in fact, not every header is including "dtls_config.h" and so
"platform-specific/platform.h"
This led to a type being defined differently in two C files from the
library.
I quickly tried try removing the define NOHASH in
"platform-specific/platform.h"
-#define DTLS_PEERS_NOHASH 1
+//#define DTLS_PEERS_NOHASH 1
Then I got the following compilation warning:
In file included from ../../../../apps/tinydtls/dtls_debug.h:24:0,
from ../../../../apps/tinydtls/dtls.c:39:
../../../../apps/tinydtls/global.h:139:0: warning: "uthash_fatal"
redefined
#define uthash_fatal(msg) return(-1) /* fatal error in uthash */
^
In file included from ../../../../apps/tinydtls/dtls.c:36:0:
../../../../apps/tinydtls/uthash.h:70:0: note: this is the location
of the previous definition
#define uthash_fatal(msg) exit(-1) /* fatal error (out of
memory,etc) */
So it requires even more cleaning.
But at least the client is not crashing on the same problem.
(Currently it's rebooting because of the watchdog too, but I did not
investigate.)
What would be the idea to fix this include problem?
Also, currently both "tinydtls.h" and "dtls_config.h" are defining
DTLS_ECC, DTLS_PSK and WITH_CONTIKI.
I will keep working on this and give feedback.
Regards,
Gaëtan
_______________________________________________
tinydtls-dev mailing list
tinydtls-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tinydtls-dev