Mercurial > hg > nginx-quic
comparison src/event/ngx_event_quic.c @ 7838:336d527ca031 quic
Error messages cleanup.
+ added "quic" prefix to all error messages
+ rephrased some messages
+ removed excessive error logging from frame parser
+ added ngx_quic_check_peer() function to check proper source/destination
match and do it one place
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 24 Apr 2020 14:38:49 +0300 |
parents | f175006124d0 |
children | 44cac24aaa44 |
comparison
equal
deleted
inserted
replaced
7837:f175006124d0 | 7838:336d527ca031 |
---|---|
155 static ngx_int_t ngx_quic_initial_input(ngx_connection_t *c, | 155 static ngx_int_t ngx_quic_initial_input(ngx_connection_t *c, |
156 ngx_quic_header_t *pkt); | 156 ngx_quic_header_t *pkt); |
157 static ngx_int_t ngx_quic_handshake_input(ngx_connection_t *c, | 157 static ngx_int_t ngx_quic_handshake_input(ngx_connection_t *c, |
158 ngx_quic_header_t *pkt); | 158 ngx_quic_header_t *pkt); |
159 static ngx_int_t ngx_quic_early_input(ngx_connection_t *c, | 159 static ngx_int_t ngx_quic_early_input(ngx_connection_t *c, |
160 ngx_quic_header_t *pkt); | |
161 static ngx_int_t ngx_quic_check_peer(ngx_quic_connection_t *qc, | |
160 ngx_quic_header_t *pkt); | 162 ngx_quic_header_t *pkt); |
161 static ngx_int_t ngx_quic_app_input(ngx_connection_t *c, | 163 static ngx_int_t ngx_quic_app_input(ngx_connection_t *c, |
162 ngx_quic_header_t *pkt); | 164 ngx_quic_header_t *pkt); |
163 static ngx_int_t ngx_quic_payload_handler(ngx_connection_t *c, | 165 static ngx_int_t ngx_quic_payload_handler(ngx_connection_t *c, |
164 ngx_quic_header_t *pkt); | 166 ngx_quic_header_t *pkt); |
383 | 385 |
384 if (qc->ctp.max_packet_size < NGX_QUIC_MIN_INITIAL_SIZE | 386 if (qc->ctp.max_packet_size < NGX_QUIC_MIN_INITIAL_SIZE |
385 || qc->ctp.max_packet_size > NGX_QUIC_DEFAULT_MAX_PACKET_SIZE) | 387 || qc->ctp.max_packet_size > NGX_QUIC_DEFAULT_MAX_PACKET_SIZE) |
386 { | 388 { |
387 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 389 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
388 "maximum packet size is invalid"); | 390 "quic maximum packet size is invalid"); |
389 return NGX_ERROR; | 391 return NGX_ERROR; |
390 } | 392 } |
391 | 393 |
392 qc->client_tp_done = 1; | 394 qc->client_tp_done = 1; |
393 } | 395 } |
517 ngx_quic_send_ctx_t *ctx; | 519 ngx_quic_send_ctx_t *ctx; |
518 ngx_quic_connection_t *qc; | 520 ngx_quic_connection_t *qc; |
519 static u_char buf[NGX_QUIC_DEFAULT_MAX_PACKET_SIZE]; | 521 static u_char buf[NGX_QUIC_DEFAULT_MAX_PACKET_SIZE]; |
520 | 522 |
521 if (ngx_buf_size(pkt->raw) < NGX_QUIC_MIN_INITIAL_SIZE) { | 523 if (ngx_buf_size(pkt->raw) < NGX_QUIC_MIN_INITIAL_SIZE) { |
522 ngx_log_error(NGX_LOG_INFO, c->log, 0, "too small UDP datagram"); | 524 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
525 "quic UDP datagram is too small for initial packet"); | |
523 return NGX_ERROR; | 526 return NGX_ERROR; |
524 } | 527 } |
525 | 528 |
526 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { | 529 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { |
527 return NGX_ERROR; | 530 return NGX_ERROR; |
528 } | 531 } |
529 | 532 |
530 if (!ngx_quic_pkt_in(pkt->flags)) { | 533 if (!ngx_quic_pkt_in(pkt->flags)) { |
531 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 534 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
532 "invalid initial packet: 0x%xi", pkt->flags); | 535 "quic invalid initial packet: 0x%xi", pkt->flags); |
533 return NGX_ERROR; | 536 return NGX_ERROR; |
534 } | 537 } |
535 | 538 |
536 if (ngx_quic_parse_initial_header(pkt) != NGX_OK) { | 539 if (ngx_quic_parse_initial_header(pkt) != NGX_OK) { |
537 return NGX_ERROR; | 540 return NGX_ERROR; |
655 | 658 |
656 ssl_conn = c->ssl->connection; | 659 ssl_conn = c->ssl->connection; |
657 | 660 |
658 if (SSL_set_quic_method(ssl_conn, &quic_method) == 0) { | 661 if (SSL_set_quic_method(ssl_conn, &quic_method) == 0) { |
659 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 662 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
660 "SSL_set_quic_method() failed"); | 663 "quic SSL_set_quic_method() failed"); |
661 return NGX_ERROR; | 664 return NGX_ERROR; |
662 } | 665 } |
663 | 666 |
664 #ifdef SSL_READ_EARLY_DATA_SUCCESS | 667 #ifdef SSL_READ_EARLY_DATA_SUCCESS |
665 if (SSL_CTX_get_max_early_data(qc->ssl->ctx)) { | 668 if (SSL_CTX_get_max_early_data(qc->ssl->ctx)) { |
684 ngx_quic_hexdump(c->log, "quic transport parameters", p, len); | 687 ngx_quic_hexdump(c->log, "quic transport parameters", p, len); |
685 #endif | 688 #endif |
686 | 689 |
687 if (SSL_set_quic_transport_params(ssl_conn, p, len) == 0) { | 690 if (SSL_set_quic_transport_params(ssl_conn, p, len) == 0) { |
688 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 691 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
689 "SSL_set_quic_transport_params() failed"); | 692 "quic SSL_set_quic_transport_params() failed"); |
690 return NGX_ERROR; | 693 return NGX_ERROR; |
691 } | 694 } |
692 | 695 |
693 qc->max_streams = qc->tp.initial_max_streams_bidi; | 696 qc->max_streams = qc->tp.initial_max_streams_bidi; |
694 qc->state = NGX_QUIC_ST_HANDSHAKE; | 697 qc->state = NGX_QUIC_ST_HANDSHAKE; |
736 qc = c->quic; | 739 qc = c->quic; |
737 | 740 |
738 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, rev->log, 0, "quic input handler"); | 741 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, rev->log, 0, "quic input handler"); |
739 | 742 |
740 if (rev->timedout) { | 743 if (rev->timedout) { |
741 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); | 744 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, |
745 "quic client timed out"); | |
742 ngx_quic_close_connection(c, NGX_DONE); | 746 ngx_quic_close_connection(c, NGX_DONE); |
743 return; | 747 return; |
744 } | 748 } |
745 | 749 |
746 if (c->close) { | 750 if (c->close) { |
1001 pkt.log = c->log; | 1005 pkt.log = c->log; |
1002 pkt.flags = p[0]; | 1006 pkt.flags = p[0]; |
1003 | 1007 |
1004 if (pkt.flags == 0) { | 1008 if (pkt.flags == 0) { |
1005 /* XXX: no idea WTF is this, just ignore */ | 1009 /* XXX: no idea WTF is this, just ignore */ |
1006 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "FIREFOX: ZEROES"); | 1010 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
1011 "quic packet with zero flags, presumably" | |
1012 " firefox padding, ignored"); | |
1007 break; | 1013 break; |
1008 } | 1014 } |
1009 | 1015 |
1010 // TODO: check current state | 1016 // TODO: check current state |
1011 if (ngx_quic_long_pkt(pkt.flags)) { | 1017 if (ngx_quic_long_pkt(pkt.flags)) { |
1019 } else if (ngx_quic_pkt_zrtt(pkt.flags)) { | 1025 } else if (ngx_quic_pkt_zrtt(pkt.flags)) { |
1020 rc = ngx_quic_early_input(c, &pkt); | 1026 rc = ngx_quic_early_input(c, &pkt); |
1021 | 1027 |
1022 } else { | 1028 } else { |
1023 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1029 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1024 "BUG: unknown quic state"); | 1030 "quic unknown long packet type"); |
1025 return NGX_ERROR; | 1031 return NGX_ERROR; |
1026 } | 1032 } |
1027 | 1033 |
1028 } else { | 1034 } else { |
1029 rc = ngx_quic_app_input(c, &pkt); | 1035 rc = ngx_quic_app_input(c, &pkt); |
1108 | 1114 |
1109 keys = &c->quic->keys[ssl_encryption_handshake]; | 1115 keys = &c->quic->keys[ssl_encryption_handshake]; |
1110 | 1116 |
1111 if (keys->client.key.len == 0) { | 1117 if (keys->client.key.len == 0) { |
1112 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1118 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1113 "no read keys yet, packet ignored"); | 1119 "quic no read keys yet, packet ignored"); |
1114 return NGX_DECLINED; | 1120 return NGX_DECLINED; |
1115 } | 1121 } |
1116 | 1122 |
1117 /* extract cleartext data into pkt */ | 1123 /* extract cleartext data into pkt */ |
1118 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { | 1124 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { |
1119 return NGX_ERROR; | 1125 return NGX_ERROR; |
1120 } | 1126 } |
1121 | 1127 |
1122 if (pkt->dcid.len != qc->dcid.len) { | 1128 if (ngx_quic_check_peer(qc, pkt) != NGX_OK) { |
1123 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic dcidl"); | |
1124 return NGX_ERROR; | |
1125 } | |
1126 | |
1127 if (ngx_memcmp(pkt->dcid.data, qc->dcid.data, qc->dcid.len) != 0) { | |
1128 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic dcid"); | |
1129 return NGX_ERROR; | |
1130 } | |
1131 | |
1132 if (pkt->scid.len != qc->scid.len) { | |
1133 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic scidl"); | |
1134 return NGX_ERROR; | |
1135 } | |
1136 | |
1137 if (ngx_memcmp(pkt->scid.data, qc->scid.data, qc->scid.len) != 0) { | |
1138 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic scid"); | |
1139 return NGX_ERROR; | 1129 return NGX_ERROR; |
1140 } | 1130 } |
1141 | 1131 |
1142 if (!ngx_quic_pkt_hs(pkt->flags)) { | 1132 if (!ngx_quic_pkt_hs(pkt->flags)) { |
1143 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1133 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1144 "invalid packet type: 0x%xi", pkt->flags); | 1134 "quic invalid packet type: 0x%xi", pkt->flags); |
1145 return NGX_ERROR; | 1135 return NGX_ERROR; |
1146 } | 1136 } |
1147 | 1137 |
1148 if (ngx_quic_parse_handshake_header(pkt) != NGX_OK) { | 1138 if (ngx_quic_parse_handshake_header(pkt) != NGX_OK) { |
1149 return NGX_ERROR; | 1139 return NGX_ERROR; |
1178 /* extract cleartext data into pkt */ | 1168 /* extract cleartext data into pkt */ |
1179 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { | 1169 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { |
1180 return NGX_ERROR; | 1170 return NGX_ERROR; |
1181 } | 1171 } |
1182 | 1172 |
1183 if (pkt->dcid.len != qc->dcid.len) { | 1173 if (ngx_quic_check_peer(qc, pkt) != NGX_OK) { |
1184 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic dcidl"); | |
1185 return NGX_ERROR; | |
1186 } | |
1187 | |
1188 if (ngx_memcmp(pkt->dcid.data, qc->dcid.data, qc->dcid.len) != 0) { | |
1189 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic dcid"); | |
1190 return NGX_ERROR; | |
1191 } | |
1192 | |
1193 if (pkt->scid.len != qc->scid.len) { | |
1194 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic scidl"); | |
1195 return NGX_ERROR; | |
1196 } | |
1197 | |
1198 if (ngx_memcmp(pkt->scid.data, qc->scid.data, qc->scid.len) != 0) { | |
1199 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected quic scid"); | |
1200 return NGX_ERROR; | 1174 return NGX_ERROR; |
1201 } | 1175 } |
1202 | 1176 |
1203 if (!ngx_quic_pkt_zrtt(pkt->flags)) { | 1177 if (!ngx_quic_pkt_zrtt(pkt->flags)) { |
1204 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1178 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1205 "invalid packet type: 0x%xi", pkt->flags); | 1179 "quic invalid packet type: 0x%xi", pkt->flags); |
1206 return NGX_ERROR; | 1180 return NGX_ERROR; |
1207 } | 1181 } |
1208 | 1182 |
1209 if (ngx_quic_parse_handshake_header(pkt) != NGX_OK) { | 1183 if (ngx_quic_parse_handshake_header(pkt) != NGX_OK) { |
1210 return NGX_ERROR; | 1184 return NGX_ERROR; |
1211 } | 1185 } |
1212 | 1186 |
1213 if (c->quic->state != NGX_QUIC_ST_EARLY_DATA) { | 1187 if (c->quic->state != NGX_QUIC_ST_EARLY_DATA) { |
1214 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unexpected 0-RTT packet"); | 1188 ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic unexpected 0-RTT packet"); |
1215 return NGX_OK; | 1189 return NGX_OK; |
1216 } | 1190 } |
1217 | 1191 |
1218 keys = &c->quic->keys[ssl_encryption_early_data]; | 1192 keys = &c->quic->keys[ssl_encryption_early_data]; |
1219 | 1193 |
1226 if (ngx_quic_decrypt(pkt, c->ssl->connection, &ctx->largest_pn) != NGX_OK) { | 1200 if (ngx_quic_decrypt(pkt, c->ssl->connection, &ctx->largest_pn) != NGX_OK) { |
1227 return NGX_ERROR; | 1201 return NGX_ERROR; |
1228 } | 1202 } |
1229 | 1203 |
1230 return ngx_quic_payload_handler(c, pkt); | 1204 return ngx_quic_payload_handler(c, pkt); |
1205 } | |
1206 | |
1207 | |
1208 static ngx_int_t | |
1209 ngx_quic_check_peer(ngx_quic_connection_t *qc, ngx_quic_header_t *pkt) | |
1210 { | |
1211 if (pkt->dcid.len != qc->dcid.len) { | |
1212 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic unexpected quic dcidl"); | |
1213 return NGX_ERROR; | |
1214 } | |
1215 | |
1216 if (ngx_memcmp(pkt->dcid.data, qc->dcid.data, qc->dcid.len) != 0) { | |
1217 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic unexpected quic dcid"); | |
1218 return NGX_ERROR; | |
1219 } | |
1220 | |
1221 if (pkt->scid.len != qc->scid.len) { | |
1222 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic unexpected quic scidl"); | |
1223 return NGX_ERROR; | |
1224 } | |
1225 | |
1226 if (ngx_memcmp(pkt->scid.data, qc->scid.data, qc->scid.len) != 0) { | |
1227 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic unexpected quic scid"); | |
1228 return NGX_ERROR; | |
1229 } | |
1230 | |
1231 return NGX_OK; | |
1231 } | 1232 } |
1232 | 1233 |
1233 | 1234 |
1234 static ngx_int_t | 1235 static ngx_int_t |
1235 ngx_quic_app_input(ngx_connection_t *c, ngx_quic_header_t *pkt) | 1236 ngx_quic_app_input(ngx_connection_t *c, ngx_quic_header_t *pkt) |
1247 keys = &c->quic->keys[ssl_encryption_application]; | 1248 keys = &c->quic->keys[ssl_encryption_application]; |
1248 next = &c->quic->next_key; | 1249 next = &c->quic->next_key; |
1249 | 1250 |
1250 if (keys->client.key.len == 0) { | 1251 if (keys->client.key.len == 0) { |
1251 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1252 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1252 "no read keys yet, packet ignored"); | 1253 "quic no read keys yet, packet ignored"); |
1253 return NGX_DECLINED; | 1254 return NGX_DECLINED; |
1254 } | 1255 } |
1255 | 1256 |
1256 if (ngx_quic_parse_short_header(pkt, &qc->dcid) != NGX_OK) { | 1257 if (ngx_quic_parse_short_header(pkt, &qc->dcid) != NGX_OK) { |
1257 return NGX_ERROR; | 1258 return NGX_ERROR; |
1446 } | 1447 } |
1447 } | 1448 } |
1448 | 1449 |
1449 if (p != end) { | 1450 if (p != end) { |
1450 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1451 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1451 "trailing garbage in payload: %ui bytes", end - p); | 1452 "quic trailing garbage in payload: %ui bytes", end - p); |
1452 return NGX_ERROR; | 1453 return NGX_ERROR; |
1453 } | 1454 } |
1454 | 1455 |
1455 if (do_close) { | 1456 if (do_close) { |
1456 qc->draining = 1; | 1457 qc->draining = 1; |
1549 * (19.3.1) | 1550 * (19.3.1) |
1550 */ | 1551 */ |
1551 | 1552 |
1552 if (ack->first_range > ack->largest) { | 1553 if (ack->first_range > ack->largest) { |
1553 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1554 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1554 "invalid first range in ack frame"); | 1555 "quic invalid first range in ack frame"); |
1555 return NGX_ERROR; | 1556 return NGX_ERROR; |
1556 } | 1557 } |
1557 | 1558 |
1558 min = ack->largest - ack->first_range; | 1559 min = ack->largest - ack->first_range; |
1559 max = ack->largest; | 1560 max = ack->largest; |
1580 } | 1581 } |
1581 pos += n; | 1582 pos += n; |
1582 | 1583 |
1583 if (gap >= min) { | 1584 if (gap >= min) { |
1584 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1585 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1585 "invalid range %ui in ack frame", i); | 1586 "quic invalid range %ui in ack frame", i); |
1586 return NGX_ERROR; | 1587 return NGX_ERROR; |
1587 } | 1588 } |
1588 | 1589 |
1589 max = min - 1 - gap; | 1590 max = min - 1 - gap; |
1590 | 1591 |
1591 if (range > max + 1) { | 1592 if (range > max + 1) { |
1592 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1593 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1593 "invalid range %ui in ack frame", i); | 1594 "quic invalid range %ui in ack frame", i); |
1594 return NGX_ERROR; | 1595 return NGX_ERROR; |
1595 } | 1596 } |
1596 | 1597 |
1597 min = max - range + 1; | 1598 min = max - range + 1; |
1598 | 1599 |
1638 /* duplicate ACK or ACK for non-ack-eliciting frame */ | 1639 /* duplicate ACK or ACK for non-ack-eliciting frame */ |
1639 return NGX_OK; | 1640 return NGX_OK; |
1640 } | 1641 } |
1641 | 1642 |
1642 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1643 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1643 "ACK for the packet not in sent queue "); | 1644 "quic ACK for the packet not in sent queue "); |
1644 // TODO: handle error properly: PROTOCOL VIOLATION? | 1645 // TODO: handle error properly: PROTOCOL VIOLATION? |
1645 return NGX_ERROR; | 1646 return NGX_ERROR; |
1646 } | 1647 } |
1647 | 1648 |
1648 return NGX_OK; | 1649 return NGX_OK; |
1809 /* frame start offset is in the future, buffer it */ | 1810 /* frame start offset is in the future, buffer it */ |
1810 | 1811 |
1811 /* check limit on total size used by all buffered frames, not actual data */ | 1812 /* check limit on total size used by all buffered frames, not actual data */ |
1812 if (NGX_QUIC_MAX_BUFFERED - fs->total < f->length) { | 1813 if (NGX_QUIC_MAX_BUFFERED - fs->total < f->length) { |
1813 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1814 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1814 "ordered input buffer limit exceeded"); | 1815 "quic ordered input buffer limit exceeded"); |
1815 return NGX_ERROR; | 1816 return NGX_ERROR; |
1816 } | 1817 } |
1817 | 1818 |
1818 dst = ngx_quic_alloc_frame(c, f->length); | 1819 dst = ngx_quic_alloc_frame(c, f->length); |
1819 if (dst == NULL) { | 1820 if (dst == NULL) { |
1985 if (n < NGX_QUIC_STREAM_BUFSIZE) { | 1986 if (n < NGX_QUIC_STREAM_BUFSIZE) { |
1986 n = NGX_QUIC_STREAM_BUFSIZE; | 1987 n = NGX_QUIC_STREAM_BUFSIZE; |
1987 } | 1988 } |
1988 | 1989 |
1989 if (n < f->length) { | 1990 if (n < f->length) { |
1990 ngx_log_error(NGX_LOG_INFO, c->log, 0, "no space in stream buffer"); | 1991 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1992 "quic no space in stream buffer"); | |
1991 return NGX_ERROR; | 1993 return NGX_ERROR; |
1992 } | 1994 } |
1993 | 1995 |
1994 /* | 1996 /* |
1995 * TODO: check IDs are increasing ? create all lower-numbered? | 1997 * TODO: check IDs are increasing ? create all lower-numbered? |
2067 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic existing stream"); | 2069 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic existing stream"); |
2068 | 2070 |
2069 b = sn->b; | 2071 b = sn->b; |
2070 | 2072 |
2071 if ((size_t) ((b->pos - b->start) + (b->end - b->last)) < f->length) { | 2073 if ((size_t) ((b->pos - b->start) + (b->end - b->last)) < f->length) { |
2072 ngx_log_error(NGX_LOG_INFO, c->log, 0, "no space in stream buffer"); | 2074 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
2075 "quic no space in stream buffer"); | |
2073 return NGX_ERROR; | 2076 return NGX_ERROR; |
2074 } | 2077 } |
2075 | 2078 |
2076 if ((size_t) (b->end - b->last) < f->length) { | 2079 if ((size_t) (b->end - b->last) < f->length) { |
2077 b->last = ngx_movemem(b->start, b->pos, b->last - b->pos); | 2080 b->last = ngx_movemem(b->start, b->pos, b->last - b->pos); |
2178 | 2181 |
2179 qc = c->quic; | 2182 qc = c->quic; |
2180 sn = ngx_quic_find_stream(&qc->streams.tree, f->id); | 2183 sn = ngx_quic_find_stream(&qc->streams.tree, f->id); |
2181 | 2184 |
2182 if (sn == NULL) { | 2185 if (sn == NULL) { |
2183 ngx_log_error(NGX_LOG_INFO, c->log, 0, "unknown stream id:%uL", f->id); | 2186 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
2187 "quic unknown stream id:%uL", f->id); | |
2184 return NGX_ERROR; | 2188 return NGX_ERROR; |
2185 } | 2189 } |
2186 | 2190 |
2187 b = sn->b; | 2191 b = sn->b; |
2188 n = sn->fs.received + (b->pos - b->start) + (b->end - b->last); | 2192 n = sn->fs.received + (b->pos - b->start) + (b->end - b->last); |
2593 do { | 2597 do { |
2594 f = ngx_queue_data(q, ngx_quic_frame_t, queue); | 2598 f = ngx_queue_data(q, ngx_quic_frame_t, queue); |
2595 | 2599 |
2596 if (start->first + qc->tp.max_idle_timeout < now) { | 2600 if (start->first + qc->tp.max_idle_timeout < now) { |
2597 ngx_log_error(NGX_LOG_ERR, c->log, 0, | 2601 ngx_log_error(NGX_LOG_ERR, c->log, 0, |
2598 "retransmission timeout"); | 2602 "quic retransmission timeout"); |
2599 return NGX_DECLINED; | 2603 return NGX_DECLINED; |
2600 } | 2604 } |
2601 | 2605 |
2602 if (f->pnum != pn) { | 2606 if (f->pnum != pn) { |
2603 break; | 2607 break; |