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

Issue with running Contiki-NG with latest release of Leshan (2.0.0-M15) #1627

Closed
joakimeriksson opened this issue Jun 26, 2024 · 10 comments
Closed
Labels
bug Dysfunctionnal behavior dependencies Related to dependencies

Comments

@joakimeriksson
Copy link
Contributor

joakimeriksson commented Jun 26, 2024

Version(s)

v2.0.0-M15

Which components

leshan-server-demo

Tested With

Contiki-NG LwM2M IPSO Objects example

What happened

When the client tries to join the server using DTLS there is an issue at the client hello stage:

2024-06-26 15:44:40,517 DTLSConnector        [WARN] Processing new CLIENT_HELLO from peer [[fd00:0:0:0:302:304:506:708]:5684] failed! PEER=[fd00:0:0:0:302:304:506:708]:5684 
java.lang.IllegalArgumentException: Bad arguments
	at java.base/javax.crypto.Mac.update(Mac.java:528)
	at org.eclipse.californium.scandium.dtls.ClientHello.updateForCookie(ClientHello.java:371)
	at org.eclipse.californium.scandium.CookieGenerator.generateCookie(CookieGenerator.java:175)
	at org.eclipse.californium.scandium.CookieGenerator.generateCookie(CookieGenerator.java:196)
	at org.eclipse.californium.scandium.DTLSConnector.processNewClientHello(DTLSConnector.java:2677)
	at org.eclipse.californium.scandium.DTLSConnector.access$1500(DTLSConnector.java:262)
	at org.eclipse.californium.scandium.DTLSConnector$16.run(DTLSConnector.java:2087)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)

It might be related to an update in the Scandium DTLS implementation that seems to have a change in the implementation of the client hello (including that specific line).

How to reproduce

Likely possible to reproduce with any client using PSK and DTLS with our settings in contiki-ng's lwm2m example.
Run the leshan demo server locally then do the following in contiki-ng.

>contiki-ng/examples/lwm2m-ipso-objects
make MAKE_WITH_DTLS=1 MAKE_COAP_DTLS_WITH_PSK=1 MAKE_COAP_DTLS_WITH_CLIENT=1 MAKE_COAP_DTLS_KEYSTORE=MAKE_COAP_DTLS_KEYSTORE_SIMPLE
sudo ./build/native/example-ipso-objects.native
...

This will cause the problem.

Relevant Output

No response

@joakimeriksson joakimeriksson added the bug Dysfunctionnal behavior label Jun 26, 2024
@sbernard31
Copy link
Contributor

I'm busy on another task for now. I could try to look at this just after.
But at first sight it seems this is relative to scanidum, so maybe better to open an issue directly there ?

@joakimeriksson
Copy link
Contributor Author

joakimeriksson commented Jun 27, 2024

I can do a copy of this there also. It should work well there also. I did not check the commit log for Leshan so I am not sure if there are any changes w.r.t to this in Leshan.
eclipse-californium/californium#2255

@joakimeriksson
Copy link
Contributor Author

This bug is now fixed in Californium/Scandium - so now I guess we wait for the next release of Leshan!
The fix was this one: eclipse-californium/californium#2256 .

@sbernard31 sbernard31 added the dependencies Related to dependencies label Jul 2, 2024
@sbernard31
Copy link
Contributor

Thx for taking to report that here and at californium project 🙏
That really helps !

so now I guess we wait for the next release of Leshan!

More exactly, you need to wait for a Californium 3.13 release.

Once this will be done, Leshan will be able to integrate it in master and maybe later a Leshan release will be done with that fixed version of californium.

But generally Californium/Scandium does not break too much public API, so probably you will be able to use Californium 3.13 with Leshan 2.0.0-M15 and so no need to wait for a Leshan 2.0.0-M16 or M17 release.

@sbernard31
Copy link
Contributor

So Californium 3.13 should be release end of July : eclipse-californium/californium#2255 (comment)

A possible workaround not tested : eclipse-californium/californium#2255 (comment)

@joakimeriksson
Copy link
Contributor Author

Yes, I have a patched M15 with the fixed class that seems to work well.

@sbernard31
Copy link
Contributor

Finally a 3.12.1 sooner than expected ? eclipse-californium/californium#2258

@joakimeriksson
Copy link
Contributor Author

Yes, very good - that can for sure be used for fixing our issue!
(I did test the fix).

@sbernard31 sbernard31 mentioned this issue Jul 5, 2024
3 tasks
@sbernard31
Copy link
Contributor

Californium 3.12.1 is integrated in master.
Leshan sandbox will be updated soon. (this is automatic and should take few minutes)

The fix will be available in Leshan 2.0.0-M16 (#1629)

@joakimeriksson
Copy link
Contributor Author

M16 works! (sorry for being a bit late to the testing but I can confirm it works with Contiki-NG).

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

No branches or pull requests

2 participants