comparison src/event/ngx_event_quic_transport.c @ 8533:62b58f0a4711 quic

QUIC: discard incorrect packets instead of closing the connection. quic-transport 5.2: Packets that are matched to an existing connection are discarded if the packets are inconsistent with the state of that connection. 5.2.2: Servers MUST drop incoming packets under all other circumstances.
author Vladimir Homutov <vl@nginx.com>
date Tue, 01 Sep 2020 17:20:42 +0300
parents 4ff2a0b747d1
children 88676e7f4449
comparison
equal deleted inserted replaced
8532:b13141d6d250 8533:62b58f0a4711
274 "quic long packet flags:%xd version:%xD", 274 "quic long packet flags:%xd version:%xD",
275 pkt->flags, pkt->version); 275 pkt->flags, pkt->version);
276 276
277 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) { 277 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) {
278 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set"); 278 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set");
279 return NGX_DECLINED; 279 return NGX_ERROR;
280 } 280 }
281 281
282 p = ngx_quic_read_uint8(p, end, &idlen); 282 p = ngx_quic_read_uint8(p, end, &idlen);
283 if (p == NULL) { 283 if (p == NULL) {
284 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, 284 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
489 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 489 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
490 "quic short packet flags:%xd", pkt->flags); 490 "quic short packet flags:%xd", pkt->flags);
491 491
492 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) { 492 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) {
493 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set"); 493 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set");
494 return NGX_DECLINED; 494 return NGX_ERROR;
495 } 495 }
496 496
497 if (ngx_memcmp(p, dcid->data, dcid->len) != 0) { 497 if (ngx_memcmp(p, dcid->data, dcid->len) != 0) {
498 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "unexpected quic dcid"); 498 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "unexpected quic dcid");
499 return NGX_ERROR; 499 return NGX_ERROR;