Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8386:81f85c479d7e quic
Discard packets without fixed bit or reserved bits set.
Section 17.2 and 17.3 of QUIC transport:
Fixed bit: Packets containing a zero value for this bit are not
valid packets in this version and MUST be discarded.
Reserved bit: An endpoint MUST treat receipt of a packet that has
a non-zero value for these bits, after removing both packet and
header protection, as a connection error of type PROTOCOL_VIOLATION.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 14 May 2020 01:06:45 +0300 |
parents | fb7422074258 |
children | eebdda507ec3 |
comparison
equal
deleted
inserted
replaced
8385:fb7422074258 | 8386:81f85c479d7e |
---|---|
263 | 263 |
264 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | 264 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, |
265 "quic long packet flags:%xi version:%xD", | 265 "quic long packet flags:%xi version:%xD", |
266 pkt->flags, pkt->version); | 266 pkt->flags, pkt->version); |
267 | 267 |
268 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) { | |
269 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set"); | |
270 return NGX_DECLINED; | |
271 } | |
272 | |
268 if (pkt->version != NGX_QUIC_VERSION) { | 273 if (pkt->version != NGX_QUIC_VERSION) { |
269 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, | 274 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, |
270 "quic unsupported version: 0x%xi", pkt->version); | 275 "quic unsupported version: 0x%xi", pkt->version); |
271 return NGX_ERROR; | 276 return NGX_ERROR; |
272 } | 277 } |
440 return NGX_ERROR; | 445 return NGX_ERROR; |
441 } | 446 } |
442 | 447 |
443 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | 448 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, |
444 "quic short packet flags:%xi", pkt->flags); | 449 "quic short packet flags:%xi", pkt->flags); |
450 | |
451 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) { | |
452 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set"); | |
453 return NGX_DECLINED; | |
454 } | |
445 | 455 |
446 if (ngx_memcmp(p, dcid->data, dcid->len) != 0) { | 456 if (ngx_memcmp(p, dcid->data, dcid->len) != 0) { |
447 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "unexpected quic dcid"); | 457 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "unexpected quic dcid"); |
448 return NGX_ERROR; | 458 return NGX_ERROR; |
449 } | 459 } |