comparison src/event/ngx_event_quic.c @ 8631:e167c7b4cff4 quic

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.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 11 Nov 2020 17:56:02 +0000
parents 279ad36f2f4b
children 831d1960826f
comparison
equal deleted inserted replaced
8630:279ad36f2f4b 8631:e167c7b4cff4
2156 return NGX_ERROR; 2156 return NGX_ERROR;
2157 } 2157 }
2158 2158
2159 ngx_quic_clear_temp_server_ids(c); 2159 ngx_quic_clear_temp_server_ids(c);
2160 2160
2161 qc->dcid.len = NGX_QUIC_SERVER_CID_LEN;
2162 qc->dcid.data = ngx_pnalloc(c->pool, qc->dcid.len);
2163 if (qc->dcid.data == NULL) {
2164 return NGX_ERROR;
2165 }
2166
2161 if (ngx_quic_create_server_id(c, qc->dcid.data) != NGX_OK) { 2167 if (ngx_quic_create_server_id(c, qc->dcid.data) != NGX_OK) {
2162 return NGX_ERROR; 2168 return NGX_ERROR;
2163 } 2169 }
2164 2170
2165 qc->server_seqnum = 0; 2171 qc->server_seqnum = 0;