]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Clarifications about transport parameters value
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 23 May 2022 16:29:39 +0000 (18:29 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 30 May 2022 07:59:26 +0000 (09:59 +0200)
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.

include/haproxy/quic_tp-t.h
src/haproxy.c
src/quic_tp.c

index 1c5fc54cbce6a4a6c4aeeecd2306fa5c03dce709..b4e948ebbb4302e654e2ee7bc3c7eff16b2bedc3 100644 (file)
@@ -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
index e2a7d729d0441740bfb3606cf64b5580d4a5e6be..32eb4bdc6a131dc94be5c27cf147d0d38d532eea 100644 (file)
@@ -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 */
index e97c3a4df67eac08074c783fa3f69c9f83442e6b..69c654114a277063d8cc938ffaa6b508634473e2 100644 (file)
  * 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 <dst> 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;