Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_migration.c @ 8940:fb41e37ddeb0 quic
QUIC: decoupled path state and limitation status.
The path validation status and anti-amplification limit status is actually
two different variables. It is possible that validating path should not
be limited (for example, when re-validating former path).
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 13 Dec 2021 09:48:33 +0300 |
parents | ddd5e5c0f87d |
children | 118a34e32121 |
comparison
equal
deleted
inserted
replaced
8939:ddd5e5c0f87d | 8940:fb41e37ddeb0 |
---|---|
156 | 156 |
157 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 157 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
158 "quic path #%uL successfully validated", path->seqnum); | 158 "quic path #%uL successfully validated", path->seqnum); |
159 | 159 |
160 path->state = NGX_QUIC_PATH_VALIDATED; | 160 path->state = NGX_QUIC_PATH_VALIDATED; |
161 path->limited = 0; | |
161 | 162 |
162 return NGX_OK; | 163 return NGX_OK; |
163 } | 164 } |
164 | 165 |
165 | 166 |
212 | 213 |
213 path = ngx_quic_alloc_path(c); | 214 path = ngx_quic_alloc_path(c); |
214 if (path == NULL) { | 215 if (path == NULL) { |
215 return NULL; | 216 return NULL; |
216 } | 217 } |
218 | |
219 path->state = NGX_QUIC_PATH_NEW; | |
220 path->limited = 1; | |
217 | 221 |
218 path->seqnum = qc->path_seqnum++; | 222 path->seqnum = qc->path_seqnum++; |
219 path->last_seen = ngx_current_msec; | 223 path->last_seen = ngx_current_msec; |
220 | 224 |
221 path->socklen = socklen; | 225 path->socklen = socklen; |
330 | 334 |
331 if (path->state != NGX_QUIC_PATH_NEW) { | 335 if (path->state != NGX_QUIC_PATH_NEW) { |
332 /* force limits/revalidation for paths that were not seen recently */ | 336 /* force limits/revalidation for paths that were not seen recently */ |
333 if (ngx_current_msec - path->last_seen > qc->tp.max_idle_timeout) { | 337 if (ngx_current_msec - path->last_seen > qc->tp.max_idle_timeout) { |
334 path->state = NGX_QUIC_PATH_NEW; | 338 path->state = NGX_QUIC_PATH_NEW; |
339 path->limited = 1; | |
335 path->sent = 0; | 340 path->sent = 0; |
336 path->received = 0; | 341 path->received = 0; |
337 } | 342 } |
338 } | 343 } |
339 | 344 |
348 * | 353 * |
349 * should we account garbage as received or only decrypting packets? | 354 * should we account garbage as received or only decrypting packets? |
350 */ | 355 */ |
351 path->received += len; | 356 path->received += len; |
352 | 357 |
353 ngx_log_debug6(NGX_LOG_DEBUG_EVENT, c->log, 0, | 358 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, c->log, 0, |
354 "quic packet via #%uL:%uL:%uL" | 359 "quic packet via #%uL:%uL:%uL" |
355 " size:%O path recvd:%O sent:%O", | 360 " size:%O path recvd:%O sent:%O limited:%ui", |
356 qsock->sid.seqnum, qsock->cid->seqnum, path->seqnum, | 361 qsock->sid.seqnum, qsock->cid->seqnum, path->seqnum, |
357 len, path->received, path->sent); | 362 len, path->received, path->sent, path->limited); |
358 | 363 |
359 return NGX_OK; | 364 return NGX_OK; |
360 } | 365 } |
361 | 366 |
362 | 367 |
605 "quic path #%uL validation failed", path->seqnum); | 610 "quic path #%uL validation failed", path->seqnum); |
606 | 611 |
607 /* found expired path */ | 612 /* found expired path */ |
608 | 613 |
609 path->state = NGX_QUIC_PATH_NEW; | 614 path->state = NGX_QUIC_PATH_NEW; |
615 path->limited = 1; | |
610 | 616 |
611 /* | 617 /* |
612 * RFC 9000, 9.4. Loss Detection and Congestion Control | 618 * RFC 9000, 9.4. Loss Detection and Congestion Control |
613 * | 619 * |
614 * If the timer fires before the PATH_RESPONSE is received, the | 620 * If the timer fires before the PATH_RESPONSE is received, the |