BUG/MEDIUM: quic: fix initialization for local/remote TPs

The local and remote TPs were both processed through the same function
quic_transport_params_init(). This caused the remote TPs to be
overwritten with values configured for our local usage.

Change this by reserving quic_transport_params_init() only for our local
TPs. Remote TPs are simply initialized via
quic_dflt_transport_params_cpy().

This bug could result in a connection closed in error by the client due
to a violation of its TPs. For example, curl client closed the
connection after receiving too many CONNECTION_ID due to an invalid
active_connection_id value used.
This commit is contained in:
Amaury Denoyelle 2022-05-19 16:45:37 +02:00
parent 3dde0d86dd
commit 0daef007e4

View File

@ -456,9 +456,13 @@ static inline void quic_dflt_transport_params_cpy(struct quic_transport_params *
dst->active_connection_id_limit = quic_dflt_transport_params.active_connection_id_limit; dst->active_connection_id_limit = quic_dflt_transport_params.active_connection_id_limit;
} }
/* Initialize <p> transport parameters depending <server> boolean value which /* Initialize <p> transport parameters. <server> is a boolean, set if TPs are
* must be set to 1 for a server (haproxy listener), 0 for a client (connection * used by a server (haproxy frontend) else this is for a client (haproxy
* to haproxy server). * backend).
*
* This must only be used for haproxy local parameters. To initialize peer
* parameters, see quic_dflt_transport_params_cpy().
*
* Never fails. * Never fails.
*/ */
static inline void quic_transport_params_init(struct quic_transport_params *p, static inline void quic_transport_params_init(struct quic_transport_params *p,
@ -885,7 +889,6 @@ static inline int quic_transport_params_decode(struct quic_transport_params *p,
pos = buf; pos = buf;
quic_transport_params_init(p, server);
while (pos != end) { while (pos != end) {
uint64_t type, len; uint64_t type, len;
@ -925,6 +928,9 @@ static inline int quic_transport_params_store(struct quic_conn *conn, int server
struct quic_transport_params *tx_params = &conn->tx.params; struct quic_transport_params *tx_params = &conn->tx.params;
struct quic_transport_params *rx_params = &conn->rx.params; struct quic_transport_params *rx_params = &conn->rx.params;
/* initialize peer TPs to RFC default value */
quic_dflt_transport_params_cpy(tx_params);
if (!quic_transport_params_decode(tx_params, server, buf, end)) if (!quic_transport_params_decode(tx_params, server, buf, end))
return 0; return 0;