Mercurial > hg > nginx
changeset 8557:2727d402e5a5 quic
QUIC: switched to using fixed-length server connection IDs.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 18 Sep 2020 15:53:37 +0300 |
parents | b383120afca3 |
children | 0f37b4ef3cd9 |
files | src/event/ngx_event_quic.c src/event/ngx_event_quic.h |
diffstat | 2 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c Wed Sep 30 20:23:16 2020 +0100 +++ b/src/event/ngx_event_quic.c Fri Sep 18 15:53:37 2020 +0300 @@ -910,24 +910,17 @@ static ngx_int_t ngx_quic_new_dcid(ngx_connection_t *c, ngx_str_t *odcid) { - uint8_t len; ngx_quic_connection_t *qc; qc = c->quic; - if (RAND_bytes(&len, sizeof(len)) != 1) { - return NGX_ERROR; - } - - len = len % 10 + 10; - - qc->dcid.len = len; - qc->dcid.data = ngx_pnalloc(c->pool, len); + qc->dcid.len = NGX_QUIC_SERVER_CID_LEN; + qc->dcid.data = ngx_pnalloc(c->pool, NGX_QUIC_SERVER_CID_LEN); if (qc->dcid.data == NULL) { return NGX_ERROR; } - if (RAND_bytes(qc->dcid.data, len) != 1) { + if (RAND_bytes(qc->dcid.data, NGX_QUIC_SERVER_CID_LEN) != 1) { return NGX_ERROR; }