mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
QUIC: multiple versions support.
Draft-29 and beyond are now treated as compatible versions.
This commit is contained in:
parent
66cb03f003
commit
7f43460387
@ -1163,9 +1163,7 @@ ngx_quic_negotiate_version(ngx_connection_t *c, ngx_quic_header_t *inpkt)
|
|||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
ngx_quic_header_t pkt;
|
ngx_quic_header_t pkt;
|
||||||
|
static u_char buf[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE];
|
||||||
/* buffer size is calculated assuming a single supported version */
|
|
||||||
static u_char buf[NGX_QUIC_MAX_LONG_HEADER + sizeof(uint32_t)];
|
|
||||||
|
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
"sending version negotiation packet");
|
"sending version negotiation packet");
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#ifndef NGX_QUIC_DRAFT_VERSION
|
#ifndef NGX_QUIC_DRAFT_VERSION
|
||||||
#define NGX_QUIC_DRAFT_VERSION 29
|
#define NGX_QUIC_DRAFT_VERSION 29
|
||||||
#endif
|
#endif
|
||||||
#define NGX_QUIC_VERSION (0xff000000 + NGX_QUIC_DRAFT_VERSION)
|
|
||||||
|
|
||||||
#define NGX_QUIC_MAX_SHORT_HEADER 25 /* 1 flags + 20 dcid + 4 pn */
|
#define NGX_QUIC_MAX_SHORT_HEADER 25 /* 1 flags + 20 dcid + 4 pn */
|
||||||
#define NGX_QUIC_MAX_LONG_HEADER 56
|
#define NGX_QUIC_MAX_LONG_HEADER 56
|
||||||
|
@ -56,6 +56,8 @@
|
|||||||
: ((uint64_t) value) <= 1073741823 ? 4 \
|
: ((uint64_t) value) <= 1073741823 ? 4 \
|
||||||
: 8)
|
: 8)
|
||||||
|
|
||||||
|
#define NGX_QUIC_VERSION(c) (0xff000000 + (c))
|
||||||
|
|
||||||
|
|
||||||
static u_char *ngx_quic_parse_int(u_char *pos, u_char *end, uint64_t *out);
|
static u_char *ngx_quic_parse_int(u_char *pos, u_char *end, uint64_t *out);
|
||||||
static void ngx_quic_build_int(u_char **pos, uint64_t value);
|
static void ngx_quic_build_int(u_char **pos, uint64_t value);
|
||||||
@ -101,9 +103,18 @@ static ngx_int_t ngx_quic_parse_transport_param(u_char *p, u_char *end,
|
|||||||
uint16_t id, ngx_quic_tp_t *dst);
|
uint16_t id, ngx_quic_tp_t *dst);
|
||||||
|
|
||||||
|
|
||||||
/* currently only single version (selected at compile-time) is supported */
|
|
||||||
uint32_t ngx_quic_versions[] = {
|
uint32_t ngx_quic_versions[] = {
|
||||||
NGX_QUIC_VERSION
|
#if (NGX_QUIC_DRAFT_VERSION >= 29)
|
||||||
|
/* pretend we support all versions in range draft-29..v1 */
|
||||||
|
NGX_QUIC_VERSION(29),
|
||||||
|
NGX_QUIC_VERSION(30),
|
||||||
|
NGX_QUIC_VERSION(31),
|
||||||
|
NGX_QUIC_VERSION(32),
|
||||||
|
/* QUICv1 */
|
||||||
|
0x00000001
|
||||||
|
#else
|
||||||
|
NGX_QUIC_VERSION(NGX_QUIC_DRAFT_VERSION)
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NGX_QUIC_NVERSIONS \
|
#define NGX_QUIC_NVERSIONS \
|
||||||
|
Loading…
Reference in New Issue
Block a user