As promised, here are my patches for the socket and record buffers on the receive side. It does not seem that modifications to the upper layers (application, handshake) are needed for DTLS.