Coder Social home page Coder Social logo

Comments (5)

mrdeep1 avatar mrdeep1 commented on August 17, 2024

It looks like in the request handler doing your specific OSCORE stuff called from handle_request() for the resource defined in the CoAP PDU is releasing the response PDU's data as pointed to by response->token - response->hdr_size, but the response PDU object is still there.

This is where things start to fail

ssize_t
coap_session_send_pdu(coap_session_t *session, coap_pdu_t *pdu) {
  ssize_t bytes_written = -1;
  assert(pdu->hdr_size > 0);

  /* Caller handles partial writes */
  bytes_written = session->sock.lfunc[COAP_LAYER_SESSION].l_write(session,
                  pdu->token - pdu->hdr_size,
                  pdu->used_size + pdu->hdr_size);
  coap_show_pdu(COAP_LOG_DEBUG, pdu);
  return bytes_written;
}

where l.write is coap_netif_dgrm_write() in your case.

What does your OSCORE implementation provide that libcoap's version does not?

from libcoap.

rpati12 avatar rpati12 commented on August 17, 2024

What does your OSCORE implementation provide that libcoap's version does not?
==> We support both libcoap and openthread. We have a common oscore implementation which works on top of both these coap APIs. And this was already an old implementation we did as there was no support of OSCORE in libcoap or was in WIP.

Regarding freeing the response PDU, it looks unusual as we have not freed it explicitly. I had called it once but now I am trying after removing the delete-pdu() call. I will re-look into it and get back.

Thanks for your prompt response as always.

from libcoap.

mrdeep1 avatar mrdeep1 commented on August 17, 2024

As a FYI, the libcoap code picks up the OSCORE option on an inbound packet and says it is invalid in the function coap_option_check_critical() if libcoap is not running OSCORE before the PDU gets passed up to the application. However, calling coap_register_option(context, COAP_OPTION_OSCORE) allows this to be overridden.

from libcoap.

fun-works avatar fun-works commented on August 17, 2024

Yes, we have registered oscore option 9 to receive the oscore packets. Thanks for the information.

from libcoap.

fun-works avatar fun-works commented on August 17, 2024

We can close this issue as it was an issue in my code. Thanks for your support.

from libcoap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.