From: Frédéric Lécaille Date: Mon, 23 May 2022 16:29:39 +0000 (+0200) Subject: MINOR: quic: Clarifications about transport parameters value X-Git-Tag: v2.6.0~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aee675746cbbe5d6242e184728f4bd950a6573d4;p=thirdparty%2Fhaproxy.git MINOR: quic: Clarifications about transport parameters value This is becoming difficult to distinguish the default values for transport parameters which come with the RFC from our implementation default values when not set by configuration (tunable parameters). Add a comment to distinguish them. Prefix these default values by QUIC_TP_DFLT_ to distinguish them from QUIC_DFLT_* value even if there are not numerous. Furthermore ->max_udp_payload_size must be first initialized to QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE especially for received value. --- diff --git a/include/haproxy/quic_tp-t.h b/include/haproxy/quic_tp-t.h index 1c5fc54cbc..b4e948ebbb 100644 --- a/include/haproxy/quic_tp-t.h +++ b/include/haproxy/quic_tp-t.h @@ -27,13 +27,16 @@ struct tp_preferred_address { }; /* Default values for the absent transport parameters */ -#define QUIC_DFLT_MAX_UDP_PAYLOAD_SIZE 65527 /* bytes */ -#define QUIC_DFLT_ACK_DELAY_COMPONENT 3 /* milliseconds */ -#define QUIC_DFLT_MAX_ACK_DELAY 25 /* milliseconds */ -#define QUIC_DFLT_FRONT_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ -#define QUIC_DFLT_FRONT_MAX_STREAMS_BIDI 100 -#define QUIC_DFLT_BACK_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ -#define QUIC_ACTIVE_CONNECTION_ID_LIMIT 2 /* number of connections */ +#define QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE 65527 /* bytes */ +#define QUIC_TP_DFLT_ACK_DELAY_COMPONENT 3 /* milliseconds */ +#define QUIC_TP_DFLT_MAX_ACK_DELAY 25 /* milliseconds */ +#define QUIC_TP_DFLT_ACTIVE_CONNECTION_ID_LIMIT 2 /* number of connections */ +/* These ones are our implementation default values when not set + * by configuration + */ +#define QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ +#define QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI 100 +#define QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ /* Types of QUIC transport parameters */ #define QUIC_TP_ORIGINAL_DESTINATION_CONNECTION_ID 0 diff --git a/src/haproxy.c b/src/haproxy.c index e2a7d729d0..32eb4bdc6a 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -206,9 +206,9 @@ struct global global = { .idle_timer = 1000, /* 1 second */ #endif #ifdef USE_QUIC - .quic_backend_max_idle_timeout = QUIC_DFLT_BACK_MAX_IDLE_TIMEOUT, - .quic_frontend_max_idle_timeout = QUIC_DFLT_FRONT_MAX_IDLE_TIMEOUT, - .quic_frontend_max_streams_bidi = QUIC_DFLT_FRONT_MAX_STREAMS_BIDI, + .quic_backend_max_idle_timeout = QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT, + .quic_frontend_max_idle_timeout = QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT, + .quic_frontend_max_streams_bidi = QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI, .quic_retry_threshold = QUIC_DFLT_RETRY_THRESHOLD, .quic_streams_buf = 30, #endif /* USE_QUIC */ diff --git a/src/quic_tp.c b/src/quic_tp.c index e97c3a4df6..69c654114a 100644 --- a/src/quic_tp.c +++ b/src/quic_tp.c @@ -15,10 +15,10 @@ * before updating them with customized values. */ struct quic_transport_params quic_dflt_transport_params = { - .max_udp_payload_size = QUIC_MAX_UDP_PAYLOAD_SIZE, - .ack_delay_exponent = QUIC_DFLT_ACK_DELAY_COMPONENT, - .max_ack_delay = QUIC_DFLT_MAX_ACK_DELAY, - .active_connection_id_limit = QUIC_ACTIVE_CONNECTION_ID_LIMIT, + .max_udp_payload_size = QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE, + .ack_delay_exponent = QUIC_TP_DFLT_ACK_DELAY_COMPONENT, + .max_ack_delay = QUIC_TP_DFLT_MAX_ACK_DELAY, + .active_connection_id_limit = QUIC_TP_DFLT_ACTIVE_CONNECTION_ID_LIMIT, }; /* Initialize transport parameters with default values (when absent) @@ -51,6 +51,10 @@ void quic_transport_params_init(struct quic_transport_params *p, int server) /* Set RFC default values for unspecified parameters. */ quic_dflt_transport_params_cpy(p); + /* Set the max_udp_payload_size value. If not would equal to + * QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE + */ + p->max_udp_payload_size = QUIC_MAX_UDP_PAYLOAD_SIZE; if (server) p->max_idle_timeout = global.tune.quic_frontend_max_idle_timeout; else @@ -398,7 +402,7 @@ int quic_transport_params_encode(unsigned char *buf, * "max_packet_size" transport parameter must be transmitted only if different * of the default value. */ - if (p->max_udp_payload_size != QUIC_DFLT_MAX_UDP_PAYLOAD_SIZE && + if (p->max_udp_payload_size != QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE && !quic_transport_param_enc_int(&pos, end, QUIC_TP_MAX_UDP_PAYLOAD_SIZE, p->max_udp_payload_size)) return 0; @@ -435,7 +439,7 @@ int quic_transport_params_encode(unsigned char *buf, * "ack_delay_exponent" transport parameter must be transmitted only if different * of the default value. */ - if (p->ack_delay_exponent != QUIC_DFLT_ACK_DELAY_COMPONENT && + if (p->ack_delay_exponent != QUIC_TP_DFLT_ACK_DELAY_COMPONENT && !quic_transport_param_enc_int(&pos, end, QUIC_TP_ACK_DELAY_EXPONENT, p->ack_delay_exponent)) return 0; @@ -443,7 +447,7 @@ int quic_transport_params_encode(unsigned char *buf, * "max_ack_delay" transport parameter must be transmitted only if different * of the default value. */ - if (p->max_ack_delay != QUIC_DFLT_MAX_ACK_DELAY && + if (p->max_ack_delay != QUIC_TP_DFLT_MAX_ACK_DELAY && !quic_transport_param_enc_int(&pos, end, QUIC_TP_MAX_ACK_DELAY, p->max_ack_delay)) return 0; @@ -453,7 +457,7 @@ int quic_transport_params_encode(unsigned char *buf, return 0; if (p->active_connection_id_limit && - p->active_connection_id_limit != QUIC_ACTIVE_CONNECTION_ID_LIMIT && + p->active_connection_id_limit != QUIC_TP_DFLT_ACTIVE_CONNECTION_ID_LIMIT && !quic_transport_param_enc_int(&pos, end, QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT, p->active_connection_id_limit)) return 0;