diff options
author | Roman Arutyunyan <arut@nginx.com> | 2020-11-11 17:56:02 +0000 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2020-11-11 17:56:02 +0000 |
commit | db7fbc4d04d678c16500d4453df88f471ff27c61 (patch) | |
tree | 42d881f3a680135c95c2b1e874eeda1952032fc0 | |
parent | 2fd31c8959fbae8f069d09b61f339358214e75d1 (diff) | |
download | nginx-db7fbc4d04d678c16500d4453df88f471ff27c61.tar.gz nginx-db7fbc4d04d678c16500d4453df88f471ff27c61.zip |
QUIC: reallocate qc->dcid on retry.
Previously new dcid was generated in the same memory that was allocated for
qc->dcid when creating the QUIC connection. However this memory was also
referenced by initial_source_connection_id and retry_source_connection_id
transport parameters. As a result these parameters changed their values after
retry which broke the protocol.
-rw-r--r-- | src/event/ngx_event_quic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c index 7643cecfb..099f8778e 100644 --- a/src/event/ngx_event_quic.c +++ b/src/event/ngx_event_quic.c @@ -2158,6 +2158,12 @@ ngx_quic_process_packet(ngx_connection_t *c, ngx_quic_conf_t *conf, ngx_quic_clear_temp_server_ids(c); + qc->dcid.len = NGX_QUIC_SERVER_CID_LEN; + qc->dcid.data = ngx_pnalloc(c->pool, qc->dcid.len); + if (qc->dcid.data == NULL) { + return NGX_ERROR; + } + if (ngx_quic_create_server_id(c, qc->dcid.data) != NGX_OK) { return NGX_ERROR; } |