summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2021-11-11 15:15:07 +0300
committerVladimir Homutov <vl@nginx.com>2021-11-11 15:15:07 +0300
commit1562200066d73a037ecfa4e15548cbcc239b354f (patch)
treef21def6646d792f128d1dcf64f89ba0c6933f517
parent62b2eea0fee3c7cb4cec288065c0a8235f128c42 (diff)
downloadnginx-1562200066d73a037ecfa4e15548cbcc239b354f.tar.gz
nginx-1562200066d73a037ecfa4e15548cbcc239b354f.tar.bz2
QUIC: fixed PATH_RESPONSE frame expansion.
The PATH_RESPONSE frame must be expanded to 1200, except the case when anti-amplification limit is in effect, i.e. on unvalidated paths. Previously, the anti-amplification limit was always applied.
Diffstat (limited to '')
-rw-r--r--src/event/quic/ngx_event_quic_migration.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/event/quic/ngx_event_quic_migration.c b/src/event/quic/ngx_event_quic_migration.c
index 050b785a6..bea51081d 100644
--- a/src/event/quic/ngx_event_quic_migration.c
+++ b/src/event/quic/ngx_event_quic_migration.c
@@ -47,12 +47,20 @@ ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
path = qsock->path;
/*
+ * An endpoint MUST expand datagrams that contain a PATH_RESPONSE frame
+ * to at least the smallest allowed maximum datagram size of 1200 bytes.
+ * ...
* An endpoint MUST NOT expand the datagram containing the PATH_RESPONSE
* if the resulting data exceeds the anti-amplification limit.
*/
- max = path->received * 3;
- max = (path->sent >= max) ? 0 : max - path->sent;
- pad = ngx_min(1200, max);
+ if (path->state != NGX_QUIC_PATH_VALIDATED) {
+ max = path->received * 3;
+ max = (path->sent >= max) ? 0 : max - path->sent;
+ pad = ngx_min(1200, max);
+
+ } else {
+ pad = 1200;
+ }
sent = ngx_quic_frame_sendto(c, &frame, pad, path->sockaddr, path->socklen);
if (sent < 0) {