BUG/MINOR: quic: Wrong Retry paquet version field endianess

The 32-bits version field of the Retry paquet was inversed by the code. As this
field must be in the network byte order on the wire, this code has supposed that
the sender of the Retry packet will always be little endian. Hopefully this is
often the case on our Intel machines ;)

Must be backported as far as 2.6.
This commit is contained in:
Frédéric Lécaille 2023-06-30 14:41:31 +02:00
parent 6c9bf2bdf5
commit 5997d18c78

View File

@ -6646,10 +6646,8 @@ static int send_retry(int fd, struct sockaddr_storage *addr,
(quic_pkt_type(QUIC_PACKET_TYPE_RETRY, qv->num) << QUIC_PACKET_TYPE_SHIFT) |
statistical_prng_range(16);
/* version */
buf[i++] = *((unsigned char *)&qv->num + 3);
buf[i++] = *((unsigned char *)&qv->num + 2);
buf[i++] = *((unsigned char *)&qv->num + 1);
buf[i++] = *(unsigned char *)&qv->num;
*(uint32_t *)&buf[i] = htonl(qv->num);
i += sizeof(uint32_t);
/* Use the SCID from <pkt> for Retry DCID. */
buf[i++] = pkt->scid.len;