pkg/tinydtls: auxiliary data API does not work for async sockets #16054
Labels
Area: network
Area: Networking
Area: pkg
Area: External package ports
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
This will most likely also affect the (WIP) port of wolfSSL.
Description
While #14706 works fine for synchronous DTLS sockets and is easily extensible, the aux API does not work for asynchronous DTLS sockets at all. The major problem lies in the way how async sockets work for DTLS:
aux_rx: When encrypted data is received on the underlying (also asynchronous) UDP socket, the internal
_udp_cb()
handles the incoming event. It hands the encrypted data over to tinydtls to decrypt it. After successful decrypt, tinydtls calls the_read()
-function of the tinydtls riot port. This function receives the buffer holding the decrypted data, buffer len and the concerned session from tinydtls and sets it in provided fields in the associated DTLS socket. Now it finally fires the DTLS event for the user application. If the user now receives the data viasock_dtls_recv_aux()
it just returns the previously set data in the socket. The aux object remains untouched.aux_tx: No direct call of
sock_udp_send_aux()
, data is handed over to tinydtls and after encryption it calls_write()
in the tinydtls riot port to send the data.Expected results
Getting the requested aux fields
Actual results
Empty aux objects
The only fix that comes in my mind is similar how we "solved" #15755. Attach the aux objects to the socket and retrieve them after tinydtls has done it's job. For the aux_tx object this is easily doable without any potential problem afaik. But for the receiving aux object there would be no way to set custom
aux_flags
to determine which fields should be retrieved, since when the user event is fired thesock_udp_recv()
has already been called. In this case we could only do all or nothing.The text was updated successfully, but these errors were encountered: