comparison src/http/v3/ngx_http_v3_module.c @ 9103:b9230e37b8a1 quic

QUIC: removed "quic_mtu" directive. The directive used to set the value of the "max_udp_payload_size" transport parameter. According to RFC 9000, Section 18.2, the value specifies the size of buffer for reading incoming datagrams: This limit does act as an additional constraint on datagram size in the same way as the path MTU, but it is a property of the endpoint and not the path; see Section 14. It is expected that this is the space an endpoint dedicates to holding incoming packets. Current QUIC implementation uses the maximum possible buffer size (65527) for reading datagrams.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 11 May 2023 10:37:51 +0400
parents c851a2ed5ce8
children f742b1b46901
comparison
equal deleted inserted replaced
9102:3028db26a0f5 9103:b9230e37b8a1
14 ngx_http_variable_value_t *v, uintptr_t data); 14 ngx_http_variable_value_t *v, uintptr_t data);
15 static ngx_int_t ngx_http_v3_add_variables(ngx_conf_t *cf); 15 static ngx_int_t ngx_http_v3_add_variables(ngx_conf_t *cf);
16 static void *ngx_http_v3_create_srv_conf(ngx_conf_t *cf); 16 static void *ngx_http_v3_create_srv_conf(ngx_conf_t *cf);
17 static char *ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, 17 static char *ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent,
18 void *child); 18 void *child);
19 static char *ngx_http_quic_mtu(ngx_conf_t *cf, void *post,
20 void *data);
21 static char *ngx_http_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, 19 static char *ngx_http_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd,
22 void *conf); 20 void *conf);
23 static void *ngx_http_v3_create_loc_conf(ngx_conf_t *cf); 21 static void *ngx_http_v3_create_loc_conf(ngx_conf_t *cf);
24 static char *ngx_http_v3_merge_loc_conf(ngx_conf_t *cf, void *parent, 22 static char *ngx_http_v3_merge_loc_conf(ngx_conf_t *cf, void *parent,
25 void *child); 23 void *child);
26 static char *ngx_http_v3_push(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 24 static char *ngx_http_v3_push(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
27 25
28 26
29 static ngx_conf_post_t ngx_http_quic_mtu_post =
30 { ngx_http_quic_mtu };
31
32
33 static ngx_command_t ngx_http_v3_commands[] = { 27 static ngx_command_t ngx_http_v3_commands[] = {
34 28
35 { ngx_string("http3"), 29 { ngx_string("http3"),
36 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, 30 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
37 ngx_conf_set_flag_slot, 31 ngx_conf_set_flag_slot,
92 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, 86 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
93 ngx_conf_set_flag_slot, 87 ngx_conf_set_flag_slot,
94 NGX_HTTP_SRV_CONF_OFFSET, 88 NGX_HTTP_SRV_CONF_OFFSET,
95 offsetof(ngx_http_v3_srv_conf_t, quic.gso_enabled), 89 offsetof(ngx_http_v3_srv_conf_t, quic.gso_enabled),
96 NULL }, 90 NULL },
97
98 { ngx_string("quic_mtu"),
99 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
100 ngx_conf_set_size_slot,
101 NGX_HTTP_SRV_CONF_OFFSET,
102 offsetof(ngx_http_v3_srv_conf_t, quic.mtu),
103 &ngx_http_quic_mtu_post },
104 91
105 { ngx_string("quic_host_key"), 92 { ngx_string("quic_host_key"),
106 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 93 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
107 ngx_http_quic_host_key, 94 ngx_http_quic_host_key,
108 NGX_HTTP_SRV_CONF_OFFSET, 95 NGX_HTTP_SRV_CONF_OFFSET,
238 h3scf->enable_hq = NGX_CONF_UNSET; 225 h3scf->enable_hq = NGX_CONF_UNSET;
239 h3scf->max_table_capacity = NGX_HTTP_V3_MAX_TABLE_CAPACITY; 226 h3scf->max_table_capacity = NGX_HTTP_V3_MAX_TABLE_CAPACITY;
240 h3scf->max_concurrent_pushes = NGX_CONF_UNSET_UINT; 227 h3scf->max_concurrent_pushes = NGX_CONF_UNSET_UINT;
241 h3scf->max_concurrent_streams = NGX_CONF_UNSET_UINT; 228 h3scf->max_concurrent_streams = NGX_CONF_UNSET_UINT;
242 229
243 h3scf->quic.mtu = NGX_CONF_UNSET_SIZE;
244 h3scf->quic.stream_buffer_size = NGX_CONF_UNSET_SIZE; 230 h3scf->quic.stream_buffer_size = NGX_CONF_UNSET_SIZE;
245 h3scf->quic.max_concurrent_streams_bidi = NGX_CONF_UNSET_UINT; 231 h3scf->quic.max_concurrent_streams_bidi = NGX_CONF_UNSET_UINT;
246 h3scf->quic.max_concurrent_streams_uni = NGX_HTTP_V3_MAX_UNI_STREAMS; 232 h3scf->quic.max_concurrent_streams_uni = NGX_HTTP_V3_MAX_UNI_STREAMS;
247 h3scf->quic.retry = NGX_CONF_UNSET; 233 h3scf->quic.retry = NGX_CONF_UNSET;
248 h3scf->quic.gso_enabled = NGX_CONF_UNSET; 234 h3scf->quic.gso_enabled = NGX_CONF_UNSET;
275 ngx_conf_merge_uint_value(conf->max_concurrent_streams, 261 ngx_conf_merge_uint_value(conf->max_concurrent_streams,
276 prev->max_concurrent_streams, 128); 262 prev->max_concurrent_streams, 128);
277 263
278 conf->max_blocked_streams = conf->max_concurrent_streams; 264 conf->max_blocked_streams = conf->max_concurrent_streams;
279 265
280 ngx_conf_merge_size_value(conf->quic.mtu, prev->quic.mtu,
281 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE);
282
283 ngx_conf_merge_size_value(conf->quic.stream_buffer_size, 266 ngx_conf_merge_size_value(conf->quic.stream_buffer_size,
284 prev->quic.stream_buffer_size, 267 prev->quic.stream_buffer_size,
285 65536); 268 65536);
286 269
287 conf->quic.max_concurrent_streams_bidi = conf->max_concurrent_streams; 270 conf->quic.max_concurrent_streams_bidi = conf->max_concurrent_streams;
327 return NGX_CONF_ERROR; 310 return NGX_CONF_ERROR;
328 } 311 }
329 312
330 sscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_ssl_module); 313 sscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_ssl_module);
331 conf->quic.ssl = &sscf->ssl; 314 conf->quic.ssl = &sscf->ssl;
332
333 return NGX_CONF_OK;
334 }
335
336
337 static char *
338 ngx_http_quic_mtu(ngx_conf_t *cf, void *post, void *data)
339 {
340 size_t *sp = data;
341
342 if (*sp < NGX_QUIC_MIN_INITIAL_SIZE
343 || *sp > NGX_QUIC_MAX_UDP_PAYLOAD_SIZE)
344 {
345 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
346 "\"quic_mtu\" must be between %d and %d",
347 NGX_QUIC_MIN_INITIAL_SIZE,
348 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE);
349
350 return NGX_CONF_ERROR;
351 }
352 315
353 return NGX_CONF_OK; 316 return NGX_CONF_OK;
354 } 317 }
355 318
356 319