Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic_frames.c @ 8883:404de224517e quic
QUIC: limited the total number of frames.
Exceeding 10000 allocated frames is considered a flood.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 13 Oct 2021 14:46:51 +0300 |
parents | 4009f120cad4 |
children | a6a328ebd362 |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_frames.c +++ b/src/event/quic/ngx_event_quic_frames.c @@ -38,18 +38,22 @@ ngx_quic_alloc_frame(ngx_connection_t *c "quic reuse frame n:%ui", qc->nframes); #endif - } else { + } else if (qc->nframes < 10000) { frame = ngx_palloc(c->pool, sizeof(ngx_quic_frame_t)); if (frame == NULL) { return NULL; } -#ifdef NGX_QUIC_DEBUG_ALLOC ++qc->nframes; +#ifdef NGX_QUIC_DEBUG_ALLOC ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic alloc frame n:%ui", qc->nframes); #endif + + } else { + ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic flood detected"); + return NULL; } ngx_memzero(frame, sizeof(ngx_quic_frame_t));