mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
QUIC: switched to using fixed-length server connection IDs.
This commit is contained in:
parent
469f69bf2c
commit
6c0be4b4cf
@ -910,24 +910,17 @@ ngx_quic_negotiate_version(ngx_connection_t *c, ngx_quic_header_t *inpkt)
|
|||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_quic_new_dcid(ngx_connection_t *c, ngx_str_t *odcid)
|
ngx_quic_new_dcid(ngx_connection_t *c, ngx_str_t *odcid)
|
||||||
{
|
{
|
||||||
uint8_t len;
|
|
||||||
ngx_quic_connection_t *qc;
|
ngx_quic_connection_t *qc;
|
||||||
|
|
||||||
qc = c->quic;
|
qc = c->quic;
|
||||||
|
|
||||||
if (RAND_bytes(&len, sizeof(len)) != 1) {
|
qc->dcid.len = NGX_QUIC_SERVER_CID_LEN;
|
||||||
return NGX_ERROR;
|
qc->dcid.data = ngx_pnalloc(c->pool, NGX_QUIC_SERVER_CID_LEN);
|
||||||
}
|
|
||||||
|
|
||||||
len = len % 10 + 10;
|
|
||||||
|
|
||||||
qc->dcid.len = len;
|
|
||||||
qc->dcid.data = ngx_pnalloc(c->pool, len);
|
|
||||||
if (qc->dcid.data == NULL) {
|
if (qc->dcid.data == NULL) {
|
||||||
return NGX_ERROR;
|
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;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@
|
|||||||
|
|
||||||
#define NGX_QUIC_STREAM_BUFSIZE 65536
|
#define NGX_QUIC_STREAM_BUFSIZE 65536
|
||||||
|
|
||||||
|
#define NGX_QUIC_SERVER_CID_LEN 20
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* configurable */
|
/* configurable */
|
||||||
|
Loading…
Reference in New Issue
Block a user