Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap server security flag changes between the initial client write and server response #299

Closed
mtusnio opened this issue Nov 18, 2016 · 2 comments

Comments

@mtusnio
Copy link
Contributor

mtusnio commented Nov 18, 2016

This might be caused by the workaround described in #296, however I cannot say that with full certainty.

I managed to get the bootstrap going with the workaround at mtusnio/AwaLWM2M@17d8926. After the initial client write is done, the security flag changes from 1 to 0, and the subsequent read of the bootstrap server response is treated like a plaintext read instead of an encrypted message, which obviously derails the process. Again, this might be due to the workaround causing the resolution to kick in every time the ServerIsBootstrap call is made. I quickly got this to work by doing the changes as found in mtusnio/AwaLWM2M@ca225d6, however this is just a quick workaround the issue as far as I can tell.

I'll put up some more logs on Monday with proper debug messages to show exactly where the issue pops up.

@mtusnio
Copy link
Contributor Author

mtusnio commented Dec 2, 2016

I've added printfs to the NetworkSocket_Read and NetworkSocket_Send commands, you can find the log at the end of this message. From what I can see the moment a packet arrives the Secure flag switches for destAddress->Secure and (*sourceAddress)->Secure from 1 to 0. The workaround above
(mtusnio/AwaLWM2M@ca225d6) does the job of fixing the issue, but it also means some addresses are left unfreed.

[DEBUG] [coap_abstraction_erbium.c:249] Coap PUT for /0
[DEBUG] [coap_abstraction_erbium.c:311] resolve address from Uri: coaps://ds-mono.flowcloud.syst
ems:15684
[DEBUG] [network_abstraction_contiki.c:299] Address free: coaps://ds-mono.flowcloud.systems:1568
4
[DEBUG] [lwm2m_client_core.c:2079] BOOTSTRAP WRITE: /0
[DEBUG] [lwm2m_client_core.c:147] Deserialise object 0:
[DEBUG] [coap_abstraction_erbium.c:311] resolve address from Uri: coaps://ds-mono.flowcloud.syst
ems:5684/
[DEBUG] [network_abstraction_contiki.c:116] Lookup of "ds-mono.flowcloud.systems" succeded!
[DEBUG] [network_abstraction_contiki.c:337] Address add: coaps://ds-mono.flowcloud.systems:5684
[DEBUG] [network_abstraction_contiki.c:299] Address free: coaps://ds-mono.flowcloud.systems:5684
[DEBUG] [coap_abstraction_erbium.c:265] Coap Response code 204
[DEBUG] [network_abstraction_contiki.c:584] Network socket send called, security set as 1
dtls_prepare_record(): encrypt using TLS_PSK_WITH_AES_128_CCM_8
Post awa process
Resource changed
Running the loop
[DEBUG] [network_abstraction_contiki.c:539] NetworkSocket_Read called, security set as 1
Post awa process
Resource changed
Running the loop
[DEBUG] [network_abstraction_contiki.c:483] Packet from: 17213 17213
[DEBUG] [network_abstraction_contiki.c:539] NetworkSocket_Read called, security set as 0
[DEBUG] [network_abstraction_contiki.c:584] Network socket send called, security set as 0
Post awa process
Resource changed
Running the loop
[DEBUG] [network_abstraction_contiki.c:483] Packet from: 17213 17213
[DEBUG] [network_abstraction_contiki.c:539] NetworkSocket_Read called, security set as 0
[DEBUG] [network_abstraction_contiki.c:584] Network socket send called, security set as 0
Post awa process
Resource changed
Running the loop
[DEBUG] [network_abstraction_contiki.c:539] NetworkSocket_Read called, security set as 0
Post awa process
Resource changed

@cheekyhalf
Copy link
Collaborator

See #296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants