]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: quic: consume contig space on requeue datagram
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 4 Aug 2023 07:57:04 +0000 (09:57 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 4 Aug 2023 12:27:40 +0000 (14:27 +0200)
commitb34d353968db7f646e83871cb6b21a246af84ddc
tree0463279ce2cc7c4a32845b6a66214ae12406c855
parentef2b15998cc7148ec78c0ef6b4f511732bdf608f
BUG/MEDIUM: quic: consume contig space on requeue datagram

When handling UDP datagram reception, it is possible to receive a QUIC
packet for one connection to the socket attached to another connection.
To protect against this, an explicit comparison is done against the
packet DCID and the quic-conn CID. On no match, the datagram is requeued
and dispatched via rxbuf and will be treated as if it arrived on the
listener socket.

One reason for this wrong reception is explained by the small race
condition that exists between bind() and connect() syscalls during
connection socket initialization. However, one other reason which was
not thought initially is when clients reuse the same IP:PORT for
different connections. In this case the current FD attribution is not
optimal and this can cause a substantial number of requeuing.

This situation has revealed a bug during requeuing. If rxbuf contig
space is not big enough for the datagram, the incoming datagram was
dropped, even if there is space at buffer origin. This can cause several
datagrams to be dropped in a series until eventually buffer head is
moved when passing through the listener FD.

To fix this, allocate a fake datagram to consume contig space. This is
similar to the handling of datagrams on the listener FD. This allows
then to store the datagram to requeue on buffer head and continue.

This can be reproduced by starting a lot of connections. To increase the
phenomena, POST are used to increase the number of datagram dropping :

$ while true; do curl -F "a=@~/50k" -k --http3-only -o /dev/null https://127.0.0.1:20443/; done
src/quic_sock.c