From: Frédéric Lécaille Date: Tue, 8 Mar 2022 13:08:16 +0000 (+0100) Subject: MINOR: quic: Add max_idle_timeout advertisement handling X-Git-Tag: v2.6-dev3~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=66d37fa0517d2d450b5faa7d74610f4fa1332770;p=thirdparty%2Fhaproxy.git MINOR: quic: Add max_idle_timeout advertisement handling When we store the remote transport parameters, we compute the maximum idle timeout for the connection which is the minimum of the two advertised max_idle_timeout transport parameter values if both have non-null values, or the maximum if one of the value is set and non-null. --- diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index 277143d920..37bfad4e85 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -742,6 +742,7 @@ struct quic_conn { struct quic_tls_kp nxt_tx; } ku; unsigned int max_ack_delay; + unsigned int max_idle_timeout; struct quic_path paths[1]; struct quic_path *path; diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 48568e9a69..1156912871 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -942,17 +942,30 @@ static inline int quic_transport_params_decode(struct quic_transport_params *p, /* Store transport parameters found in buffer into QUIC connection * depending on value which must be 1 for a server (haproxy listener) * or 0 for a client (connection to a haproxy server). + * Note that peer transport parameters are stored in the TX part of the connection: + * they are used to send packets to the peer with its transport parameters as + * limitations. * Returns 1 if succeeded, 0 if not. */ static inline int quic_transport_params_store(struct quic_conn *conn, int server, const unsigned char *buf, const unsigned char *end) { - if (!quic_transport_params_decode(&conn->tx.params, server, buf, end)) + struct quic_transport_params *tx_params = &conn->tx.params; + struct quic_transport_params *rx_params = &conn->rx.params; + + if (!quic_transport_params_decode(tx_params, server, buf, end)) return 0; - if (conn->tx.params.max_ack_delay) - conn->max_ack_delay = conn->tx.params.max_ack_delay; + if (tx_params->max_ack_delay) + conn->max_ack_delay = tx_params->max_ack_delay; + + if (tx_params->max_idle_timeout && rx_params->max_idle_timeout) + conn->max_idle_timeout = + QUIC_MIN(tx_params->max_idle_timeout, rx_params->max_idle_timeout); + else + conn->max_idle_timeout = + QUIC_MAX(tx_params->max_idle_timeout, rx_params->max_idle_timeout); return 1; }