comparison src/http/v3/ngx_http_v3_module.c @ 8340:a8fc0ab54cea quic

Added handling of incorrect values in TP configuration. Some parameters have minimal/maximum values defined by standard.
author Vladimir Homutov <vl@nginx.com>
date Thu, 16 Apr 2020 12:17:41 +0300
parents 0f9e9786b90d
children d73516830236
comparison
equal deleted inserted replaced
8339:aba84d9ab256 8340:a8fc0ab54cea
253 ngx_http_v3_srv_conf_t *conf = child; 253 ngx_http_v3_srv_conf_t *conf = child;
254 254
255 ngx_conf_merge_msec_value(conf->quic.max_idle_timeout, 255 ngx_conf_merge_msec_value(conf->quic.max_idle_timeout,
256 prev->quic.max_idle_timeout, 60000); 256 prev->quic.max_idle_timeout, 60000);
257 257
258 // > 2 ^ 14 is invalid
259 ngx_conf_merge_msec_value(conf->quic.max_ack_delay, 258 ngx_conf_merge_msec_value(conf->quic.max_ack_delay,
260 prev->quic.max_ack_delay, 259 prev->quic.max_ack_delay,
261 NGX_QUIC_DEFAULT_MAX_ACK_DELAY); 260 NGX_QUIC_DEFAULT_MAX_ACK_DELAY);
262 261
263 // < 1200 is invalid 262 if (conf->quic.max_ack_delay > 16384) {
263 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
264 "\"quic_max_ack_delay\" greater than"
265 " 16384 is invalid");
266 return NGX_CONF_ERROR;
267 }
268
264 ngx_conf_merge_uint_value(conf->quic.max_packet_size, 269 ngx_conf_merge_uint_value(conf->quic.max_packet_size,
265 prev->quic.max_packet_size, 270 prev->quic.max_packet_size,
266 NGX_QUIC_DEFAULT_MAX_PACKET_SIZE); 271 NGX_QUIC_DEFAULT_MAX_PACKET_SIZE);
267 272
273 if (conf->quic.max_packet_size < 1200
274 || conf->quic.max_packet_size > 65527)
275 {
276 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
277 "\"quic_max_packet_size\" less than"
278 " 1200 or greater than 65527 is invalid");
279 return NGX_CONF_ERROR;
280 }
281
268 ngx_conf_merge_uint_value(conf->quic.initial_max_data, 282 ngx_conf_merge_uint_value(conf->quic.initial_max_data,
269 prev->quic.initial_max_data, 283 prev->quic.initial_max_data,
270 16 * NGX_QUIC_STREAM_BUFSIZE); 284 16 * NGX_QUIC_STREAM_BUFSIZE);
271 285
272 ngx_conf_merge_uint_value(conf->quic.initial_max_stream_data_bidi_local, 286 ngx_conf_merge_uint_value(conf->quic.initial_max_stream_data_bidi_local,
285 prev->quic.initial_max_streams_bidi, 16); 299 prev->quic.initial_max_streams_bidi, 16);
286 300
287 ngx_conf_merge_uint_value(conf->quic.initial_max_streams_uni, 301 ngx_conf_merge_uint_value(conf->quic.initial_max_streams_uni,
288 prev->quic.initial_max_streams_uni, 16); 302 prev->quic.initial_max_streams_uni, 16);
289 303
290 // > 20 is invalid
291 ngx_conf_merge_uint_value(conf->quic.ack_delay_exponent, 304 ngx_conf_merge_uint_value(conf->quic.ack_delay_exponent,
292 prev->quic.ack_delay_exponent, 305 prev->quic.ack_delay_exponent,
293 NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT); 306 NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT);
294 307
308 if (conf->quic.ack_delay_exponent > 20) {
309 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
310 "\"quic_ack_delay_exponent\" greater than"
311 " 20 is invalid");
312 return NGX_CONF_ERROR;
313 }
314
295 ngx_conf_merge_uint_value(conf->quic.disable_active_migration, 315 ngx_conf_merge_uint_value(conf->quic.disable_active_migration,
296 prev->quic.disable_active_migration, 1); 316 prev->quic.disable_active_migration, 1);
297 317
298 // < 2 is invalid
299 ngx_conf_merge_uint_value(conf->quic.active_connection_id_limit, 318 ngx_conf_merge_uint_value(conf->quic.active_connection_id_limit,
300 prev->quic.active_connection_id_limit, 2); 319 prev->quic.active_connection_id_limit, 2);
301 320
321 if (conf->quic.active_connection_id_limit < 2) {
322 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
323 "\"quic_active_connection_id_limit\" less than"
324 " 2 is invalid");
325 return NGX_CONF_ERROR;
326 }
327
302 return NGX_CONF_OK; 328 return NGX_CONF_OK;
303 } 329 }
304 330