aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2020-09-18 15:53:37 +0300
committerVladimir Homutov <vl@nginx.com>2020-09-18 15:53:37 +0300
commit6c0be4b4cf63d730c556b5265a080b3a331b35ae (patch)
tree74838902db3feb60bfa60fa25b37efdd5500f893 /src
parent469f69bf2cfe0119835062f2de1e3a1ab76d799c (diff)
downloadnginx-6c0be4b4cf63d730c556b5265a080b3a331b35ae.tar.gz
nginx-6c0be4b4cf63d730c556b5265a080b3a331b35ae.zip
QUIC: switched to using fixed-length server connection IDs.
Diffstat (limited to 'src')
-rw-r--r--src/event/ngx_event_quic.c13
-rw-r--r--src/event/ngx_event_quic.h2
2 files changed, 5 insertions, 10 deletions
diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c
index d0e8f383d..f8e449517 100644
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -910,24 +910,17 @@ ngx_quic_negotiate_version(ngx_connection_t *c, ngx_quic_header_t *inpkt)
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;
}
diff --git a/src/event/ngx_event_quic.h b/src/event/ngx_event_quic.h
index 2399860af..ef3a15a73 100644
--- a/src/event/ngx_event_quic.h
+++ b/src/event/ngx_event_quic.h
@@ -54,6 +54,8 @@
#define NGX_QUIC_STREAM_BUFSIZE 65536
+#define NGX_QUIC_SERVER_CID_LEN 20
+
typedef struct {
/* configurable */