Hi Amaury,
Here is v2 of the series. It addresses your review of v1 and follows
the conclusion reached on the broadcast address question.
Changes since v1
- A new first patch makes send_retry() and send_version_negotiation()
take the listener instead of the FD, and renames their <addr>
argument to <dst>.
- The emission function is now quic_lstnr_sock_send(). It takes the
listener and checks quic_lstnr_may_set_src() itself, so callers
always pass the datagram destination address as source, and
quic_dgram_reply_src() is gone.
- The source address argument now comes before the destination one.
- No flag is set on emission, as with the previous sendto() calls,
and a comment states that a datagram is lost when the socket buffer
is full.
- The EINTR retry is moved to a separate patch at the end.
- As discussed, nothing is done for clients targeting a broadcast or
multicast address, for which Retry, VN and Stateless Reset emission
will fail.
- The regtest is unchanged.
Testing was done on Linux (Debian 13, OpenSSL 3.5.7, aarch64), on top
of 069081792. As for v1, retry_wildcard.vtc fails on current master and
passes with the series, and all reg-tests/quic and reg-tests/qmux tests
pass. In network namespaces with the VIPs on the server loopback, the
Retry, VN and Stateless Reset replies come from the address targeted by
the client, and each fix only changes its own packet type. Each commit
builds with ERR=1, and the series also builds with
USE_QUIC_OPENSSL_COMPAT, without QUIC and on macOS. Since v1, I also
compared the behavior before and after the series with DNAT, TPROXY,
source based policy routing, and an IPVS direct routing setup with
Chromium as client. Only the cases where the source address was wrong
behave differently. FreeBSD was still not tested.
Regards,
Yeonggi Kim
Yeonggi Kim (7):
MINOR: quic: use the listener for Retry and Version Negotiation
emission
MINOR: quic: define a function to emit a datagram on a listener socket
BUG/MEDIUM: quic: use datagram destination as source for Retry
BUG/MINOR: quic: use datagram destination as source for stateless
reset
BUG/MINOR: quic: use datagram destination as source for version
negotiation
REGTESTS: quic: check Retry source address on a wildcard listener
BUG/MINOR: quic: handle EINTR on emission of packets without
connection
include/haproxy/quic_sock.h | 3 ++
include/haproxy/quic_tx.h | 9 ++--
reg-tests/quic/retry_wildcard.vtc | 75 +++++++++++++++++++++++++++++
src/quic_rx.c | 14 ++++--
src/quic_sock.c | 80 ++++++++++++++++++++++++++++---
src/quic_tx.c | 38 ++++++++-------
6 files changed, 188 insertions(+), 31 deletions(-)
create mode 100644 reg-tests/quic/retry_wildcard.vtc
base-commit: 0690817928efbb5d47041aea42b920584f112f48
--
2.50.1 (Apple Git-155)