From: Vadim Zhestikov Date: Tue, 20 Oct 2026 20:02:35 +0000 (-0700) Subject: QUIC: avoid updating connection address for a backup path X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static/gitweb.js?a=commitdiff_plain;h=HEAD;p=nginx.git QUIC: avoid updating connection address for a backup path On NAT rebinding, both the new path and the previously active path are validated. If the previous path, now a backup, was validated last, the connection address was updated to its address, and new streams used it while packets were exchanged on the new path. Validation of the previous path only checks that it is still viable and does not make it active again, see RFC 9000, 9.3.3. The fix is to update the connection address only for the active path. If the client migrates back to the previous path, the address is updated in ngx_quic_handle_migration(), as the path is already validated. The connection address is also updated when a backup path is restored after the active path fails validation. Commit f37ec3e5d removed this, assuming the address never tracked a path that could later fail; an incomplete MTU validation breaks that assumption, as the address is set after the first, size-limited round and before the path is re-validated with full-size datagrams. The problem appeared in f37ec3e5d (1.31.0). Reported by Keita Sode of SYZD Research LLC. --- diff --git a/src/event/quic/ngx_event_quic_migration.c b/src/event/quic/ngx_event_quic_migration.c index be8ff22aa..623f00354 100644 --- a/src/event/quic/ngx_event_quic_migration.c +++ b/src/event/quic/ngx_event_quic_migration.c @@ -196,7 +196,9 @@ valid: path->validated = 1; - ngx_quic_set_connection_path(c, path); + if (path == qc->path) { + ngx_quic_set_connection_path(c, path); + } if (path->mtu_unvalidated) { path->mtu_unvalidated = 0; @@ -821,6 +823,8 @@ ngx_quic_expire_path_validation(ngx_connection_t *c, ngx_quic_path_t *path) qc->path = bkp; qc->path->tag = NGX_QUIC_PATH_ACTIVE; + ngx_quic_set_connection_path(c, qc->path); + ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic path seq:%uL addr:%V is restored from backup", qc->path->seqnum, &qc->path->addr_text);