diff options
author | Martin Duke <m.duke@f5.com> | 2021-10-12 11:57:50 +0300 |
---|---|---|
committer | Martin Duke <m.duke@f5.com> | 2021-10-12 11:57:50 +0300 |
commit | 7b12abb0a85e7790dffc08ab3ad64893d957f75c (patch) | |
tree | bbd1ccb920419732c87380ec68ae0fc09931ebb8 /src | |
parent | 5e37df0bf413bf34407ff4b399b58dc006e24b71 (diff) | |
download | nginx-7b12abb0a85e7790dffc08ab3ad64893d957f75c.tar.gz nginx-7b12abb0a85e7790dffc08ab3ad64893d957f75c.zip |
QUIC: attempt decrypt before checking for stateless reset.
Checking the reset after encryption avoids false positives. More importantly,
it avoids the check entirely in the usual case where decryption succeeds.
RFC 9000, 10.3.1 Detecting a Stateless Reset
Endpoints MAY skip this check if any packet from a datagram is
successfully processed.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/quic/ngx_event_quic.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/event/quic/ngx_event_quic.c b/src/event/quic/ngx_event_quic.c index 1217d0230..8741b83e6 100644 --- a/src/event/quic/ngx_event_quic.c +++ b/src/event/quic/ngx_event_quic.c @@ -804,8 +804,11 @@ ngx_quic_process_packet(ngx_connection_t *c, ngx_quic_conf_t *conf, return NGX_DECLINED; } - } else { + } + rc = ngx_quic_process_payload(c, pkt); + + if (rc == NGX_DECLINED && pkt->level == ssl_encryption_application) { if (ngx_quic_process_stateless_reset(c, pkt) == NGX_OK) { ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic stateless reset packet detected"); @@ -817,7 +820,7 @@ ngx_quic_process_packet(ngx_connection_t *c, ngx_quic_conf_t *conf, } } - return ngx_quic_process_payload(c, pkt); + return rc; } /* packet does not belong to a connection */ |