From c78a9698ef82d49a08f71fcfbb5341fbb004119d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 11 Apr 2022 17:26:56 +0200 Subject: [PATCH] MINOR: connection: add a new flag CO_FL_FDLESS on fd-less connections QUIC connections do not use a file descriptor, instead they use the quic equivalent which is the quic_conn. A number of our historical functions at the connection level continue to unconditionally touch the file descriptor and this may have consequences once QUIC starts to be used. This patch adds a new flag on QUIC connections, CO_FL_FDLESS, to mention that the connection doesn't have a file descriptor, hence the FD-based API must never be used on them. From now on it will be possible to intrument existing functions to panic when this flag is present. --- include/haproxy/connection-t.h | 2 ++ src/quic_sock.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/haproxy/connection-t.h b/include/haproxy/connection-t.h index 132733392a..634452b1f5 100644 --- a/include/haproxy/connection-t.h +++ b/include/haproxy/connection-t.h @@ -116,6 +116,8 @@ enum { CO_FL_ERROR = 0x00100000, /* a fatal error was reported */ CO_FL_NOTIFY_DONE = 0x001C0000, /* any xprt shut/error flags above needs to be reported */ + CO_FL_FDLESS = 0x00200000, /* this connection doesn't use any FD (e.g. QUIC) */ + /* flags used to report connection status updates */ CO_FL_WAIT_L4_CONN = 0x00400000, /* waiting for L4 to be connected */ CO_FL_WAIT_L6_CONN = 0x00800000, /* waiting for L6 to be connected (eg: SSL) */ diff --git a/src/quic_sock.c b/src/quic_sock.c index f3faa64f57..8086ff65a6 100644 --- a/src/quic_sock.c +++ b/src/quic_sock.c @@ -101,7 +101,7 @@ static int new_quic_cli_conn(struct quic_conn *qc, struct listener *l, if (!sockaddr_alloc(&cli_conn->src, saddr, sizeof *saddr)) goto out_free_conn; - cli_conn->flags |= CO_FL_ADDR_FROM_SET; + cli_conn->flags |= CO_FL_ADDR_FROM_SET | CO_FL_FDLESS; qc->conn = cli_conn; cli_conn->qc = qc; -- 2.39.5