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

Allow coap-client disable CSM #1258

Closed
JimmyBaize opened this issue Oct 18, 2023 · 5 comments
Closed

Allow coap-client disable CSM #1258

JimmyBaize opened this issue Oct 18, 2023 · 5 comments

Comments

@JimmyBaize
Copy link

JimmyBaize commented Oct 18, 2023

Is your feature request related to a problem? Please describe.
Some CoAP servers do not support CSM message processing.
When I use libcoap to implement the coap client, CSM messages are sent, but the server does not process them. As a result, the client is suspended waiting for a CSM response..

Describe the solution you would like
open API to allow the coap client not to send CSM.
for example
coap_context_disable_csm(ctx);

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Oct 18, 2023

The right answer here is that the server that does not provide a CSM needs to be fixed as it is in clear violation of RFC8323.

RFC8323 5.3 Capabilities and Settings Messages (CSMs) states

   One CSM MUST be sent by each endpoint at the start of the Transport
   Connection.  Additional CSMs MAY be sent at any other time by either
   endpoint over the lifetime of the connection.

Note the MUST. The server MUST send a CSM for reliable (i.e. TCP) transports.

That said, adding in something that supports a remote endpoint violating RFC8323 is do-able. An option is to use a function such as coap_context_set_broken_csm() (CSM is still sent, but no CSM response is expected), or after a timeout of 5 seconds when no CSM is received to continue anyway. I think I prefer the latter.

@JimmyBaize
Copy link
Author

Open source software that implements the CoAP protocol according to the description in the wiki
Many of them are not implemented RFC8323.

so coap_context_set_broken_csm() (CSM is still sent, but no CSM response is expected) This is a good solution.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Oct 18, 2023

RFC7252 is specifically for UDP based protocols only. You are using a TCP based (i.e. Reliable) protocol here where the format of the CoAP header / message format is different to the UDP version, and has to follow RFC8383 to even work at that level (See RFC8323 3.2 Message Format. So you have here a partial implementation of RFC8383 (which may not be advertised on the wiki) which fails to obey a MUST. So separately, you need to raise the missing CSM issue on the appropriate forum (I suspect that it may have already been raised).

The challenge I have with coap_context_set_broken_csm() is that there is no waiting for a CSM response which may have some negotiation / capabilities information and so the first request gets sent before the remote CMS is read which may need to alter the characteristics of the first request which has already gone out over the wire (examples are block support, BERT support, smaller maximum message size).

The timeout is a better route, but it does not have to be 5 seconds for a non-response.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Oct 18, 2023

Please try out #1259 and see if this works for you.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Oct 24, 2023

Closed as alternative now available using (new) coap_context_set_csm_timeout_ms().

@mrdeep1 mrdeep1 closed this as completed Oct 24, 2023
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