]> git.kaiwu.me - nginx.git/commitdiff
QUIC: the "quic_active_connection_id_limit" directive.
authorVladimir Homutov <vl@nginx.com>
Tue, 18 Jan 2022 09:49:55 +0000 (12:49 +0300)
committerVladimir Homutov <vl@nginx.com>
Tue, 18 Jan 2022 09:49:55 +0000 (12:49 +0300)
The directive sets corresponding transport parameter and limits number of
created client ids.

src/event/quic/ngx_event_quic.h
src/event/quic/ngx_event_quic_transport.c
src/http/v3/ngx_http_v3_module.c
src/stream/ngx_stream_quic_module.c

index 9481fef62858f827f8191091b14f8ddf39461fd5..19518475467d3986bde51db39c2c872a0907b88f 100644 (file)
@@ -40,6 +40,7 @@ typedef struct {
     size_t                     stream_buffer_size;
     ngx_uint_t                 max_concurrent_streams_bidi;
     ngx_uint_t                 max_concurrent_streams_uni;
+    ngx_uint_t                 active_connection_id_limit;
     ngx_int_t                  stream_close_code;
     ngx_int_t                  stream_reject_code_uni;
     ngx_int_t                  stream_reject_code_bidi;
index 0ff42de2decaab52e78c854f681f7d0842fd3b7a..949d2691bb30b8b256ff36788e9b6818751d87aa 100644 (file)
@@ -1974,7 +1974,7 @@ ngx_quic_init_transport_params(ngx_quic_tp_t *tp, ngx_quic_conf_t *qcf)
     tp->max_ack_delay = NGX_QUIC_DEFAULT_MAX_ACK_DELAY;
     tp->ack_delay_exponent = NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT;
 
-    tp->active_connection_id_limit = 2;
+    tp->active_connection_id_limit = qcf->active_connection_id_limit;
     tp->disable_active_migration = qcf->disable_active_migration;
 
     return NGX_OK;
index 455b613e171af2bb8d92a49228eeaa7cffd0b5b1..d274a3bf2368d7d6d29cec8c7269512bcfda5793 100644 (file)
@@ -104,6 +104,13 @@ static ngx_command_t  ngx_http_v3_commands[] = {
       0,
       NULL },
 
+    { ngx_string("quic_active_connection_id_limit"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_HTTP_SRV_CONF_OFFSET,
+      offsetof(ngx_http_v3_srv_conf_t, quic.active_connection_id_limit),
+      NULL },
+
       ngx_null_command
 };
 
@@ -240,6 +247,7 @@ ngx_http_v3_create_srv_conf(ngx_conf_t *cf)
     h3scf->quic.gso_enabled = NGX_CONF_UNSET;
     h3scf->quic.stream_close_code = NGX_HTTP_V3_ERR_NO_ERROR;
     h3scf->quic.stream_reject_code_bidi = NGX_HTTP_V3_ERR_REQUEST_REJECTED;
+    h3scf->quic.active_connection_id_limit = NGX_CONF_UNSET_UINT;
 
     return h3scf;
 }
@@ -280,6 +288,10 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
 
     ngx_conf_merge_str_value(conf->quic.host_key, prev->quic.host_key, "");
 
+    ngx_conf_merge_uint_value(conf->quic.active_connection_id_limit,
+                              prev->quic.active_connection_id_limit,
+                              2);
+
     if (conf->quic.host_key.len == 0) {
 
         conf->quic.host_key.len = NGX_QUIC_DEFAULT_HOST_KEY_LEN;
index 34f1e18ef78988b4c6f765e0859be8705bdf766d..0505df50187d91320a4bc0b3937065bd610ebbf9 100644 (file)
@@ -67,6 +67,13 @@ static ngx_command_t  ngx_stream_quic_commands[] = {
       0,
       NULL },
 
+    { ngx_string("quic_active_connection_id_limit"),
+      NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_STREAM_SRV_CONF_OFFSET,
+      offsetof(ngx_quic_conf_t, active_connection_id_limit),
+      NULL },
+
       ngx_null_command
 };
 
@@ -176,6 +183,8 @@ ngx_stream_quic_create_srv_conf(ngx_conf_t *cf)
     conf->retry = NGX_CONF_UNSET;
     conf->gso_enabled = NGX_CONF_UNSET;
 
+    conf->active_connection_id_limit = NGX_CONF_UNSET_UINT;
+
     return conf;
 }
 
@@ -204,6 +213,10 @@ ngx_stream_quic_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
 
     ngx_conf_merge_str_value(conf->host_key, prev->host_key, "");
 
+    ngx_conf_merge_uint_value(conf->active_connection_id_limit,
+                              conf->active_connection_id_limit,
+                              2);
+
     if (conf->host_key.len == 0) {
 
         conf->host_key.len = NGX_QUIC_DEFAULT_HOST_KEY_LEN;