]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: define QUIC_FL_CONN_IS_BACK flag
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 5 Aug 2025 08:18:42 +0000 (10:18 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 7 Aug 2025 14:59:59 +0000 (16:59 +0200)
Define a new quic_conn flag assign if the connection is used on the
backend side. This is similar to other haproxy components such as struct
connection and muxes element.

This flag is positionned via qc_new_conn(). Also update quic traces to
mark proxy side as 'F' or 'B' suffix.

include/haproxy/quic_conn-t.h
include/haproxy/quic_conn.h
src/quic_conn.c
src/quic_trace.c

index 98434416de6f45d5c94ef095e72eb29cf47efd12..a4c294be1a7240d8b6d54923ab92e635c7ce21d9 100644 (file)
@@ -448,7 +448,7 @@ struct quic_conn_closed {
 #define QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED  (1U << 0)
 #define QUIC_FL_CONN_SPIN_BIT                    (1U << 1) /* Spin bit set by remote peer */
 #define QUIC_FL_CONN_NEED_POST_HANDSHAKE_FRMS    (1U << 2) /* HANDSHAKE_DONE must be sent */
-/* gap here */
+#define QUIC_FL_CONN_IS_BACK                     (1U << 3) /* conn used on backend side */
 #define QUIC_FL_CONN_ACCEPT_REGISTERED           (1U << 4)
 #define QUIC_FL_CONN_UDP_GSO_EIO                 (1U << 5) /* GSO disabled due to a EIO occured on same listener */
 #define QUIC_FL_CONN_IDLE_TIMER_RESTARTED_AFTER_READ (1U << 6)
@@ -488,6 +488,7 @@ static forceinline char *qc_show_flags(char *buf, size_t len, const char *delim,
        _(QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED,
        _(QUIC_FL_CONN_SPIN_BIT,
        _(QUIC_FL_CONN_NEED_POST_HANDSHAKE_FRMS,
+       _(QUIC_FL_CONN_IS_BACK,
        _(QUIC_FL_CONN_ACCEPT_REGISTERED,
        _(QUIC_FL_CONN_UDP_GSO_EIO,
        _(QUIC_FL_CONN_IDLE_TIMER_RESTARTED_AFTER_READ,
@@ -508,7 +509,7 @@ static forceinline char *qc_show_flags(char *buf, size_t len, const char *delim,
        _(QUIC_FL_CONN_EXP_TIMER,
        _(QUIC_FL_CONN_CLOSING,
        _(QUIC_FL_CONN_DRAINING,
-       _(QUIC_FL_CONN_IMMEDIATE_CLOSE))))))))))))))))))))))));
+       _(QUIC_FL_CONN_IMMEDIATE_CLOSE)))))))))))))))))))))))));
        /* epilogue */
        _(~0U);
        return buf;
index 7e6adf51d2100efb99870b7d3623a461ec304429..56367f1b4a031053fefa3521f20aa84a74838c34 100644 (file)
@@ -82,6 +82,12 @@ void qc_check_close_on_released_mux(struct quic_conn *qc);
 int quic_stateless_reset_token_cpy(unsigned char *pos, size_t len,
                                    const unsigned char *salt, size_t saltlen);
 
+/* Returns true if <qc> is used on the backed side (as a client). */
+static inline int qc_is_back(const struct quic_conn *qc)
+{
+       return qc->flags & QUIC_FL_CONN_IS_BACK;
+}
+
 /* Free the CIDs attached to <conn> QUIC connection. */
 static inline void free_quic_conn_cids(struct quic_conn *conn)
 {
index 874f7ecb457269e4786def62cbbcf59bcc220a8d..2917ad0629392e6b25b4eee033cdf79b6723424b 100644 (file)
@@ -1198,7 +1198,7 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
        else {
                struct quic_connection_id *conn_cid = NULL;
 
-               qc->flags = QUIC_FL_CONN_PEER_VALIDATED_ADDR;
+               qc->flags = QUIC_FL_CONN_IS_BACK|QUIC_FL_CONN_PEER_VALIDATED_ADDR;
                qc->state = QUIC_HS_ST_CLIENT_INITIAL;
 
                /* This is the original connection ID from the peer server
index c8fe5524b61bb6fd8568ca34a3d0dc996c7248b9..6fa260df685c3befcad32a8da67c3aea2ac104a5 100644 (file)
@@ -115,8 +115,9 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
        if (qc) {
                const struct quic_tls_ctx *tls_ctx;
 
-               chunk_appendf(&trace_buf, " : qc@%p idle_timer_task@%p flags=0x%x",
-                             qc, qc->idle_timer_task, qc->flags);
+               chunk_appendf(&trace_buf, " : qc@%p(%c) idle_timer_task@%p flags=0x%x",
+                             qc, (qc->flags & QUIC_FL_CONN_IS_BACK) ? 'B' : 'F',
+                             qc->idle_timer_task, qc->flags);
                if (mask & QUIC_EV_CONN_NEW) {
                        const int *ssl_err = a2;