comparison src/event/ngx_event_quic.c @ 8169:7a9ab6f7cea3 quic

QUIC: updated anti-amplification check for draft 32. This accounts for the following change: * Require expansion of datagrams to ensure that a path supports at least 1200 bytes: - During the handshake ack-eliciting Initial packets from the server need to be expanded
author Vladimir Homutov <vl@nginx.com>
date Mon, 26 Oct 2020 23:58:34 +0300
parents f32740ddd484
children e2086d8181fa
comparison
equal deleted inserted replaced
8168:f32740ddd484 8169:7a9ab6f7cea3
4338 4338
4339 4339
4340 static ngx_int_t 4340 static ngx_int_t
4341 ngx_quic_output_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx) 4341 ngx_quic_output_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx)
4342 { 4342 {
4343 size_t len, hlen; 4343 size_t len, hlen, cutoff;
4344 ngx_uint_t need_ack; 4344 ngx_uint_t need_ack;
4345 ngx_queue_t *q, range; 4345 ngx_queue_t *q, range;
4346 ngx_quic_frame_t *f; 4346 ngx_quic_frame_t *f;
4347 ngx_quic_congestion_t *cg; 4347 ngx_quic_congestion_t *cg;
4348 ngx_quic_connection_t *qc; 4348 ngx_quic_connection_t *qc;
4389 * Prior to validation, endpoints are limited in what they 4389 * Prior to validation, endpoints are limited in what they
4390 * are able to send. During the handshake, a server cannot 4390 * are able to send. During the handshake, a server cannot
4391 * send more than three times the data it receives; 4391 * send more than three times the data it receives;
4392 */ 4392 */
4393 4393
4394 if (((c->sent + hlen + len + f->len) / 3) > qc->received) { 4394 if (f->level == ssl_encryption_initial) {
4395 cutoff = (c->sent + NGX_QUIC_MIN_INITIAL_SIZE) / 3;
4396
4397 } else {
4398 cutoff = (c->sent + hlen + len + f->len) / 3;
4399 }
4400
4401 if (cutoff > qc->received) {
4395 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 4402 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
4396 "quic hit amplification limit" 4403 "quic hit amplification limit"
4397 " received:%uz sent:%O", 4404 " received:%uz sent:%O",
4398 qc->received, c->sent); 4405 qc->received, c->sent);
4399 break; 4406 break;