diff options
| author | Roman Arutyunyan <arut@nginx.com> | 2023-11-22 14:52:21 +0400 |
|---|---|---|
| committer | Roman Arutyunyan <arut@nginx.com> | 2023-11-22 14:52:21 +0400 |
| commit | 6c78bb9bb1ccbf91f5f059c13a82badea529012a (patch) | |
| tree | d71cac4f8adb32c40ee21d46efa94e13e9c45527 /src/event/quic/ngx_event_quic_migration.c | |
| parent | 0efe8db1d0c331bad799dcaa0b2a24e739f26c98 (diff) | |
| download | nginx-6c78bb9bb1ccbf91f5f059c13a82badea529012a.tar.gz nginx-6c78bb9bb1ccbf91f5f059c13a82badea529012a.tar.bz2 | |
QUIC: fixed anti-amplification with explicit send.
Previously, when using ngx_quic_frame_sendto() to explicitly send a packet with
a single frame, anti-amplification limit was not properly enforced. Even when
there was no quota left for the packet, it was sent anyway, but with no padding.
Now the packet is not sent at all.
This function is called to send PATH_CHALLENGE/PATH_RESPONSE, PMTUD and probe
packets. For all these cases packet send is retried later in case the send was
not successful.
Diffstat (limited to 'src/event/quic/ngx_event_quic_migration.c')
| -rw-r--r-- | src/event/quic/ngx_event_quic_migration.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/event/quic/ngx_event_quic_migration.c b/src/event/quic/ngx_event_quic_migration.c index 2fccafa41..efb167b0a 100644 --- a/src/event/quic/ngx_event_quic_migration.c +++ b/src/event/quic/ngx_event_quic_migration.c @@ -872,6 +872,7 @@ ngx_quic_expire_path_mtu_discovery(ngx_connection_t *c, ngx_quic_path_t *path) static ngx_int_t ngx_quic_send_path_mtu_probe(ngx_connection_t *c, ngx_quic_path_t *path) { + size_t mtu; ngx_int_t rc; ngx_uint_t log_error; ngx_quic_frame_t frame; @@ -895,7 +896,12 @@ ngx_quic_send_path_mtu_probe(ngx_connection_t *c, ngx_quic_path_t *path) log_error = c->log_error; c->log_error = NGX_ERROR_IGNORE_EMSGSIZE; + mtu = path->mtu; + path->mtu = path->mtud; + rc = ngx_quic_frame_sendto(c, &frame, path->mtud, path); + + path->mtu = mtu; c->log_error = log_error; if (rc == NGX_ERROR) { |
