# Reliable Datagram Sockets

Reliable Datagram Sockets (RDS) is a high-performance, low-latency, reliable, connectionless protocol for delivering datagrams. It is developed by Oracle Corporation.
It was included in the Linux kernel 2.6.30 which was released on 9 June 2009. The code was contributed by the OpenFabrics Alliance (OFA).
On October 19, 2010, VSR announced CVE-2010-3904, a vulnerability within the Linux 2.6.30 kernel which could result in a local privilege escalation via the kernel's implementation of RDS. This was subsequently fixed in Linux 2.6.36.
On May 8, 2019, CVE-2019-11815 was published, regarding a race condition in the Linux RDS implementation that could lead to a use-after-free bug and possible arbitrary code execution. The bug has been fixed in Linux 5.0.8.

## Header

RDS Header :
| Size (bits) | Name | Description |
| be64 | h_sequence | Sequence number |
| be64 | h_ack | Sequence number of last received message |
| be32 | h_len | Length of the message payload |
| be16 | h_sport | Port on source node |
| be16 | h_dport | Port on destination node |
| 8 | h_flags | Described below |
| 8 | h_credit | Credits given (used for credit-based flow control) |
| 32 | h_padding | Padding for 64-bit struct alignment |
| 16 | h_csum | 1's complement header checksum |
| 128 | h_exthdr | Optional extension header space |
RDS Header :
| Offset | Octet | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
| Octet | Bit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| 0 | 0 | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence |
| 4 | 32 | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence | h_sequence |
| 8 | 64 | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack |
| 12 | 96 | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack | h_ack |
| 16 | 128 | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len | h_len |
| 20 | 160 | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_sport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport | h_dport |
| 24 | 192 | h_flags | h_flags | h_flags | h_flags | h_flags | h_flags | h_flags | h_flags | h_credit | h_credit | h_credit | h_credit | h_credit | h_credit | h_credit | h_credit | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ | h_padding…↴ |
| 26 | 208 | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | ↪…h_padding | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum | h_csum |
| 32 | 256 | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr |
| 36 | 288 | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr |
| 40 | 320 | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr |
| 44 | 352 | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr | h_exthdr |