]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: add a new flag CO_FL_FDLESS on fd-less connections
authorWilly Tarreau <w@1wt.eu>
Mon, 11 Apr 2022 15:26:56 +0000 (17:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 Apr 2022 17:31:47 +0000 (19:31 +0200)
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
src/quic_sock.c

index 132733392a3f8bff5116f69d90850b0d4d96c245..634452b1f56727814d5573f660d6ae57dede5153 100644 (file)
@@ -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) */
index f3faa64f575570b4c44754dac3ac4d1d66524bb4..8086ff65a60baf07edc1c37950a8636e21ca6a61 100644 (file)
@@ -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;