telefonicaid / lwm2m-node-lib

Library for building OMA Lightweight M2M Applications (client and server).
74 stars 44 forks source link

Possible abuse of proxy uri. #93

Open ezequiel-umu opened 8 years ago

ezequiel-umu commented 8 years ago

I think there could be an abuse of proxy uri which makes this scenario going buggy:

  1. As there is no DTLS support, I've written a DTLS to UDP tunnel.
  2. Every packet received from UDP IoTAgent is then sended via DTLS.

The problem is basically this:

captura de pantalla de 2016-02-23 12 59 38

Every request generates an internal server error which have no sense as every packet is exactly the same but with different port configuration.

The scenario can be summarized as:

  1. A piece of software which listens to port 5689 for UDP packets (assuming CoAP packets).
  2. The same piece of software captures the payload, generates a new DTLS packet with that payload.
  3. DTLS packets are routed to a device, which is already connected by DTLS.
  4. A symmetric scenario follows the packets from DTLS to UDP.

The third point isn't represented by wireshark capture. Wireshark capture only contains the UDP part of the scenario, which in this case is local (using lo interface).

Any idea?

Note: It may have nothing to do with proxy uri, but I think it is the cause.

dmoranj commented 8 years ago

Difficult to say without replicating the whole scenario. Can you provide more details about how you created the DTLS tunnel and how are you trying to use the library (commands you are using and so on)?

dmoranj commented 8 years ago

Ok, it seems it doesn't have anything to do with DTLS, as the problem can be reproduced with a simple get request. I'm working on the problem.

ezequiel-umu commented 8 years ago

I updated the issue. By the way, I'm using lwm2m-iotagent from TelefonicaI+D as software, which uses this library.

dmoranj commented 8 years ago

Ok. The IoT Agent is using this library to deal with LWM2M, so I'll focus on solving the problem here, and it should be fixed then in the IOTA.

dmoranj commented 8 years ago

There seem to be a bug in node-coap, middleware.js, line 54: request.packet should be packet. It raises a "request not defined" error that goes all back to the parseRequest() catch, where it ends up converted in a 5.00 error. Tomorrow, first thing in the morning, I'll make a proposal bugfix to the repository.